Every error from the Bachs API carries an error_code, a stable name you can match in code, and a detail sentence that explains the cause in your case. Find your error_code below. Most are fixed from your side in a few minutes. Only PAYMENTS_NOT_ENABLED needs us.
Why this exists
The HTTP status tells you the family. A 400 means the request or your account setup is the problem, a 401 means the key itself is bad, a 403 means the key is fine but not allowed to do this, a 404 means we can't find what you asked for in your account, a 422 means the request was well formed but a rule rejected it, and a 5xx is on our side and worth retrying. The full list is in the error reference.
How it works
Your account has two environments. Sandbox keys start sk_sandbox_ and talk to https://sandbox-api.bachs.io. Live keys start sk_live_ and talk to https://api.bachs.io. Nothing you set up in one exists in the other, including balances and currencies.
Live keys and live payments only work once your account is approved. Until then you can build and test everything in the sandbox. See how long account review takes.
The developers who sort errors out fastest log the error_code, detail and request ID of every failed call, read Developer Portal → Logs to see what was sent, and match on the code rather than the message text.
Why it might not work
PAYMENTS_NOT_ENABLED
Your customers may see this as "Payments are not enabled for this organization", on a payment link, a checkout page or in a plugin log. It means your account isn't approved for live payments yet. Finish everything under All Settings → Compliance and wait for the review. Only our team can switch payments on. Sometimes a review ends with a decision that we can't support the business, and we'll tell you so. See how long account review takes.
CHECKOUT_HAS_NO_PAYMENT_METHOD
The checkout would have nothing a customer could pay with, so we refused to create it. Go to All Settings → Checkouts → Payment methods and check that a method is on for the currency you're charging. If you passed payment_method_types, the related CHECKOUT_RESTRICTION_LEAVES_NO_PAYMENT_METHOD means your list ruled out everything available, so widen it or leave it out. Card payments over your account's limit can leave a checkout with no method too. See checkout and card payment limits.
BASE_CURRENCY_NOT_HELD_BY_ORG
The message reads "base_currency 'NGN' is not held by this organization". You priced something in a currency your account doesn't hold yet. Go to All Settings → Payout destinations and currencies, turn the currency on under Balance currencies, and try again.
BANK_NOT_PAYABLE
You may see "Withdrawals to this bank are c…" when creating a payout destination. It reads as though the bank is blocked, but the usual cause is a bank code from another source, such as a NIBSS code. Bachs uses its own codes. For OPay, ours is 305, not 100004. Take every code from GET /v1/reference/banks.
PAYOUTS_NOT_ENABLED
Withdrawals are off until your payout requirements are complete. Check All Settings → Compliance for anything under Needs your action. If nothing is there, message us. A payout held for review is a different case, covered in why your payouts are on hold.
CONNECT_CAPABILITY_NOT_ENABLED
Your platform, or the connected account you're acting for, doesn't have the capability the request needs, such as transfers or payouts. Check with GET /v1/accounts/{account_id}/capabilities and look for active. A connected account gets its capabilities once it finishes its own requirements. See Connect onboarding.
401 UNAUTHORIZED
The key is missing, revoked or wrong. Send it as Authorization: Bearer sk_live_..., and match the key to the base URL, because a sandbox key is refused by the live API and a live key by the sandbox. Creating a rotated key disables the old one. Tools that wrap Bachs sometimes show their own message, such as "the provider rejected this key". Check the key and the URL first.
If you pasted a live key into a chat, a ticket or a public repository, treat it as exposed and roll it from Developer Portal → API Keys straight away.
403 FORBIDDEN
Your key is valid but isn't allowed to make this call, usually because it lacks a scope. Open the key under Developer Portal → API Keys and add the scope the call needs. A store plugin that creates products needs write access to products, for example. Give each key only the scopes it uses, and leave Connected Accounts off unless you use Connect.
404 NOT_FOUND
The ID doesn't exist in your account in this environment. Check it for typos, and check you aren't sending a sandbox ID to the live API, or the reverse.
422 VALIDATION_FAILED
The request was well formed but a rule rejected it. Read detail, which names the rule. The related 400 VALIDATION_ERROR lists the failing fields in an errors array. A product with a custom price needs an amount in the request (CUSTOM_AMOUNT_REQUIRED).
success_url must be a publicly accessible URL
localhost is refused. Use a public staging address, or a tunnel to your machine, until you've deployed.
5xx and GATEWAY_UNAVAILABLE
These are on our side and temporary. Retry after a short wait, and send an idempotency key on writes so a retry can't create a duplicate. If it lasts more than a few minutes, tell us.
Other situations
A payment shown as Incomplete isn't an API error. The customer started and didn't finish. See payment statuses explained.
A standard account can only pay out to bank accounts that belong to your own business. To pay your users, use Connect and send transfers to each user's connected account. See Connect onboarding.
Still stuck?
Message us from the chat in your dashboard with the endpoint, the error_code, the detail text, the request ID, the time you sent it, and whether it was sandbox or live.
Never send your secret key, password, PIN or a one-time code in chat or by email. We'll never ask for them.
