API reference
Machine-readable spec: /api/v1/openapi.json.
For bots & agents
Create checkouts and read payment status without a browser. Use a merchant secret key from the dashboard (API keys tab).
# Base URL (production): https://cxpay.cash/api/v1
export CXPay_KEY=cxpay_live_…
# Create a payment intent (USD cents)
curl -sS -X POST "$CXPay_BASE/payment-intents" \
-H "Authorization: Bearer $CXPay_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: unique-order-ref" \
-d '{"amountUsdCents":2500,"description":"Order 42"}'
# Poll status
curl -sS -H "Authorization: Bearer $CXPay_KEY" \
"$CXPay_BASE/payment-intents/pi_…"Hosted checkout URL: use POST /payment-links instead of payment intents when you want a shareable link. Subscribe to webhooks for push updates (webhooks guide).
Authentication
Secret keys: Authorization: Bearer cxpay_live_… or cxpay_test_…. Keep secrets on your server only.
Publishable keys (cxpay_pk_…) are browser-safe and only call POST /public/checkout-sessions for dashboard-configured payment buttons.
GET /me
Authenticated probe for plugins (Test connection). Returns merchant id, mode, and payout wallet summary.
POST /payment-intents
Create a payment. Body: amountUsdCents (or amountMinor + currency), optional rail, payerAsset, description, customerEmail, orderNumber, metadata, returnUrl, cancelUrl, webhookUrl. Header: Idempotency-Key. Those merchant fields are returned on GET /payment-intents/:id and in webhook payloads. Quote lock expiry is expiresAt.
POST /payment-links
Creates an invoice + intent and returns a hosted checkout url plus the same merchant fields and rateLockExpiresAt.
POST /refunds
Local refund bookkeeping (non-custodial). Optional note / reason.
POST /public/checkout-sessions
Body: { "publishableKey": "cxpay_pk_…", "buttonId": "btn_…", "orderReference?", "customerEmail?" }. Amount is taken from the button — never from the client.
Webhooks
Manage endpoints in the dashboard or via API. Events: payment.confirming, succeeded, underpaid, overpaid, expired, blocked/failed, canceled; refund.created / completed. Signature header: cxpay-signature (t=,v1=). Retries use exponential backoff. Replay: POST /webhook-endpoints/deliveries/:deliveryId/replay.
See also status lifecycle and the repo audit docs/integration-audit.md.