Understanding error codes

Understanding Error Codes


Table of Contents

  1. Overview
  2. Error Handling
  3. HTTP Status Codes
  4. Response Formats
  5. Mint Error Code Reference

Overview

This page is the complete reference for errors and status codes returned by the mPay API. It covers HTTP status codes, response formats for both successful and failed transactions, and the full catalogue of Mint-specific error codes.


Error Handling

There are two categories of errors returned by the API:

  • 200 OK — The HTTP request succeeded, but the transaction may have been declined. The status field in the response body determines the outcome.
  • Non-200 — The HTTP request itself failed due to validation, authentication, or server errors.

After every API call, check the HTTP response code first. For 200 responses, inspect the status field to distinguish APPROVED from DECLINED. All non-200 response codes indicate a request-level failure.


HTTP Status Codes

mPay uses standard HTTP response codes to indicate the success or failure of an API request. Codes in the HTTP 2xx range indicate success. Codes in the HTTP 4xx range indicate an error given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the HTTP 5xx range indicate an error with Mint's servers.

Status CodeDescription
200OK — The request was processed successfully
400Bad request — The request contains missing parameters, is in an incorrect shape, or failed another validation test
401Unauthorized — Please verify that the authentication token is provided and is valid
403Forbidden — Cases where customer does not have API enabled, service not enabled, etc.
404Not found — The requested endpoint does not exist
405Method not allowed
500Server error — Something went wrong on our end; please let us know if you are receiving this error

Response Formats

HTTP 200 — Purchase Successful

When a transaction is processed and approved, the response contains full card and purchase details:

{
    "card": {
        "brand": "visa",
        "funding": "credit",
        "country": "US",
        "number": "400000******0259",
        "holder_name": "John Doe"
    },
    "purchase": {
        "transaction_time_utc": "2020-03-26 02:08:38 AM",
        "status": "APPROVED",
        "purchase_reference": "846577135053848833",
        "amount": 110.2,
        "surcharge_amount": 0.0,
        "total_amount": 110.2,
        "currency": "AUD"
    },
    "response_code": "success",
    "response_message": "Your request has been successfully processed."
}

HTTP 200 — Purchase Declined

When the HTTP response is 200 but the transaction was not approved, the status will be DECLINED. The response_code and response_message fields describe the reason.

In most cases the card is not suitable and the best approach is to use a different card rather than retrying, which will produce the same decline.

Generic Decline:

{
    "card": {
        "brand": "visa",
        "funding": "credit",
        "country": "US",
        "number": "400000******0002",
        "holder_name": "John Doe"
    },
    "purchase": {
        "transaction_time_utc": "2020-03-26 01:50:51 AM",
        "status": "DECLINED",
        "purchase_reference": "335287298017947771",
        "amount": 110.2,
        "surcharge_amount": 0.0,
        "total_amount": 0.0,
        "currency": "AUD"
    },
    "response_code": "generic_decline",
    "response_message": "The card has been declined. Please use a different card."
}

Stolen Card:

{
    "card": {
        "brand": "visa",
        "funding": "credit",
        "country": "US",
        "number": "400000******9979",
        "holder_name": "John Doe"
    },
    "purchase": {
        "transaction_time_utc": "2020-03-26 01:57:31 AM",
        "status": "DECLINED",
        "purchase_reference": "247915481936229025",
        "amount": 110.2,
        "surcharge_amount": 0,
        "total_amount": null,
        "currency": "AUD"
    },
    "response_code": "stolen_card",
    "response_message": "A stolen card is being used. Please use a different card."
}

Insufficient Funds:

{
    "card": {
        "brand": "visa",
        "funding": "credit",
        "country": "US",
        "number": "400000******9995",
        "holder_name": "John Doe"
    },
    "purchase": {
        "transaction_time_utc": "2020-03-26 02:06:39 AM",
        "status": "DECLINED",
        "purchase_reference": "864559968685000961",
        "amount": 110.2,
        "surcharge_amount": 0,
        "total_amount": null,
        "currency": "AUD"
    },
    "response_code": "insufficient_funds",
    "response_message": "The card has insufficient funds to process this transaction. Please use a different card."
}

Non-200 Errors

All non-200 errors use the following JSON structure:

{
    "timestamp_utc": "string",
    "error_code": "string",
    "error_message": "string",
    "request_uri": "string"
}

Based on the error_code and error_message you would need to take action based on the case. If mandatory fields are missing, passing all required values would solve the problem. If the date or amount is not in the expected format, checking the format of the passed values could correct the issue.


Mint Error Code Reference

The tables below list every Mint-specific error code that can appear in API responses.

Processing Errors

Errors that occur during transaction processing. These may be transient — retrying with a new transaction token may resolve the issue.

Error CodeDescription
processing_errorProblems with processing of the transaction. Try re-running the transaction.
processing_errorAn error occurred while processing your card. Try again later.
processing_errorCould not save mint card token or mint customer.
processing_errorNo matches found for the reference. Invoice Number is already taken.
processing_errorFailed to process your request. Please try again later.
processing_errorInvoice Number is already taken.

Card Validation Errors

Errors returned when the supplied card details are invalid or incomplete.

Error CodeDescription
invalid_card_details_receivedInvalid card details received
invalid_card_details_receivedInvalid card number or pan
invalid_card_details_receivedYour card's security code is incorrect
invalid_card_details_receivedCard's expiration month is missing
invalid_card_details_receivedCard's expiration year is missing
invalid_card_details_receivedCard's security code (cvv) is missing
invalid_card_details_receivedCard holder name is missing
invalid_card_details_receivedYour card has been declined

Customer Validation Errors

Error CodeDescription
invalid_customer_id_receivedCustomer_id is not valid
invalid_customer_ipCustomer IP address is invalid

Mandatory Field Errors

Errors returned when required request parameters are missing.

Error CodeDescription
mandatory_fields_missingMandatory fields like card details are missing
mandatory_fields_missingCompany token is missing
mandatory_fields_missingTransaction token is missing
mandatory_fields_missingcustomer.store_card_permission is missing
mandatory_fields_missingCustomer IP address is missing
mandatory_fields_missingTimezone is missing
mandatory_fields_missingCard token is missing
mandatory_fields_missingCard token or card details are missing
mandatory_fields_missingCurrency is missing
mandatory_fields_missingToken is missing
mandatory_values_missingCustomer Reference is missing

Authentication Errors

Errors returned when the supplied tokens are invalid or expired.

Error CodeDescription
authentication_failedBad token
authentication_failedBad card token
authentication_failedInvalid card token

Amount and Format Errors

Error CodeDescription
invalid_amount_formatAmount format is incorrect. Valid amount should round to 2 decimal places

Access and Limit Errors

Error CodeDescription
resource_access_deniedThis service is not enabled for you
resource_access_deniedTransaction cannot be routed or company is not active
daily_limit_exceededMerchant's daily limit exceeded

Decline Errors

Errors returned when the issuing bank declines the transaction. In most cases the customer should use a different card rather than retrying.

Error CodeDescription
insufficient_fundsThe card has insufficient funds to process this transaction. Please use a different card
generic_declineThe card has been declined. Please use a different card
lost_cardA lost card is being used. Please use a different card
stolen_cardA stolen card is being used. Please use a different card
purchase_declineThe card has been declined. Please verify the token used
purchase_declineYour card has expired
purchase_declineYour card has been declined
duplicate_inputCustomer Reference is already taken

Refund Errors

Errors returned when a refund request is invalid.

Error CodeDescription
invalid_refundTransaction is not authorised for refund, refund amount exceeds authorised amount
invalid_refundRefund amount exceeds authorised amount
invalid_refundRefunds can only be made to the same card as the original purchase

Token Errors

Error CodeDescription
invalid_card_tokenThe card token does not belong to this company
invalid_company_tokenThe purchase reference does not belong to this company

Capture and Cancel Errors

Errors related to pre-authorisation capture and cancellation operations.

Error CodeDescription
invalid_captureCapture not allowed on already APPROVED purchase
invalid_captureCapture allowed only on PRE_AUTHORISED purchase
invalid_captureCapture not allowed on CANCELLED purchase
invalid_captureCapture amount exceeds pre-authorised amount
invalid_cancelCancel allowed only on PRE_AUTHORISED purchase
invalid_cancelCancel not allowed on APPROVED purchase
invalid_cancelCancel not allowed on already CANCELLED purchase