Skip to content

Configuration

Prop Required Notes
publicKey yes your pk_ key
reference yes the ckr_ reference your server got from creating a checkout
isOpen / onClose yes you control visibility
onSuccess yes fires on submission, not confirmation
onError recommended called with an error (use error.message) on failure
theme no light or dark
language no default language; the customer can still change it
environment no production (default) or staging; see Environments
apiUrl, paymentScreenUrl no overrides for private deployments; normally leave unset
signedInvoices no leave unset. Pass false only if support asks you to

A checkout is created by your server, with your secret key, before the customer sees anything. It fixes the amount, currency, order reference and callback URL, so none of them can be changed from the browser. The SDK loads those details from the reference and shows them to the customer.

Terminal window
curl -X POST https://hub.stablezact.com/api/v1/payments/checkout \
-H "Authorization: Bearer $STABLEZACT_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 49.99,
"currency": "USD",
"orderId": "ORD-1234",
"callbackUrl": "https://yourstore.com/webhooks/stablezact",
"metadata": { "basket": "b-99", "channel": "web" }
}'
{
"success": true,
"checkout": {
"reference": "ckr_k3J...",
"amount": 49.99,
"currency": "USD",
"paymentAmountUsd": 49.99,
"merchantName": "Your Store",
"orderId": "ORD-1234",
"expiresAt": "2026-11-11T15:00:00.000Z",
"status": "initialized"
}
}

Send only checkout.reference to the browser. Never send the secret key to the browser; the checkout endpoint refuses a public key.

Field Notes
amount required
currency the currency you price in: USD (default), NGN, GHS, ZAR, EUR or GBP. The customer pays the equivalent in USDC or USDT, fixed when the checkout is created
orderId your own reference for the purchase (up to 100 characters)
callbackUrl where webhooks for this payment are delivered; see Webhooks
metadata arbitrary JSON, returned on reads of the payment and included in webhooks
description shown with the checkout (up to 240 characters)
preferredNetwork, preferredCurrency optional hints for what to show first
expiresInSeconds between 60 and 86400. Default 900 (15 minutes)
reference optional: supply your own random 32 to 128 character reference instead of a generated ckr_ one

Things to know:

  • Create one checkout per attempt. A reference expires (default 15 minutes) and is consumed once a payment is made from it. Opening an expired or used reference shows “Checkout expired” or “Checkout is no longer available”. Create a fresh checkout and pass the new reference.
  • A customer can try again with the same reference if nothing was paid; the server only allows that when it can show no money moved.
  • Reading a checkout needs no secret: GET /api/v1/payments/checkout/{reference} returns the public details, which is what the SDK uses.
  • A repeated request with the same reference returns 409 Reference already in use.

Keep your order reference in the top-level orderId, not inside metadata. metadata is returned on every read of the payment and included in webhooks, so use it for anything else you want to carry along.

Set it per checkout rather than globally; see Webhooks.

currency on the checkout is the currency you price in. The customer then pays in a stablecoin: USDC or USDT, on any chain you have a settlement wallet for. Those are the only two tokens configured on any network. The converted amount is fixed when the checkout is created.

Unsupported invoice currencies are rejected:

{ "success": false, "error": "Unsupported invoice currency: JPY" }

By default the SDK uses production: https://hub.stablezact.com and the hosted payment screen at https://payment.stablezact.com.

environment API Hosted payment screen
production (default) https://hub.stablezact.com https://payment.stablezact.com
staging https://api.staging.stablezact.com the staging payment screen
<StablezactPayment environment="staging" publicKey="pk_test_..." reference={reference} ... />

Create the checkout against the same environment’s API. A reference made on production cannot be opened against staging. If you pass an apiUrl, the SDK works out the environment from it. On localhost it assumes staging.

Use a test public key (pk_test_...) in the SDK, with the same checkout set-up as in production. The SDK detects sandbox mode from the key and shows a Pay with test tokens button: no wallet, gas or real asset is involved. When you go live, swap in your live public key; nothing else in your code changes.

Which chains a customer can pay on is determined by the settlement wallets configured on your merchant account, not by anything you pass to the SDK. A chain with no wallet is not offered, and creating a payment on one directly is rejected:

{
"error": "You haven't set up a wallet address for the Polygon network",
"message": "Please configure a Polygon-specific wallet in your merchant settings before accepting payments on this network.",
"network": "polygon"
}