# Code and Formats
source: https://developer.mastercard.com/mastercard-send-account-info/documentation/code-and-formats/index.md

## Eligibility {#eligibility}

The API response provides both sending and receiving eligibility for the card account --- there will be `eligible` values in separate response objects, `sending_eligibility` and `receiving_eligibility`, which may differ:

| `sending_eligibility.eligible` | `receiving_eligibility.eligible` |                          Meaning                           |
|--------------------------------|----------------------------------|------------------------------------------------------------|
| true                           | true                             | The account can send and receive funds transfers.          |
| true                           | false                            | The account can send funds transfers but not receive them. |
| false                          | true                             | The account can receive funds transfers but not send them. |
| false                          | false                            | The account cannot send or receive funds transfers.        |

For example:
* JSON
* XML

```JSON
  ...
  "sending_eligibility": {
    "eligible": true
  },
  "receiving_eligibility": {
    "eligible": true
  }
  ...
```

```XML
   ...
   <sending_eligibility>
      <eligible>false</eligible>
   </sending_eligibility>
   <receiving_eligibility>
      <eligible>false</eligible>
   </receiving_eligibility>
   ...
```

Use the value that is relevant to the type of transfer:

* For Funding Transactions from the account, use the `sending_eligibility.eligible` value to determine whether it can fund the transfer.

* For Payment Transactions to the account, use the `receiving_eligibility.eligible` value to determine whether it can receive the payment transfer/disbursement.

The service takes into consideration information received for the account from the supported network along with configurations established for your organization. For example, if you are configured to only support debit cards and you submit a request with a credit card BIN, the service will return a response with the receiving eligibility of 'false'.

## Response Codes for Ineligible Accounts {#response-codes-for-ineligible-accounts}

When a checked account is not eligible to send and/or receive funds transfers, the API response (200 status code) will include `reason_code` and `reason_description` values, for example:
* JSON
* XML

```JSON
  ...
  "receiving_eligibility": {
    "eligible": false,
    "reason_code": "CURRENCY_NOT_SUPPORTED",
    "reason_description": "Currency is not supported for the account"
  }
  ...
```

```XML
   ...
   <receiving_eligibility>
      <eligible>false</eligible>
      <reason_code>CURRENCY_NOT_SUPPORTED</reason_code>
      <reason_description>Currency is not supported for the account</reason_description>
   </receiving_eligibility>
   ...
```

The following table shows the possible values that can be returned. Other values might be introduced periodically.

|       Reason Code       |                                                                                                                                        Reason Description                                                                                                                                        |
|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| PARTNER_DAILY_LIMIT     | Partner has exceeded the daily limit configured in the system                                                                                                                                                                                                                                    |
| MAX_TRANSACTION_LIMIT   | Per transaction maximum amount limit reached                                                                                                                                                                                                                                                     |
| MIN_TRANSACTION_LIMIT   | Amount is less than the minimum configured for the partner                                                                                                                                                                                                                                       |
| CONS_MONTHLY_TRAN_LIMIT | Consumers monthly transaction limit reached                                                                                                                                                                                                                                                      |
| MAX_TRAN_TYPE_LIMIT     | Per transaction maximum amount limit for the transaction type                                                                                                                                                                                                                                    |
| MIN_TRAN_TYPE_LIMIT     | Amount is less than the minimum allowed for the transaction type                                                                                                                                                                                                                                 |
| ACCOUNT_TYPE            | Account Type not supported for the partner                                                                                                                                                                                                                                                       |
| ACCOUNT_NOT_ELIGIBLE    | Account not eligible                                                                                                                                                                                                                                                                             |
| NETWORK_NOT_ELIGIBLE    | Partner not on boarded for the network to reach account This indicates your partner configuration does not include the network (Mastercard or Visa) or account type, so you cannot check this account. For example, you may be configured for debit cards but are trying to check a credit card. |
| CURRENCY_NOT_SUPPORTED  | Currency is not supported for the account                                                                                                                                                                                                                                                        |
| COUNTRY_NOT_SUPPORTED   | Country is not supported for the account                                                                                                                                                                                                                                                         |

## Error Codes {#error-codes}

If your API request is unsuccessful, you should receive a service error response or a gateway error response.

### Service Error Codes {#service-error-codes}

Service error response messages (4xx status code) have the following structure (example values shown). The `Error` array may contain multiple error items.
* JSON
* XML

```JSON
{
  "Errors": {
    "Error": [
      {
        "RequestId": "rqst_73HB-5RO5-0OGS-53SG",
        "Source": "account_uri",
        "ReasonCode": "INVALID_INPUT_VALUE",
        "Description": "Invalid Account URI",
        "Recoverable": "false",
        "Details": {
          "Detail": [
            {
              "Name": "ErrorDetailCode",
              "Value": "082000"
            }
          ]
        }
      }
    ]
  }
}
```

```XML
<Errors>
   <Error>
      <RequestId>rqst_73HB-5RO5-0OGS-53SG</RequestId>
      <Source>account_uri</Source>
      <ReasonCode>INVALID_INPUT_VALUE</ReasonCode>
      <Description>Invalid Account URI</Description>
      <Recoverable>false</Recoverable>
      <Details>
         <Detail>
            <Name>ErrorDetailCode</Name>
            <Value>082000</Value>
         </Detail>
      </Details>
   </Error>
</Errors>
```

|    Field    |                                                                                                                                                                                                                                                       Description                                                                                                                                                                                                                                                       |
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| RequestId   | A service-specific request identifier. Example: rqst_73HB-5RO5-0OGS-53SG                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Source      | The unique identifier that attempts to define the field in error, when available. If an error is not associated with a specific field, 'System' is returned. If an error is produced because of required data, the field missing data is presented. Examples: amount, account_uri                                                                                                                                                                                                                                       |
| ReasonCode  | The general cause of the error; see the table below. Examples: INVALID_INPUT_FORMAT, INVALID_INPUT_LENGTH, INVALID_INPUT_VALUE                                                                                                                                                                                                                                                                                                                                                                                          |
| Description | A textual description of the error; see the table below. This is optional and will only be displayed if more information is available than is stored in the data identifier and reason code. Examples: Invalid Account URI, Destination Currency ISO code must be within 3 characters length                                                                                                                                                                                                                            |
| Recoverable | A true/false indicator stating whether your API request might be successful if you re-send the API request with the same parameters and data. For example, an unsuccessful API request caused by a server error (5xx response code) might be successful when re-sent. Valid values: true, false                                                                                                                                                                                                                         |
| Details     | Each Open API service has an option to add extra service-specific error information in the Details section. The details are optional and might not be present for every error message. If present, the details are returned in the form of individual detail items, each containing a Name and Value pair: * The Name element will explain what data you will find in the Value element. Example: ErrorDetailCode * The Value element will hold the actual data. Valid values shown in the table below. Example: 082000 |

The following table shows the `ErrorDetailCode`, `ReasonCode` and `Description` values that can be returned. Other values might also exist or be introduced periodically.

| Error Detail Code |      Reason Code       |        Reason Description        |                                                                                                                                          How to Resolve                                                                                                                                           |
|-------------------|------------------------|----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 050007            | AUTHORIZATION_FAILED   | Unauthorized access              | Check you are using the correct key, Consumer Key (which identifies the key), and Partner Reference ID (for the `partnerId` part of the endpoint URL) for the API environment. If you recently created your key, you must ask Mastercard to set up the environment for your key and Consumer Key. |
| 062000            | INVALID_INPUT_FORMAT   | Value contains invalid character | Correct the value in the field shown by `Source`. For the `account_uri` field, it could be that part of the URI is the wrong length or missing; see [Account URIs](https://developer.mastercard.com/mastercard-send-account-info/documentation/code-and-formats/index.md#account-uris).           |
| 072000            | INVALID_INPUT_LENGTH   | Invalid length                   | Correct the length of the value in the field shown by `Source`.                                                                                                                                                                                                                                   |
| 082000            | INVALID_INPUT_VALUE    | Invalid value                    | Correct the value in the field shown by `Source`. For the `account_uri` field, it could be that the card account is invalid or part of the URI is incorrect, for example wrong CVC or expiration date (e.g. not a future date).                                                                   |
| 092000            | MISSING_REQUIRED_INPUT | Value is required                | Provide the field shown by `Source`.                                                                                                                                                                                                                                                              |
| 110505            | RESOURCE_ERROR         | Invalid currency                 | Provide a valid ISO 4217 alpha-3 currency code; see [ISO Country and Currency Codes](https://developer.mastercard.com/mastercard-send-account-info/documentation/code-and-formats/index.md#iso-country-and-currency-codes).                                                                       |
| 110510            | RESOURCE_ERROR         | Invalid Request                  | Check that your API request is correctly formatted and that the headers match the format (JSON or XML).                                                                                                                                                                                           |
| 110511            | RESOURCE_ERROR         | Operation not allowed            | Check that you are making the correct type of API request: PUT.                                                                                                                                                                                                                                   |
| 110515            | RESOURCE_ERROR         | Multiple resources found         | If this error occurs for a field where you have used a Consumer Mapping ID, it likely means that Mastercard Send has found multiple Consumer Mapping account records relating to that ID. See the Consumer Mapping service documentation for guidance on setting defaults.                        |

### Gateway Error Codes {#gateway-error-codes}

Error codes can also be returned by Mastercard's gateway, which is used to verify your request's signature and route the request to the correct location.

Gateway error response messages (4xx/5xx status code) have the following structure:
* JSON
* XML

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "Gateway",
        "ReasonCode": "<Unique code>",
        "Description": "<Description of the error>",
        "Recoverable": true/false,
        "Details": null
      }
    ]
  }
}
```

```XML
<Errors>
   <Error>
      <Source>Gateway</Source>
      <ReasonCode>Unique code</ReasonCode>
      <Description>Description of the error</Description>
      <Recoverable>true/false</Recoverable>
      <Details>null</Details>
   </Error>
</Errors>
```

For a list of the errors returned by our gateway, as well as resolutions to each, see [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/errors-troubleshooting/gateway-error-codes/).

## Account URIs {#account-uris}

This table provides guidance for specifying an Account URI.

|    Scheme    |                                                                                                                                                                                                                                                                                                                                                             Scheme Specific Data                                                                                                                                                                                                                                                                                                                                                              |
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| pan          | Specifies a card account number (PAN) or tokenized PAN. Data format: {PAN/tokenized PAN}\[;exp=YYYY-MM\]\[;cvc=NNNN\] Where: * PAN = numeric, length 11-19 * Tokenized PAN = numeric, length 16 * The square brackets indicate optional elements: expiration date \[;exp=YYYY-MM\] and Card Verification Code (CVC) \[;cvc=NNNN\] * For PANs, expiration date is optional but including it can improve approval rates * For tokenized PANs, expiration date is required <br /> PAN examples: * pan:5102589999999913 * pan:5102589999999913;exp=2077-08 * pan:5102589999999913;cvc=123 * pan:5102589999999913;exp=2077-08;cvc=123 <br /> Tokenized PAN examples: * pan:5432231452673894;exp=2077-08 * pan:5432231452673894;exp=2077-08;cvc=123 |
| acct-token   | **For use with the Lightbox service.** Specifies a Lightbox token, which is a temporary system identifier generated by the Lightbox secure card capture service and returned as part of the capture response. This token has a lifespan of 30 minutes and should not be used as a permanent account identifier. Data format: 1-NN character alphanumeric Example: acct-token:suZz18lhAFvx9LQa6U2VMxs0BJLAD_TXVzYvaqTsjcG_AImuzmvNXQ                                                                                                                                                                                                                                                                                                           |
| sds-acct-id  | **For use with the Consumer Mapping service.** Specifies the system-generated Account ID of an Account record in the Consumer Mapping service. The ID was returned by the service when the Account was registered/created. The ID can be used as an alias to initiate a payment from/to that account. Data format: alphanumeric special \[a-zA-Z0-9_-\], maximum length 32 Example: sds-acct-id:acct_MSIL0iiUEU1V_ISouEU4eVNi_4e                                                                                                                                                                                                                                                                                                              |
| sds-acct-ref | **For use with the Consumer Mapping service.** Specifies the partner-provided Account Reference of an Account record in the Consumer Mapping service. The reference was provided to the service when the Account was registered/created. The reference can be used as an alias to initiate a payment from/to that account. Data format: alphanumeric special \[a-zA-Z0-9\*,-._\~\], length 6-40 Example: sds-acct-ref:acc_334631673134562097381451433476935676                                                                                                                                                                                                                                                                                |
| acct-ref     | **For use with the Account Mapping service or legacy v1 Consumer Mapping service.** Specifies the partner-provided account reference identifier of an Account record in either the Account Mapping service or the Consumer Mapping service. The ID was provided to the service when the Account was registered/created. Data format: 1-NN character alphanumeric Example: acct-ref:user1234acct1                                                                                                                                                                                                                                                                                                                                              |
| id           | **For use with the legacy v1 Consumer Mapping service.** Specifies the system-generated Account ID of an Account record in the Consumer Mapping service. The ID was returned by the service when the Account was registered/created. Data format: NN character alphanumeric Example: id:o56b7x2jlq6u1avloma1                                                                                                                                                                                                                                                                                                                                                                                                                                  |

## ISO Country and Currency Codes {#iso-country-and-currency-codes}

Countries are specified using a 3-character [ISO 3166-1 alpha-3 country code](https://www.iso.org/iso-3166-country-codes.html). For example, the United States of America is `USA`.  

For a list of codes, refer to [Country Codes](https://developer.mastercard.com/mastercard-send/documentation/implementation/country-codes/).

Currencies are specified using a 3-character [ISO 4217 alpha-3 currency code](https://www.iso.org/iso-4217-currency-codes.html). For example, US Dollars is `USD`.  

For a list of codes, refer to [Currency Codes](https://developer.mastercard.com/mastercard-send/documentation/implementation/currency-codes/).

For amounts, the decimal point is implied based on the relevant currency exponent. For example, a US Dollar $10 amount is a value of 1000.
