Responses

This page describes the structure of responses returned by the CURO Payments RESTful API, including the default response format, error responses, and a list of error codes.

📘

Note

The HTTP response code of a RESTful API request will contain the processing status of your request. Make sure you check for the correct value (200) or error (4XX).

Default Response

Every response contains the root elements described below.

ElementType LengthDescription
successboolean 1true or false indicating the result of the call
code (optional)string ≤ 48Error code. See List of Error Codes
message (optional)string ≤ 255Textual message indicating what went wrong in case the call was unsuccessful

Example — Response for a correct JSON payment request

HTTP/1.1 200 OK
Content-Type: application/json

{
  "success": true,
  "payment": {
    "action": "redirect",
    "external": true,
    "url": "redirect_url",
    "testmode": 0,
    "transaction_id": "T26123456789"
  }
}

Default Error Responses

When there is an error, the header information contains an appropriate HTTP 400 ERROR status code (4XX). The body of the response also contains information about the error; details depend on the operation and payment module.

The table below shows the basic structure of response elements common to all REST error responses.

ElementType LengthDescription
  [container]containerGeneral container for this resource (eg. payment, recurring, refund etc.).
  [error]containerResponse container for all error elements.
    codestring ≤ 48The error code is a string that uniquely identifies an error condition. It is meant to be read and understood by programs that detect and handle errors by type. For more information, see List of Error Codes.
    messagestring ≤ 255The error message contains a generic description of the error condition in English. It is intended for a human audience. Simple programs display the message directly to the end user if they encounter an error condition they don't know how or don't care to handle. Sophisticated programs with more exhaustive error handling and proper internationalization are more likely to ignore the error message.
  successboolean 1TRUE or FALSE indicating the result of the call
  warning (optional)string ≤ 255English message depending on context, mostly about optional/missing data.

Example — Response for an error JSON payment request

HTTP/1.1 400 ERROR
Content-Type: application/json

{
  "success": false,
  "error": {
    "code": "Payment.Type.Invalid",
    "message": "invalid payment type"
  }
}

List of Error Codes


General transaction errors

Error CodeDescriptionHTTP Status Code
Access.DeniedAccess Denied for a certain resource.403
Transaction.Generic.ErrorGeneric transaction error.400
Transaction.Database.ErrorDatabase error while processing the transaction.400
Transaction.Prepare.FailureInformation was invalid to prepare the transaction.400
Transaction.Register.FailureUnable to register the transaction at the acquirer.400
Transaction.Process.FailureFailure while processing the transaction.400
Transaction.Cancel.FailureThe transaction could not be cancelled.400
Transaction.AbuseAbuse module was triggered for this transaction.400
Transaction.InvalidInvalid information was provided.400
Transaction.Invalid.StateThe transaction was in an unexpected state.400
Transaction.MissingRequired arguments are missing.400
Transaction.Internal.ErrorInternal error while processing.400
Transaction.3rdParty.ErrorThird party error.400
Transaction.Acquirer.ErrorAcquirer error while processing.400
Transaction.NotSupportedThe requested action was not supported.400
Transaction.Cart.InvalidGiven cart was invalid.400

Recurring errors

Error CodeDescriptionHTTP Status Code
Transaction.Error.NoMasterMaster transaction was not found.400
Transaction.Error.NoRecurRecurring is not allowed or possible.400

Refund errors

Error CodeDescriptionHTTP Status Code
Transaction.Error.RefundTooHighRefund was higher that the available amount.400
Transaction.Error.Refund.NegativeRefund amount can not be negative.400
Transaction.Error.Refund.UnavailableRefund is not supported for this transaction.400
Transaction.Error.Refund.CompleteTransaction was already refunded completely.400

Subscription errors


Error CodeDescriptionHTTP Status Code
Transaction.Error.Subscription.UnavailableSubscription option is not available.400
Transaction.Error.Subscription.Not.ActiveSubscription is not active.400
Transaction.Subscription.Cancel.FailureCancel of subscription failed.400

Did this page help you?