Receiver API
Reference for x402-paysdk/receive PaymentRef creation, lookup, listing, revocation, validation, and return types.
TypeScriptimport { createPaymentRef } from 'x402-paysdk/receive';
The receiver entry point manages payment references. It does not sign payer payments, hold merchant order state, or verify fulfillment.
Functions
| Function | Signature | Gateway route |
|---|---|---|
createPaymentRef | (options: CreatePaymentRefOptions) => Promise<PaymentRef> | POST /ref |
getRef | (gateway: string, refId: string) => Promise<PaymentRefSnapshot> | GET /ref/:refId |
listPaymentRefs | (options: ListPaymentRefsOptions) => Promise<PaymentRefList> | GET /ref |
revokePaymentRef | (options: RevokePaymentRefOptions) => Promise<RevokedPaymentRef> | POST /ref/:refId/revoke |
revokePayTo | (options: RevokePayToOptions) => Promise<RevokedPayTo> | POST /payto/:payTo/revoke |
Create options
TypeScriptinterface CreatePaymentRefOptions { gateway: string; payTo: string; network: string; asset?: 'USDC'; amount?: string; invoiceId?: string; notifyUrl?: string; label?: string; description?: string; expiresInSecs?: number; apiKey?: string;}
| Field | Validation |
|---|---|
gateway | Canonical HTTPS origin or local development origin |
payTo | EVM address |
network | Supported network name |
asset | Currently USDC only |
amount | Positive atomic decimal string; omit for open amount |
invoiceId | Bounded public id and requires fixed amount |
notifyUrl | Public HTTPS URL on port 443; requires apiKey in this low-level API |
label | At most 120 UTF-8 bytes |
description | At most 512 UTF-8 bytes |
expiresInSecs | Positive safe integer |
apiKey | Bearer credential when the gateway requires merchant auth |
Return model
TypeScriptinterface PaymentRef { refId: string; refUrl: string; snapshot: { v: 2; scheme: 'exact'; network: string; payTo: string; asset: 'USDC'; amount?: string; resource: string; invoiceId?: string; description?: string; mimeType: string; expiresAt?: number; };}
Persist the immutable snapshot with the business record. It is the expected payment context used for receipt matching and incident analysis.
Listing
listPaymentRefs requires gateway, payTo, and apiKey. limit is a positive safe integer and cursor must be the exact opaque value returned by the gateway.
Each item contains ref id, payTo, network, asset, optional amount/invoice/label, creation and expiry times, and active | revoked status.
Revocation behavior
Revoking a ref prevents future authorization through that ref. Retiring a payTo prevents future use according to gateway policy. Neither operation reverses an already mined transfer; verify historical settlement from chain state and archived receipts.