The sandbox is a separate copy of Bachs where payments are simulated, so you can build and test your integration before your account is verified. Switch to it from Developer Portal → Switch to sandbox, create a sandbox key, and point your code at the sandbox address.
What the sandbox shares with live
Nothing. Balances, customers, products, API keys, webhook endpoints, payout destinations and events are all separate. The sandbox takes its name from your live account and can't be renamed on its own. In the sandbox, the sidebar shows Connect where live shows Partners.
Set up the sandbox
In the sidebar, open Developer Portal and click Switch to sandbox. The dashboard reloads with a "Sandbox mode" banner.
Go to Developer Portal → API Keys and click Create secret key.
Use the key with the sandbox address:
Key starts with | Base URL | |
|---|---|---|
Sandbox |
|
|
Live |
|
|
Requests and responses are otherwise identical, so moving between the two is a change of key and address. To leave the sandbox, click Switch to live in the banner.
Make test payments
Card payments succeed by default. The sandbox checkout has a Test cards button that lists a card that succeeds and one that's declined. Tap a card to copy it. To test a failure, pay with one of these:
Card number | Result |
|---|---|
| Declined |
| Insufficient funds |
| Expired card |
| Processing error |
Any other card number succeeds. For bank transfer, mobile money and crypto, the sandbox checkout has a test panel that makes the payment succeed, fail or arrive underpaid. Each outcome sends the same webhooks as live.
You can create products and payment links in the sandbox and pay them with test details. The sandbox balance fills from your test payments.
Receive webhooks
Webhooks work in the sandbox. See webhooks. To receive events on your own machine, install the Bachs CLI and run:
bachs login --sandboxbachs listen --forward-to localhost:3000/webhooksIn another terminal,
bachs trigger collection.succeededto send a sample event. Triggering works only in the sandbox.
Why it might not work
"Invalid API key" or a key that "isn't accepted"
The key and the address don't match. A sandbox key sent to the live address, or a live key sent to the sandbox, is rejected with 401 UNAUTHORIZED. Check that the key was created in the sandbox, starts with sk_sandbox_, and that your base URL is sandbox-api.bachs.io. See what API errors mean.
403 FORBIDDEN when creating a checkout session
You sent an X-Account-Id header with your own account ID. That header is only for a platform acting for one of its connected accounts. Your key already identifies you, so remove the header.
"Refunds are not supported at the moment"
Message us with the payment ID and say whether you were in the sandbox or live. The docs describe testing refund outcomes in the sandbox by setting simulated_outcome to success or failed.
"Connect application URL is not configured", or no connect in your capabilities
Connect works in the sandbox once your account is upgraded to a registered business. If GET /v1/accounts/me shows no connect capability, check that you're using a sandbox key against the sandbox address and that the upgrade has gone through. See getting Connect enabled.
Bank transfer or NGN card doesn't complete
Sandbox bank transfers aren't detected from real transfers, and sandbox virtual account numbers can't receive real money. Use the test panel on the checkout to complete them. If a transfer still says it's waiting for payment after you use the panel, send us the checkout ID.
The checkout shows a sandbox banner
The link or session was made in the sandbox, so it can't take real payments. Switch to live and create the link again, or use an sk_live_ key.
A 3D Secure screen doesn't appear
A card that supports 3D Secure may be approved without a prompt when the bank treats the payment as low risk. You can't force a challenge on every payment.
Move to live
Get your account verified and clear any tasks under All Settings → Compliance. See how long account review takes.
Create a live key under Developer Portal → API Keys, with only the scopes you need.
Change your base URL to
https://api.bachs.ioand your key to the live one.Recreate your products in live and update their IDs in your code. A product's menu has Copy to Live Account, and a payment link has Copy to live.
Register your webhook endpoints again in live.
If you're a platform, add each connected account again in live, where its owner completes compliance, and ask for Connect on the live account.
If live checkout says no payment method is available, or that Connect isn't enabled, your live account isn't fully approved yet.
Other situations
Settlement is instant in the sandbox. In live, payments wait before they become available, on a schedule that depends on the currency. Test any logic that depends on that gap against when your payments become available to withdraw.
Still stuck?
Message us from the chat in your dashboard with the email on your account, whether you were in the sandbox or live, the checkout or payment ID, and the full error response.
Never send a secret key, password or one-time code in chat or by email. We'll never ask for them.
