# consult

> Use the consult API to check whether the payment method can complete the payment before calling the pay API.

`POST /v1/payments/consult`

Use the consult API to check whether the payment method can complete the payment before calling the pay API.

# Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see： 

-   [Request header](https://docs.antom.com/ac/ams/api_fund.md#ML5ur)
-   [Response header](https://docs.antom.com/ac/ams/api_fund.md#WWH90)

> **Note**: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:
>
> -   If the data type of a field is Integer and its value is `20`, set it as "`20`". 
> -   If the data type of a field is Boolean and its value is `true`, set it as "`true`".

## Request parameters

#### productCode (String, REQUIRED)

Represents the payment product that is being used. The payment product that can be used is stipulated in the contract. Valid values are:

-   `AGREEMENT_PAYMENT`: indicates that this API serves the Tokenized Payment scenario.
-   `CASHIER_PAYMENT`: indicates that this API serves the One-time Payments scenario.

More information:

- Maximum length: 3 characters

#### paymentAmount (Amount, REQUIRED)

The payment amount that the merchant requests to receive in the order currency.

##### currency (String, REQUIRED)

The 3-letter currency code that follows the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard.

More information:

- Maximum length: 3 characters

##### value (Integer)

The amount to charge as a positive integer in the smallest currency unit. For example, USD 1.00 should be charged as 100 cents, and JPY 100 should be charged as 100 for a 0-decimal currency.

> Note: For more information about the smallest currency unit, see [Currency codes](https://docs.antom.com/ac/ref/cc.md) for details.

More information:

- Value range: 0 - unlimited

#### settlementStrategy (SettlementStrategy)

The settlement strategy.

##### settlementCurrency (String)

The ISO currency code of the currency that the merchant wants to settle against. This field is required if the merchant signed up for multiple settlement currencies. Otherwise, the error code,`SETTLE_CONTRACT_NOT_MATCH`, will be returned.

More information:

- Maximum length: 3 characters

#### env (Env, REQUIRED)

Information about the environment where the order is placed, such as the device information.

##### terminalType (String, REQUIRED)

Terminal type used by the merchant. Valid values are:

-   `WEB`: The terminal type of the merchant side is a website.
-   `WAP`: The terminal type of the merchant side is a mobile website (H5 page) on a phone.
-   `APP`: The terminal type of the merchant side is an app on a phone.
-   `MINI_APP`: The terminal type of the merchant side is a mini program on a phone.

Note: This field is required when _productCodeType_ is `CASHIER_PAYMENT`.

##### osType (String)

OS type. Valid values are:

-   IOS: The OS type is iOS.
-   ANDROID: The OS type is Android.

Note: This field is required for all _terminalType_ values except `WEB`.

##### userAgent (String)

The user agent.

More information:

- Maximum length: 1024 characters

##### deviceTokenId (String)

Token identifier of the device.

More information:

- Maximum length: 64 characters

##### clientIp (String)

IP address of the client device.

More information:

- Maximum length: 32 characters

##### cookieId (String)

The cookie ID of the buyer.

More information:

- Maximum length: 64 characters

#### paymentEvaluation (PaymentEvaluation)

Information about the user's payment method whose payment capability needs to be evaluated.

> Specify this parameter when one of the following conditions is met:
>
> -   When the value of _productCode_ is `AGREEMENT_PAYMENT` and you want to evaluate the payment capability of the user's payment method before deducting money.
> -   When the value of _productCode_ is `CASHIER_PAYMENT`, specify this parameter to evaluate whether the specified payment method is capable for payment.

##### paymentMethods (Array <Payment Method>, REQUIRED)

The list of payment methods for users subject to payment capacity assessment is limited to a single entry.

###### paymentMethodType (String, REQUIRED)

The payment method. `GCASH`, `TNG`, `DANA`, `ALIPAY_HK`, and `ZALOPAY` support balance inquiry. `PAGALEVE` supports eligibility check. Only one payment method can be evaluated at a time.

More information:

- Maximum length: 64 characters

###### paymentMethodId (String)

The unique ID that is used to identify a payment method. The value of this parameter is that of _accessToken_ obtained by calling the [**applyToken**](https://docs.antom.com/ac/ams/accesstokenapp.md) API.

> **Note**: This parameter is required for Tokenized Payment but optional for One-time Payments.

More information:

- Maximum length: 128 characters

###### paymentMethodMetaData (PaymentMethodMetaData)

Additional information required for payment evaluation. Only for `PAGALEVE`, at least one of the following sub-parameters _cpf_, _phone_, or _email_ should be provided.

###### cpf (String)

Cadastro de Pessoas Físicas (CPF). The registration number of the Brazilian individual taxpayer.

More information:

- Maximum length: 11 characters

###### phone (String)

The user's phone number.

More information:

- Maximum length: 15 characters

###### email (String)

The user's email address.

More information:

- Maximum length: 100 characters

## Response parameters

#### result (Result, REQUIRED)

The request result that contains information such as status and error codes.

Note: This field doesn't indicate the payment result. This field only indicates whether the consult interface is called successfully.

##### resultCode (String, REQUIRED)

The result code.

More information:

- Maximum length: 64 characters

##### resultStatus (String, REQUIRED)

The result status. Valid values are:  

-   `S`: indicates that the result status is successful. 
-   `F`: indicates that the result status is failed. 
-   `U`: indicates that the result status is unknown.

##### resultMessage (String)

The result message.

More information:

- Maximum length: 256 characters

#### paymentOptions (Array<PaymentOption>)

The payment option list.

##### paymentMethodType (String, REQUIRED)

The payment method type. Valid values are:

-   `TRUEMONEY`: indicates the TrueMoney wallet.
-   `ALIPAY_HK`: indicates the AlipayHK wallet. 
-   `TNG`: indicates the Touch 'n Go eWallet.
-   `ALIPAY_CN`: indicates the AlipayCN wallet.
-   `GCASH`: indicates the GCash wallet.
-   `DANA`: indicates the DANA wallet.
-   `BKASH`: indicates the bKash wallet.
-   `EASYPAISA`: indicates the EasyPaisa wallet.
-   `KAKAOPAY`: indicates the KakaoPay wallet.
-   BPI: indicates the Banking app of Bank of the Philippine Islands (BPI). 
-   RABBIT\_LINE\_PAY: indicates the Rabbit LINE Pay wallet.
-   `BOOST`: indicates the Boost eWallet.  
-   `CONNECT_WALLET`: indicates the Alipay+ cashier page, where users can select the preferred payment method to pay.
-   `IDEAL`: indicates the iDEAL online banking.
-   `GIROPAY`: indicates the Giropay online banking.
-   `SOFORT`: indicates the Sofort online banking.
-   `PAYU`: indicates the PayU online banking.
-   `P24`: indicates the Przelewy24 online banking.
-   `BLIK`: indicates the BLIK online banking.
-   `EPS`: indicates the EPS (Electronic Payment Services) online banking.
-   `BANCONTACT`: indicates the Bancontact online banking.
-   PIX: indicates the Pix bank transfer. 
-   `AKULAKU_PAYLATER`: indicates the Akulaku PayLater online banking.
-   `BANKAPP_BANGKOKBANK`: indicates the Bualuang mBanking bank App.
-   `BANKTRANSFER_BANGKOKBANK`: indicates the Bangkok Bank bank transfer.
-   `BANKTRANSFER_SIAMCOMMERICALBANK`: indicates the Siam Commerical bank transfer.
-   `BANKAPP_SIAMCOMMERICALBANK`: indicates the SCB Easy App.   
-   `BANKTRANSFER_BANKOFAYUDHYA`: indicates the Bank of Ayudhya bank transfer.
-   `BANKAPP_BANKOFAYUDHYA`: indicates the Krungsri Mobile App (KMA).
-   `BANKTRANSFER_KRUNGTHAIBANK`: indicates the Krung Thai Bank bank transfer.
-   `BANKAPP_KRUNGTHAIBANK`: indicates the Krungthai NEXT bank App.
-   `ONLINEBANKING_KRUNGTHAIBANK`: indicates the Krung Thai Bank online banking.
-   `ONLINEBANKING_SIAMCOMMERICALBANK`: indicates the Siam Commercial Bank online banking. 
-   `ONLINEBANKING_BANGKOKBANK`: indicates the Bangkok Bank online banking.
-   `ONLINEBANKING_BANKOFAYUDHYA`: indicates the Bank of Ayudhya online banking.
-   `ONLINEBANKING_KASIKORNBANK`: indicates the Kasikorn Bank online banking.
-   `BANKTRANSFER_KASIKORNBANK`: indicates the Kasikorn Bank bank transfer.
-   `BANKTRANSFER_GOVERNMENTSAVINGSBANK`: indicates the Government Savings Bank bank transfer. 
-   `CARD`: indicates credit and debit cards.  
-   `PAYPAY`: indicates the PayPay wallet.
-   `PROMPTPAY`: indicates the PromptPay bank transfer.
-   `PAGALEVE`: indicates the Pagaleve Checkout Payment.

More information:

- Maximum length: 64 characters

##### paymentMethodCategory (String)

The category of the payment method. Valid values are:

-   `ALIPAY_PLUS`: indicates that the payment method category is an Alipay+ payment method.  
-   `WALLET`: indicates that the payment method category is a wallet. 
-   `MOBILE_BANKING_APP`: indicates that the payment method category is a mobile banking app. 
-   `BANK_TRANSFER`: indicates that the payment method category is bank transfer. 
-   `ONLINE_BANKING`: indicates that the payment method category is online banking.  
-   `CARD`: indicates that the payment method category is a card.

More information:

- Maximum length: 32 characters

##### paymentMethodRegion (Array<String>)

The supported regions for the payment method, listed as 2-letter country/region codes. For more information, see the [ISO 3166 Country Codes](https://www.iso.org/obp/ui/#search) standard.  

When _paymentMethodType_ is `CARD`, the parameter is empty.

More information:

- Maximum length: 2 characters

##### paymentOptionDetail (PaymentOptionDetail)

Details about the payment option. 

If the value of _paymentMethod__Type_ is `CARD`, the information relating to the cards is returned.  

If the value of _paymentMethodType_ is `IDEAL`, the information relating to the iDEAL payment method is returned.

###### supportCardBrands (Array<SupportCardBrand>, REQUIRED)

The list of supported card brands.  

If the value of _paymentMethod__Type_ is CARD, this parameter is returned.

###### cardBrand (String, REQUIRED)

The name of the card brand. Valid values are:

`VISA`: indicates Visa. 

`MASTERCARD`: indicates Mastercard.  

`AMEX`: indicates American Express (Amex). 

`HIPERCARD`: indicates Hipercard. 

`ELO`: indicates Elo.

###### logo (Logo, REQUIRED)

The logo of the card brand.

###### logoName (String, REQUIRED)

The logo name of the card brand. Valid values are: `VISA`, `MASTERCARD`, `AMEX`, `HIPERCARD`, and `ELO`.

More information:

- Maximum length: 12 characters

###### logoUrl (String)

The logo URL of the card brand.

More information:

- Maximum length: 2048 characters

###### supportBanks (Array <SupportBanks>, REQUIRED)

The list of supported banks. 

If the value of _paymentMethodType_ is IDEAL, this parameter is returned.

###### bankIdentifierCode (String)

The unique code of the bank. Valid values are:

-   `RABONL2U`: indicates Rabobank.
-   `ABNANL2A`: indicates ABN AMRO.
-   `FVLBNL22`: indicates Van Lanschot Baniers.
-   `TRIONL2U`: indicates Triodos Bank.
-   `INGBNL2A`: indicates ING Bank.
-   `SNSBNL2A`: indicates SNS Bank.
-   `ASNBNL21`: indicates ASN.
-   `RBRBNL21`: indicates RegioBank.
-   `KNABNL2H`: indicates Knab.
-   `BUNQNL2A`: indicates Bunq.
-   `REVOLT21`: indicates Revolut.

###### bankShortName (String)

The short name of the bank. Valid values are: `Rabobank`, `ABN AMRO`, `Van Lanschot Baniers`, `Triodos Bank`, `ING Bank`, `SNS Bank`, `ASN`, `RegioBank`, `Knab`, `Bunq`, and `Revolut`.

##### enabled (Boolean, REQUIRED)

Indicates whether the payment method is available.

Valid values are:

-   `true`: indicates that the payment method is available.
-   `false`: indicates that the payment method is unavailable.

##### disableReason (String)

The reason why the payment method is unavailable. Valid values are:

-   `PAYMENT_ACCOUNT_NOT_AVAILABLE`
-   `EXCEED_CHANNEL_LIMIT_RULE`
-   `SERVICE_DEGRADE`
-   `CHANNEL_NOT_SUPPORT_CURRENCY`
-   `CHANNEL_DISABLE`
-   `CHANNEL_NOT_IN_SERVICE_TIME`
-   `QUERY_IPP_INFO_FAILED`
-   `LIMIT_CENTER_ACCESS_FAIL` 
-   `INVALID_ACCESS_TOKEN`

This parameter is returned when the value of _paymentOptions.enabled_ is `false`.

More information:

- Maximum length: 64 characters

##### logo (Logo)

The logo information about the payment method.

###### logoName (String, REQUIRED)

The logo name of the payment method.

More information:

- Maximum length: 32 characters

###### logoUrl (URL)

The logo URL of the payment method.

More information:

- Maximum length: 2048 characters

##### promoNames (Array <String>)

The list of the promotion names. In JSON format. The keys are returned as a language and a country code, connected by an underscore, such as `zh_CN`, while the value is the promotion name, such as `RM1 Voucher`.

More information:

- Maximum length: 512 characters

##### installments (Array<Installments>)

Information about installments. 

This parameter is returned when the payment method supports installments.

###### interestRate (String)

The interest rate is the percentage the customer costs for the installments.

More information:

- Maximum length: 8 characters

###### minInstallmentAmount (Amount, REQUIRED)

The minimum amount that can be paid by installments.

###### currency (String, REQUIRED)

The 3-letter currency code that follows the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard.

More information:

- Maximum length: 3 characters

###### value (integer)

The amount to charge as a positive integer in the smallest currency unit. (That is, 100 cents to charge $1.00, or 100 to charge JPY 100, a 0-decimal currency).

For details about the smallest currency unit, see [Smallest unit of the currency](https://docs.antom.com/ac/ref/cc.md#ONkIe) .

###### maxInstallmentAmount (Amount, REQUIRED)

The maximum amount that can be paid by installments.

###### currency (String, REQUIRED)

The 3-letter currency code that follows the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard.

More information:

- Maximum length: 3 characters

###### value (integer)

The amount to charge as a positive integer in the smallest currency unit. (That is, 100 cents to charge $1.00, or 100 to charge JPY 100, a 0-decimal currency).

For details about the smallest currency unit, see [Smallest unit of the currency](https://docs.antom.com/ac/ref/cc.md#ONkIe) .

###### installmentNum (integer, REQUIRED)

The number of installment payments. The valid value is from `2` to `12`.

###### interval (String, REQUIRED)

The interval of each installment payment. The valid value is `MONTH`.

More information:

- Maximum length: 16 characters

###### enabled (Boolean, REQUIRED)

Indicates whether the installment payment is available.

##### paymentEvaluationResult (PaymentEvaluationResult)

The payment capability evaluation result of the user's payment method. 

This parameter is returned when you specify the _paymentEvaluation_ parameter in the request of this API.

###### status (Boolean, REQUIRED)

Indicates whether the payment capability evaluation of the user's payment method passes. Valid values are:

-   `true`: indicates that the payment capability evaluation passes. The payment method can complete the payment.
-   `false`: indicates that the payment capability evaluation does not pass. See _unAvailableInfo_ for detailed reasons.

###### unAvailableInfo (String)

The reason why the payment evaluation of the user's payment method did not pass. Valid values are:

-   `PAYMENT_EVALUATION_FAILED`: indicates that the payment capability evaluation failed due to network issues or other reasons.
-   `USER_BALANCE_NOT_ENOUGH`: indicates that the payment cannot be completed because the balance in the user's payment method is insufficient.
-   `INVALID_ACCESS_TOKEN`: indicates that the access token is expired, revoked, or does not exist.
-   `USER_STATUS_ABNORMAL`: indicates that the user status is abnormal on the payment method side.
-   `PAYMENT_AMOUNT_EXCEED_LIMIT`: indicates that the payment amount is greater than the maximum amount allowed by the contract or payment method.
-   `PAYMENT_EVALUATION_REJECTED`: indicates that the institution assessment was not passed, but there is no specific reason given.

This parameter is returned when the value of _paymentOptions.paymentEvaluationResult.status_ is `false`.

## Result/Error codes

| Code | Value | Message | Further action |
| --- | --- | --- | --- |
| SUCCESS | S | Success | The consultation is successful. No further action is needed. |
| CURRENCY_NOT_SUPPORT | F | The currency is not supported. | Change the currency used in the request. If the issue persists, contact Antom Technical Support for detailed reasons. |
| MERCHANT_NOT_REGISTERED | F | The merchant is not registered. | Please register the merchant by using the registration interface. Contact Antom Technical Support if failed to call the registration interface. |
| NO_PAY_OPTIONS | F | No payment options are available. | Contact Antom Technical Support. |
| PARAM_ILLEGAL | F | The required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong. | Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. |
| PROCESS_FAIL | F | A general business failure occurred. | Do not retry. Human intervention is usually needed. It is recommended that you contact Antom Technical Support to troubleshoot the issue. |
| SETTLE_CONTRACT_NOT_MATCH | F | No matched settlement contract can be found. | Check the following for a solution: Specify one settlement currency from the multiple currencies that the merchant signed up for. Check if the settlement currency is specified in the settlement contracts. The merchant didn't sign a settlement contract. Contact Antom Technical Support. |
| UNKNOWN_EXCEPTION | U | An API call has failed, which is caused by unknown reasons. | Call the interface again to resolve the issue. If not resolved, contact Antom Technical Support. |

## Request

```json
{
  "settlementStrategy": {
    "settlementCurrency": "BRL"
  },
  "productCode": "CASHIER_PAYMENT",
  "env": {
    "osType": "IOS",
    "terminalType": "WAP"
  },
  "paymentAmount": {
    "currency": "BRL",
    "value": "5000"
  },
  "gofConsult": false,
  "golConsult": true,
  "paymentEvaluation": {
    "paymentMethods": [
      {
        "paymentMethodType": "PAGALEVE",
        "paymentMethodMetadata": {
          "cpf": "2424234234",
          "phone": "5511943107444",
          "email": "vinicius@pagaleve.com.br"
        }
      }
    ]
  }
}
```

## Response

```json
{
  "paymentMethodInfos": [],
  "paymentOptions": [
    {
      "enabled": true,
      "logo": {
        "logoName": "GCash",
        "logoUrl": "https://gw.alipayobjects.com/mdn/rms_4eeb39/afts/img/A*mLcjSY9aA9AAAAAAAAAAAAAAARQnAQ"
      },
      "paymentEvaluationResult": {
        "status": true
      },
      "paymentMethodRegion": [
        "PH"
      ],
      "paymentMethodType": "GCASH"
    },
    {
      "enabled": true,
      "logo": {
        "logoName": "TrueMoney Wallet",
        "logoUrl": "https://gw.alipayobjects.com/mdn/rms_4eeb39/afts/img/A*3_ZITr7XtDYAAAAAAAAAAAAAARQnAQ"
      },
      "paymentMethodRegion": [
        "TH"
      ],
      "paymentMethodType": "TRUEMONEY"
    },
    {
      "enabled": true,
      "logo": {
        "logoName": "KakaoPay",
        "logoUrl": "https://gw.alipayobjects.com/mdn/rms_4eeb39/afts/img/A*rivpTL5MlrsAAAAAAAAAAAAAARQnAQ"
      },
      "paymentMethodRegion": [
        "KR"
      ],
      "paymentMethodType": "KAKAOPAY"
    },
    {
      "enabled": true,
      "logo": {
        "logoName": "AlipayHK",
        "logoUrl": "https://gw.alipay.com/icon/medium/default/ALIPAY_HK.svg"
      },
      "paymentMethodRegion": [
        "HK"
      ],
      "paymentMethodType": "ALIPAY_HK"
    },
    {
      "enabled": true,
      "logo": {},
      "paymentMethodRegion": [
        "TH"
      ],
      "paymentMethodType": "RABBIT_LINE_PAY"
    },
    {
      "enabled": true,
      "logo": {
        "logoName": "Touch 'n Go eWallet",
        "logoUrl": "https://gw.alipayobjects.com/mdn/rms_4eeb39/afts/img/A*tDEsRoe-8PMAAAAAAAAAAAAAARQnAQ"
      },
      "paymentMethodRegion": [
        "MY"
      ],
      "paymentMethodType": "TNG"
    },
    {
      "enabled": true,
      "logo": {},
      "paymentMethodRegion": [
        "ID"
      ],
      "paymentMethodType": "DANA"
    },
    {
      "enabled": true,
      "logo": {},
      "paymentMethodRegion": [
        "MY"
      ],
      "paymentMethodType": "BOOST"
    },
    {
      "disableReason": "CURRENT_CHANNEL_NOT_EXIST",
      "enabled": false,
      "paymentMethodRegion": [
        "PK"
      ],
      "paymentMethodType": "EASYPAISA"
    },
    {
      "disableReason": "CURRENT_CHANNEL_NOT_EXIST",
      "enabled": false,
      "paymentMethodRegion": [
        "BD"
      ],
      "paymentMethodType": "BKASH"
    }
  ],
  "result": {
    "resultCode": "SUCCESS",
    "resultMessage": "success.",
    "resultStatus": "S"
  }
}
```