Softlemon API Documentation
  • Merchant API
  • Partner API
  • Guides
API basics
    API ConventionsEnvironmentsError HandlingRate LimitsSCA and PSD2SupportChangelog
Integration flows
    Accept a Card PaymentAuthorize Now, Capture LaterRefund a PaymentCharge a Returning CustomerAccept an Alternative PaymentPaysafecard via Skrill: Customer JourneySet Up WebhooksIntegrate as a Partner
Reference
    Merchant Transaction WebhooksTransaction StatusesDuplicate Payment Protection
API basics

Error Handling

Every SoftLemon API error uses the same response envelope and carries a stable machine-readable code. Build your integration on code. The message field is human-readable and its wording can change without notice.

JSON
{ "success": false, "message": "A transaction with this reference already exists", "code": "ERR_DUPLICATE", "data": { "transaction_id": 12345 } }

Validation failures also include an errors object with per-field messages:

JSON
{ "success": false, "message": "Validation errors", "code": "ERR_VALIDATION_FAILED", "data": null, "errors": { "amount": ["The transaction amount is required."] } }

HTTP status codes

StatusWhen
400The request was understood but rejected. Card declines, gateway failures, invalid tokens and blocked retries all use 400.
401The API key is missing or not recognised.
403The API key is valid but not allowed to do this. Inactive accounts and partner-only endpoints respond with 403.
404The resource does not exist or is not visible to your key.
409An active transaction already uses this reference or an Idempotency-Key collided with an earlier request. See the duplicate protection guide and conventions.
422Request validation failed. The errors object lists each offending field.
429Rate limit exceeded. See rate limits.
500Unexpected server error. Safe to retry with backoff.

Request and platform errors

CodeHTTP statusMeaningHow to handle
ERR_VALIDATION_FAILED422The request body failed validation.Fix the fields listed in errors and resend.
ERR_AUTH_FAILED401 or 403401 when the API key is missing or invalid. 403 when the account is not active or the key is not allowed to use the endpoint. Initiate returns 400 with this code when a partner key sends a merchant_id that cannot be resolved.Check the Authorization: Bearer header and the key itself. Contact support if your account was deactivated.
ERR_AUTH_REQUIRED401The endpoint requires an authenticated user session.Applies to dashboard endpoints, not API key integrations. Sign in and retry.
ERR_NO_PERMISSION403The authenticated account lacks permission for this operation.Ask your SoftLemon admin to grant the required permission.
ERR_NOT_FOUND404The resource does not exist or your key cannot see it. Partner keys only see merchants linked to them.Check the id. For partner keys confirm the merchant link with SoftLemon.
ERR_RATE_LIMITED429Your key exceeded its request limit.Wait for the number of seconds in the Retry-After header, then retry. See rate limits.
ERR_DUPLICATE409An active transaction already uses this reference.Treat as confirmation the original request went through. Look up data.transaction_id. See the duplicate protection guide.
ERR_IDEMPOTENCY_CONFLICT409The Idempotency-Key was already used with a different request.Do not resubmit as is. Generate a fresh key for each new request and reuse a key only for exact retries. See conventions.
ERR_IDEMPOTENT_REQUEST_IN_PROGRESS409The original request with this Idempotency-Key is still processing.Wait a moment and retry with the same key. The retry returns the stored response once the original finishes.
ERR_RISK_REJECTED400Risk rules blocked the transaction. It was cancelled and the reference released.The reference can be reused. Review the rejection with SoftLemon support if it looks wrong.
ERR_DO_NOT_RETRY400A previous decline marked these payment details as not retryable.Do not resubmit the same details. Ask the customer for a different payment method.
ERR_UNEXPECTED500An unexpected server error occurred.Retry with exponential backoff. Contact support if it persists.

Card and gateway declines

All decline codes are returned with HTTP 400 from the transaction endpoints. The transaction did not succeed and no funds moved.

CodeMeaningHow to handle
ERR_TXN_FAILEDThe transaction failed at the acquirer without a more specific reason.Inspect message for detail. Offer the customer another payment attempt.
ERR_GATEWAY_ERRORUnexpected gateway error upstream.Usually transient. Retry after a short wait.
ERR_ADAPTER_EXCEPTIONThe payment provider integration raised an unexpected error.Retry once. Contact support if it repeats.
ERR_ADAPTER_INVALID_AMOUNTThe amount was rejected as invalid.Check the amount is positive, within your limits and correctly formatted in major units.
ERR_INVALID_CURRENCYThe currency was rejected for this transaction.Check the currency is enabled for your account.
ERR_INVALID_ACCOUNT_NUMBERThe card number is invalid.Ask the customer to re-enter the card number.
ERR_INVALID_CARD_TOKENThe card token or vault token is not recognised.Obtain a fresh token or collect full card details again.
ERR_INVALID_TRANSACTIONThe issuer considers the transaction invalid.Ask the customer to contact their bank or use another card.
ERR_EXPIRED_CARDThe card is expired.Ask the customer for a different card.
ERR_CARD_EXPIRATION_INVALIDThe expiry date is invalid.Ask the customer to re-enter the expiry date.
ERR_CARD_NO_ACCOUNTNo account exists behind this card.Ask the customer for a different card.
ERR_CARD_DO_NOT_HONORThe issuer declined without a reason (do not honor).Ask the customer to contact their bank or use another card.
ERR_CARD_INSUFFICIENT_FUNDSInsufficient funds on the card.Ask the customer to use another card or add funds.
ERR_CARD_LIMIT_EXCEEDEDThe transaction exceeds the card limit.Suggest a smaller amount or another card.
ERR_CARD_FRAUD_SUSPECTEDDeclined for suspected fraud.Do not retry. The customer should contact their bank.
ERR_CARD_LOST_OR_STOLENThe card is reported lost or stolen.Do not retry. The customer should contact their bank.
ERR_NOT_PERMITTED_CARDHOLDERThe transaction is not permitted for this cardholder.Ask the customer to contact their bank or use another card.
ERR_CARD_SECURITY_VIOLATIONThe issuer flagged a security violation.Ask the customer to contact their bank.
ERR_CARD_ISSUER_UNAVAILABLEThe card issuer is temporarily unavailable.Retry after several seconds. Spacing retries prevents load on the card network.
ERR_CARD_SYSTEM_ERRORCard provider system error.Usually transient. Retry after a short wait.
ERR_PAYMENT_METHOD_NOT_ENABLEDThe payment method is not enabled for this merchant, or the currency is not enabled for it.Contact SoftLemon to enable the method on your account.
ERR_PAYMENT_METHOD_NOT_AVAILABLE_IN_COUNTRYThe payment method is not available for the customer's country (customer.country_code). Checked before the provider is called; nothing is created and the reference stays free.Offer a different payment method for that country. See availability.
ERR_PROVIDER_REJECTEDThe payment provider refused to open the payment for this customer under its own risk or availability rules, typically because of the customer's country or IP. message carries the provider's reason. For payment sessions the session and its transaction are marked failed and the reference is released.Send the real customer.ip_address and customer.country_code. Do not retry the same data blindly; offer the customer another payment method.
ERR_REFUND_NOT_SUPPORTEDRefunds are not supported for this payment method.Settle with the customer through another channel.
ERR_WALLET_NOT_SUPPORTEDDigital wallet payments are not supported for this payment processor.Offer a card payment instead.

The invalid amount code is returned on the wire as ERR_ADAPTER_INVALID_AMOUNT. Some older material refers to it as ERR_INVALID_AMOUNT. Always match on the wire value.

3D Secure errors

All returned with HTTP 400. See the accept a payment guide for the full 3D Secure flow.

CodeMeaningHow to handle
ERR_3DS_REQUIREDThe transaction requires 3D Secure authentication first.Run POST /api/v1/3ds/verify before creating the payment.
ERR_3DS_FAILED3D Secure authentication failed.Let the customer try again.
ERR_3DS_NOT_ENROLLEDThe card is not enrolled in 3D Secure.Ask the customer for a different card.
ERR_3DS_TIMEOUTThe customer did not complete authentication in time.Start a new verification and let the customer try again.
ERR_3DS_NOT_SUPPORTED3D Secure is not supported for this transaction.Ask the customer for a different card.
ERR_3DS_TECHNICAL_ERRORA technical error occurred during authentication.Usually transient. Start a new verification.
Last modified on September 7, 2026
EnvironmentsRate Limits
On this page
  • HTTP status codes
  • Request and platform errors
  • Card and gateway declines
  • 3D Secure errors
JSON
JSON