Developer Documentation

Integrate AshPay in minutes

One SDK. Two chains. Zero blockchain complexity. Replace Stripe at a fraction of the cost.

01
Install the SDK
One package, all chains. ESM + CJS. TypeScript included.
02
Initialize AshPay
Pass your merchant ID and wallet address. Auto chain routing.
03
Charge customers
Call charge() or drop in the React button. We handle the rest.

Installation

Terminal
npm install @ashpay/sdk

Basic Usage

charge.ts
import { AshPay } from '@ashpay/sdk'

const ashpay = new AshPay({
  merchantId: 'your-merchant-id',
  recipientAddress: '7xKp...your_wallet',
  testMode: true,
})

const result = await ashpay.charge({
  amount: 29.99,
  currency: 'USD',
  metadata: { orderId: 'order_123' },
  onSuccess: (tx) => console.log('Paid:', tx.txHash),
})

React Component

Drop in a pre-built payment button. Opens a modal with QR code, fee breakdown, and real-time confirmation.

Checkout.tsx
import { AshPayButton } from '@ashpay/sdk/react'

export function Checkout() {
  return (
    <AshPayButton
      merchantId="your-merchant-id"
      recipientAddress="7xKp...your_wallet"
      amount={29.99}
      onSuccess={(tx) => router.push('/success')}
    />
  )
}

Webhook Events

Get notified when payments complete. Signed with HMAC-SHA256 via the X-AshPay-Signature header.

webhook payload
// POST to your webhook URL
{
  "event": "payment.completed",
  "paymentId": "pay_abc123",
  "amount": 29.99,
  "currency": "USD",
  "txHash": "5Kj8...",
  "chain": "solana",
  "timestamp": "2026-04-05T10:23:00Z",
  "metadata": { "orderId": "order_123" }
}

API Reference

ashpay.charge(params) Initiate a payment
ashpay.getBalance(addr, chain) Query USDC balance
ashpay.watchPayment(requestId) Real-time payment status
ashpay.getPaymentStatus(id) One-shot status check
ashpay.isPaymentConfirmed(hash, chain) On-chain confirmation
generateMnemonic() Create BIP-39 wallet
deriveKeys(mnemonic) Derive Solana + Polygon keys
encryptPrivateKey(key, pin) AES-256-GCM encryption

AshPay vs Stripe

AshPay
Stripe
Fee
0.7%
2.9% + $0.30
Settlement
<1 second
2-7 days
Countries
150+
46
Monthly cost
$0
$0+
Bank required
No
Yes
Self-custody
Yes
No