Senfenico API error codes
When a request fails, base your logic on error_code, never on the message text. The message is in English, may change, and is not meant for the customer.
Error format
Section titled “Error format”{ "status": false, "message": "Charge operation failed. The OTP is invalid. Please try again.", "error_code": "OTP_INVALID"}| Field | Always present? | Content |
|---|---|---|
status |
yes | false |
message |
yes | Technical explanation, in English |
error_code |
almost always | Stable code, listed on this page |
errors |
validation only | Per-field details, see INVALID_DATA |
Responses have no description or description_fr field. The text you show the customer is up to you; the tables below suggest one for each code.
Check the HTTP status and status
Section titled “Check the HTTP status and status”An operator failure does not always come with an HTTP error status.
| Situation | HTTP | status |
|---|---|---|
| Charge created | 201 |
true |
| Charge initialization failed (operator) | 200 |
false |
| OTP submission, successful or not | 200 |
true or false |
| Invalid data | 400 |
false |
| Missing or invalid key, IP refused | 403 |
"False" (string) |
| Object not found | 404 |
false |
| Internal error | 500 |
false |
On an authentication 403, status is the string "False", which is truthy in PHP and JavaScript, so check the HTTP status first (see Authentication).
Errors without an error_code
Section titled “Errors without an error_code”Some responses have no error_code. Identify them by HTTP status.
| HTTP | message |
Cause |
|---|---|---|
403 |
No API key provided. |
X-API-KEY header missing |
403 |
Invalid API Key. |
Unknown, revoked or mistyped key |
404 |
Charge not found |
GET /v1/payment/charges/{reference}/ with an unknown reference, or one created in the other mode |
404 |
Checkout not found |
Same, for a checkout |
404 |
Settlement does not exist with this reference. |
Same, for a settlement |
400 |
It's impossible to make a settlement without a payment account… |
No payment account registered |
429 |
detail field instead of message |
Rate limit exceeded, see RATE_LIMIT_EXCEEDED |
Handle errors in your code
Section titled “Handle errors in your code”Map the code to a customer-facing message, with a generic fallback. Treat an unknown code as a non-final failure.
<?phpfunction senfenico_message(string $code): string { $map = [ 'OTP_INVALID' => 'Wrong code. Check it and try again.', 'OTP_EXPIRED' => 'Code expired. Generate a new one.', 'INSUFFICIENT_FUNDS' => 'Insufficient balance on your account.', 'INVALID_ACCOUNT' => 'Number not recognized by the operator.', ]; return $map[$code] ?? 'The payment did not go through. Try again later.';}
$body = json_decode($response, true);if ($body['status'] !== true) { echo senfenico_message($body['error_code'] ?? '');}MESSAGES = { "OTP_INVALID": "Wrong code. Check it and try again.", "OTP_EXPIRED": "Code expired. Generate a new one.", "INSUFFICIENT_FUNDS": "Insufficient balance on your account.", "INVALID_ACCOUNT": "Number not recognized by the operator.",}DEFAULT = "The payment did not go through. Try again later."
body = response.json()if body.get("status") is not True: print(MESSAGES.get(body.get("error_code"), DEFAULT))const MESSAGES = { OTP_INVALID: 'Wrong code. Check it and try again.', OTP_EXPIRED: 'Code expired. Generate a new one.', INSUFFICIENT_FUNDS: 'Insufficient balance on your account.', INVALID_ACCOUNT: 'Number not recognized by the operator.',};const DEFAULT = 'The payment did not go through. Try again later.';
const body = await res.json();if (body.status !== true) { console.log(MESSAGES[body.error_code] ?? DEFAULT);}In the tables, “retry” means sending a new request, which creates a new operation: there is no idempotency key. Before recreating a charge or a transfer after a network error, look it up with ?ext_id= (see ext_id).
Access and authentication
Section titled “Access and authentication”| Code | HTTP | Meaning | Show the customer | Retry |
|---|---|---|---|---|
IP_NOT_ALLOWED |
403 |
The request IP is not in your live key’s allowlist. The message contains the refused IP. |
“The payment service is temporarily unavailable.” | No, not until the list is fixed |
UNAUTHORIZED_CHARGE_PROVIDER |
403 |
Your account is not allowed to collect payments from this operator. | “This payment method is not available. Choose another one.” | No |
Only sk_live_ keys are filtered by IP; test keys never are. To fix IP_NOT_ALLOWED, add your server’s outgoing IP in the IP allowlist. Changes usually apply immediately, within 5 minutes at most.
In practice, validation catches UNAUTHORIZED_CHARGE_PROVIDER first: you get INVALID_DATA with errors.payment_method_details.provider = You does not have permission to charge with …. Handle both. To have the operator enabled, email contact@senfenico.com.
Data validation
Section titled “Data validation”| Code | HTTP | Meaning | Show the customer | Retry |
|---|---|---|---|---|
INVALID_DATA |
400 |
One or more fields are invalid, or a list filter is invalid (message: Invalid filters). |
A field-specific message (“Invalid number for Orange Money”), not the raw text | Yes, after fixing the data |
BATCH_SIZE_LIMIT_EXCEEDED |
400 |
The bulk transfer batch has more than 100 items. No transfer from the batch is created. | Nothing (integration error) | Yes, in batches of at most 100 |
UNSUPPORTED_PROVIDER |
400 |
The wallet requested for a transfer is not supported. Validation rejects this first and in practice returns INVALID_DATA (Unsupported wallet). |
Nothing (integration error) | No. Use orange_bf, moov_bf, sank_bf, mtn_bj or moov_bj |
CHARGE_NOT_FOUND |
404 (200 when returned by the operator) |
POST /v1/payment/charges/submit: the charge does not exist, belongs to another account, or has already succeeded. Sank Money can also return it during verification. |
“This payment no longer exists or is already confirmed.” | No. Fetch the charge; if it is success, fulfill the order |
TRANSACTION_NOT_FOUND |
404 on retrieval, 200 during OTP |
The transfer or refund does not exist in this mode. Moov, Coris and Sank also return it when the operator cannot find the transaction at OTP time. | Nothing (integration error) | No. Check the reference and the key used (test or live) |
For INVALID_DATA, the errors field details the problem field by field:
{ "status": false, "message": "Invalid data provided. Please check the input and try again.", "error_code": "INVALID_DATA", "errors": { "payment_method_details": { "phone": ["Invalid phone number for Orange BF."] } }}An error that is not tied to one field appears under errors.non_field_errors. To prevent these errors at input time, see Phone number formats and Limits.
OTP code
Section titled “OTP code”| Code | HTTP | Meaning | Show the customer | Retry |
|---|---|---|---|---|
OTP_INVALID |
200 |
The code is wrong, already used, or does not match the amount. In test mode it is also the answer when the number, amount and OTP do not match the test values. | “Wrong code. Check it and try again.” | Yes, with a new code |
OTP_EXPIRED |
200 |
The code expired before it was submitted. Its validity is set by the operator, not by Senfenico. | “Code expired. Generate a new code and enter it quickly.” | Yes, with a new charge and a new code |
OTP_STILL_VALID |
200 |
Moov Money: a code already sent is still valid, and the operator refuses to generate another one. | “A code was already sent to you by SMS. Please use it.” | Submit the code already received, or wait for it to expire |
With Orange Money in live mode, the charge becomes failed on the first refused OTP. The simplest path is then to create a new charge and ask the customer to generate a new code (*144*4*6*amount#).
Customer or operator refusals
Section titled “Customer or operator refusals”These codes describe a refusal by the operator. They come with HTTP 200 and status: false, at charge creation or OTP submission.
| Code | HTTP | Meaning | Show the customer | Retry |
|---|---|---|---|---|
INSUFFICIENT_FUNDS |
200 |
The customer’s mobile money balance is too low. | “Insufficient balance. Top up your account and try again.” | Yes, with a new charge once the account is topped up |
INVALID_ACCOUNT |
200 |
The number is invalid or has no account with the chosen operator. | “This number has no [operator] account. Check the number or the operator.” | Yes, with a corrected number or operator (see Phone number formats) |
NOT_SUBSCRIBER |
200 |
Moov Money (USSD): the number is not registered for mobile money. | “This number is not registered with Moov Money.” | Not with this number |
ACCOUNT_LOCKED |
200 |
Moov Money: the customer’s account is locked by the operator. | “Your mobile money account is locked. Contact your operator.” | No |
DAILY_TRANSACTION_LIMIT_REACHED |
200 |
Orange Money, Moov Money: the customer reached their daily cap, which depends on the operator and their account level. | “You reached your daily limit. Try again tomorrow or use another account.” | Not before the next day |
MONTHLY_TRANSACTION_LIMIT_REACHED |
200 |
Orange Money, Sank Money: same, for the monthly cap. | “You reached your monthly limit with your operator.” | Not this month with this account |
TRANSACTION_INVALID |
200 |
Moov Money: the transaction is no longer valid on the operator side (expired or already processed). | “This payment has expired. Please start again.” | Yes, with a new charge |
UNAUTHORIZED_TRANSACTION |
200 |
Moov Money: the operator refuses this transaction for this account. | “Your operator declined this payment. Contact them or use another method.” | No |
Do not confuse INSUFFICIENT_FUNDS (the customer’s balance) with MERCHANT_INSUFFICIENT_FUNDS (your own balance).
Merchant balance
Section titled “Merchant balance”| Code | HTTP | Meaning | Show the recipient | Retry |
|---|---|---|---|---|
MERCHANT_INSUFFICIENT_FUNDS |
403 |
Your transfer balance does not cover the amount plus fees. Nothing is created. The message names the balance, for example Insufficient balance for Orange BF transfer including fees. |
“Your payout is delayed.” (the problem is on your side) | Yes, after topping up that balance (see Balances) |
In a bulk transfer this case has no code: the item appears in failed_transfers with the same message.
Technical errors
Section titled “Technical errors”| Code | HTTP | Meaning | Show the customer | Retry |
|---|---|---|---|---|
NETWORK_ERROR |
200 |
Senfenico could not reach the operator (timeout, dropped connection). | “The operator’s network is not responding. Try again in a few minutes.” | Yes, after checking the charge status |
EXTERNAL_API_ERROR |
200 |
The operator answered with a technical error. | “The operator’s service is unavailable. Try again later.” | Yes, later |
INTERNAL_ERROR |
500, or 200 during the operator call |
Unexpected error at Senfenico. | “Something went wrong. Try again later.” | Yes, after checking the charge |
UNKNOWN_ERROR |
200 |
The operator returned a response Senfenico cannot classify. The charge becomes failed. |
“The payment did not go through. Try again or use another method.” | Yes, with a new charge |
After NETWORK_ERROR or INTERNAL_ERROR the operation may have gone through: check the charge with GET /v1/payment/charges/{reference}/ before creating another one. If EXTERNAL_API_ERROR persists, if UNKNOWN_ERROR keeps happening for one number, or after an INTERNAL_ERROR, email contact@senfenico.com with the reference.
Reserved codes
Section titled “Reserved codes”These codes are defined in the API but never returned today. If one appears, handle it as shown.
| Code | Meaning | Show the customer | Retry |
|---|---|---|---|
RATE_LIMIT_EXCEEDED |
Rate limit exceeded. Today you get an HTTP 429 without error_code instead (see below). |
“Too many attempts. Please wait a moment.” | Yes, after the indicated delay |
TRANSACTION_CANNOT_PROCESS |
The transaction cannot be processed right now. Treat it as a temporary failure. | “Your payment cannot be processed right now. Try again later.” | Yes, later |
RECIPIENT_DAILY_AMOUNT_LIMIT_REACHED |
Transfers: the recipient reached the maximum amount they can receive per day. | Nothing | Not the same day |
RECIPIENT_MAXIMUM_BALANCE_REACHED |
Transfers: the recipient reached the maximum balance allowed on their account. | Nothing | No, until the recipient lowers their balance |
RECIPIENT_DAILY_TRANSACTION_COUNT_LIMIT_REACHED |
Transfers: the recipient reached the maximum number of incoming transactions per day. | Nothing | Not the same day |
When you exceed the rate limit, the HTTP 429 response uses the framework’s standard format:
{ "detail": "Request was throttled. Expected available in 42 seconds." }A transfer refused by the operator simply becomes failed, without any RECIPIENT_* code.