Sandbox Testing
Use sandbox to verify checkout creation, customer redirect, status handling, and webhook reconciliation before using production credentials.
Base URL
https://api.sandbox.blox.mySandbox and production use different credentials and token IDs. Resolve tokenId from GET /v1/wallet/networks in each environment rather than hard-coding it.
Before testing
Prepare:
- A sandbox API key with Onramp enabled
- Each checkout type you plan to test enabled separately — holding one never grants another
- A funded checkout prefund balance if you are testing
CHARGE_TO_PREFUND - A registered signer public key and the matching private key
- A destination EVM or Solana address you control
- A
CHECKOUTwebhook endpoint under Devtools → Webhooks
Blox-account checkout test
- Resolve an MYRC
tokenIdwhose network matchesaddressTo. - Send
POST /v1/checkoutwith"type": "BLOX_ACCOUNT"and a persistedIdempotency-Key. - Store
checkoutIdand open the completecheckoutUrl, including its query string. - Sign in with a sandbox Blox account and complete payment.
- Expect the checkout to progress through
CREATED,PENDING, andPROCESSINGtoCOMPLETED. - Confirm
checkout.updated, then reconcile withGET /v1/checkout/{id}.
For BLOX_ACCOUNT, fee is "0" and netAmount equals amount. Sending feeMode should return 400.
Hosted FPX checkout test
- Send
POST /v1/checkoutwith"type": "FPX_HOSTED"andfeeMode, and no bank fields. - Confirm the checkout is
CREATED— no FPX bill exists yet, which is the difference from direct. - Open the returned
checkoutUrl; the BLOX page should render a bank picker. - Pick a bank and submit; the checkout should move to
PENDINGand hand off to the sandbox FPX session. - Verify the same status and webhook flow as above.
Direct FPX checkout test
- Fetch
GET /v1/checkout/banks. - Select an active bank and pass its
codeandtypeasbankandbankType. - Send
POST /v1/checkoutwith"type": "FPX_DIRECT",buyerName, andfeeMode. - Confirm the checkout is already
PENDING— the bill was created with the link. - Open the returned
checkoutUrland complete the sandbox FPX session.
Test both fee modes on either FPX type if BLOX has configured a checkout fee on your sandbox account:
DEDUCT_FROM_AMOUNT: confirmnetAmountis the amount settled after the fee.CHARGE_TO_PREFUND: confirm your checkout prefund drops by the fee at creation,netAmountstays the full amount, and letting the link expire returns the fee to the prefund.CHARGE_TO_PREFUNDwith an empty prefund: confirm the create call returns400 INSUFFICIENT_BALANCEand that no checkout was created.
Expiration and cancellation
- Leave a checkout unpaid for 20 minutes; it should become
FAILEDand emitcheckout.updated. - Cancel from the checkout page; it should become
CANCELLEDwithout a webhook, so confirm it through the read endpoint. - Always stop fulfillment unless the authoritative checkout status is
COMPLETED.
Production switch
Before going live:
- Change the base URL to
https://api.blox.myand use production credentials. - Resolve the production
tokenIdagain. - Register the production webhook URL and secret.
- Confirm access for each checkout type you use, plus fees and limits, with BLOX.
- Fund the production checkout prefund if you use
CHARGE_TO_PREFUND.