Skip to content

Payer SDK

Resolve PaymentRef, verify signed offers, request EIP-3009 signatures, and submit x402 payments.

x402-paysdk/pay owns the payer flow. It can inspect requirements, submit a payment, verify receipts, recover settlements, and query transaction status.

Wallet adapter

Implement the narrow WalletSigner contract around your wallet library:

TypeScript
import type { WalletSigner } from 'x402-paysdk/pay';const wallet: WalletSigner = { address: account.address, signTypedData: (typedData) => walletClient.signTypedData(typedData)};

Do not send a private key, seed phrase, or signer object to the gateway.

Pay a fixed reference

TypeScript
import { getPaymentRequired, pay } from 'x402-paysdk/pay';const required = await getPaymentRequired(refUrl);console.log(required.accepts[0].amount);const settlement = await pay({ refUrl, paymentId: `checkout_${checkoutId}`, wallet});

For open-amount refs, pass amount in the token's smallest unit. paymentId should be random or uniquely tied to a single business payment attempt.

Verify finality

TypeScript
import { getTxStatus, verifyReceipt } from 'x402-paysdk/pay';const status = await getTxStatus(gateway, settlement.txHash);const verification = await verifyReceipt({ gateway, signedReceipt: settlement.signedPaymentReceipt!, receipt: settlement.receipt!, expectedPayTo, expectedAmount, minConfirmations: 3});

A signed receipt authenticates gateway output; chain verification establishes settlement finality.