API Overview
What this API covers
bnbpay-api provides indexed payment state and relay operations for x402Flex integrations.
Primary groups:
- health and network metadata
- payment lookup and intent building
- sessions
- invoices
- relay execution
- gift cards
Typed client usage
What this does: initializes a typed API client with canonical request/response types.
import { createApiClient } from '@pepay/x402flex';
const api = createApiClient({
baseUrl: 'https://api.bnbpay.org',
apiKey: process.env.BNBPAY_API_KEY,
});
const health = await api.health();
const networks = await api.networks();
Expected result: typed endpoint access from one SDK package.
Auth model
- Public read endpoints are typically rate-limited.
- Relay endpoints may enforce
x-api-key.
Error model
API errors are surfaced as BnbpayApiError with:
statusCode- parsed
detailspayload (if returned)
Common response shape:
{
"error": "Human readable message"
}
Endpoint map
- Health:
GET /health
- Networks:
GET /networks
- Tokens:
GET /tokens
- Payments:
GET /paymentsGET /payments/:paymentIdGET /payments/:paymentId/statusPOST /payments/build-intentGET /can-pay
- Wallets:
GET /wallets/:address/payments
- Sessions:
GET /sessionsGET /sessions/agent/:addressGET /sessions/:sessionIdGET /sessions/:sessionId/spendsGET /sessions/:sessionId/payments
- Invoices:
POST /invoicesGET /invoices/:invoiceIdGET /invoices/:invoiceId/statusPOST /invoices/:invoiceId/cancelPOST /invoices/:invoiceId/confirm-paymentGET /invoices/:invoiceId/stream-sseGET /invoices/:invoiceId/stream
- Relay:
POST /relay/paymentPOST /relay/permit2/bundlePOST /relay/session/openPOST /relay/session/open-claimablePOST /relay/session/claimPOST /relay/session/revoke
- Gift cards:
POST /giftcards/createPOST /giftcards/claimPOST /giftcards/redeemPOST /giftcards/:cardId/cancelGET /giftcards/:cardIdGET /giftcards
Common integration failures
- Wrong network key for route (
bnbvsbnbTestnet). - Relay payload missing scheme-specific object.
paymentIdlookup before indexer confirmation window.