Skip to main content
Make sure you have an account on the Ababilpay Dashboard and a testnet API key before starting.

Before You Begin

  1. Sign in to the Ababilpay Dashboard
  2. Go to API Keys and create a new sk_test_... key
  3. Go to Wallets and add at least one testnet wallet on any supported chain (Base Sepolia, Ethereum Sepolia, Arc Testnet, or Solana Devnet)

The fastest path. You create an intent on your backend, redirect the buyer to Ababil’s hosted checkout page, and poll for confirmation. No frontend work required.
1

Create a payment intent

Call POST /api/v1/x402/intents from your backend with the amount and redirect URLs.
cURL
curl -X POST https://testnetv1.ababilpay.xyz/api/v1/x402/intents \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount_usdc":  10.00,
    "description":  "Test Order",
    "order_id":     "order_001",
    "redirect_url": "https://yoursite.com/success",
    "cancel_url":   "https://yoursite.com/cancel"
  }'
Response:
{
  "success": true,
  "data": {
    "intent_id":    "d03e0751-5a79-4b33-aa0e-d33dee344f27",
    "status":       "pending",
    "amount_usdc":  10.00,
    "checkout_url": "https://testnetv1.ababilpay.xyz/pay/d03e0751-5a79-4b33-aa0e-d33dee344f27",
    "expires_at":   "2026-05-26T13:00:00Z"
  }
}
2

Redirect the buyer

Send the buyer to checkout_url. Ababil handles wallet connect, chain selection, signing, and on-chain settlement.
// Express.js example
res.redirect(data.checkout_url)
3

Confirm payment

After the buyer lands on your redirect_url, poll the intent to verify settlement before fulfilling the order.
const res = await fetch(
  `https://testnetv1.ababilpay.xyz/api/v1/x402/intents/${intentId}`,
  { headers: { "Authorization": "Bearer sk_test_..." } }
)
const { data } = await res.json()

if (data.status === "paid") {
  console.log("Settled on-chain:", data.tx_hash)
  // fulfil order
}
A confirmed payment response looks like this:
{
  "success": true,
  "data": {
    "intent_id":     "d03e0751-5a79-4b33-aa0e-d33dee344f27",
    "status":        "paid",
    "amount_usdc":   10.00,
    "tx_hash":       "0xf4753b209212ece119cb099f8f499efb6a4df031...",
    "buyer_address": "0xBuyerAddress",
    "chain":         "eip155:84532",
    "paid_at":       "2026-05-26T12:05:00Z"
  }
}

Option B — Custom Integration (Full Control)

Build your own payment UI or pay programmatically from an AI agent. Your frontend (or agent) signs the EIP-3009 authorization and submits it to Ababil for settlement.
1

Create a payment intent

Same endpoint as above — no redirect_url needed for custom flows.
curl -X POST https://testnetv1.ababilpay.xyz/api/v1/x402/intents \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "amount_usdc": 10.00, "order_id": "order_001" }'
The response includes payment_requirements — one entry per chain your merchant wallet supports.
2

Sign EIP-3009 typed data

Pick the payment_requirement matching the buyer’s chain and sign a TransferWithAuthorization message.
// wagmi (React)
const signature = await signTypedDataAsync({
  domain: {
    name:              req.usdcDomainName,   // always read from API
    version:           "2",
    chainId:           parseInt(req.network.split(":")[1]),
    verifyingContract: req.asset,
  },
  types: {
    TransferWithAuthorization: [
      { name: "from",        type: "address" },
      { name: "to",          type: "address" },
      { name: "value",       type: "uint256" },
      { name: "validAfter",  type: "uint256" },
      { name: "validBefore", type: "uint256" },
      { name: "nonce",       type: "bytes32" },
    ],
  },
  primaryType: "TransferWithAuthorization",
  message: {
    from:        address,
    to:          req.payTo,
    value:       BigInt(req.maxAmountRequired),
    validAfter:  0n,
    validBefore: BigInt(Math.floor(Date.now() / 1000) + 900),
    nonce:       `0x${crypto.getRandomValues(new Uint8Array(32))
                   .reduce((s, b) => s + b.toString(16).padStart(2,"0"), "")}`,
  },
})
3

Submit settlement

Send the signed payload to /api/v1/x402/pay. Ababil verifies the signature and submits the on-chain transfer.
curl -X POST https://testnetv1.ababilpay.xyz/api/v1/x402/pay \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "intent_id": "d03e0751-5a79-4b33-aa0e-d33dee344f27",
    "payment_signature": {
      "scheme":      "exact",
      "network":     "eip155:84532",
      "x402Version": 1,
      "payload": {
        "from":        "0xBuyerAddress",
        "to":          "0xMerchantAddress",
        "value":       "10000000",
        "validAfter":  "0",
        "validBefore": "1748300000",
        "nonce":       "0x7752857d...",
        "signature":   "0xacb8e1f5..."
      }
    }
  }'
On success, USDC lands directly in your merchant dashboard wallet.

Next Steps

Hosted Gateway

Full walkthrough of Path A with Node.js and Python examples.

Custom Integration

EIP-3009 signing details, wagmi and viem code, Solana flow.

AI Agent Integration

Enable autonomous USDC payments from AI agents using a private key.

Errors & Troubleshooting

Common mistakes, error codes, and how to fix them.