Checking payment method availability

When working with different payment methods, in some cases you may need to get updates on their availability, for example, to keep the list of methods available to your customers accurate and up to date. The ecommpay payment platform supports the capability of checking payment method availability via an API both for individual and for all integrated methods. At the same time, however, keep in mind that even if the payment method is available, the problems when processing payments made with this method can still occur.

To check payment method availability, use requests to the /v2/info/available-methods/{payment_direction}/list endpoints where payment_direction indicates the payment category you need: payin for purchases of any type and payout for payouts. When working with these requests, keep in mind the following:

The payment platform supports the capability of checking payment method availability for processing purchases and payouts. Use requests to the /v2/info/available-methods/{payment_direction}/list endpoints where payment_direction indicates the payment category you need: payin for purchases of any type and payout for payouts. In addition, keep in mind the following:

  • Each request must contain the general object with two parameters:
  • If you need to check payment method availability for one or several specific payment methods, pass the payment_method_list array that specifies the payment method code for each method individually as a value of the payment_method parameter.
Figure 1. Example of data specified in the request to check Apple Pay and Google Pay availability
{
  "general":{
    "project_id": 50,
    "signature": "qflDO7yiPKCFTyqCAaT+2/f9Gi20aV5woHKyf6J/CGJyuSjq1GH7BYgmil8APKojXw=="
    },
  "payment_method_list": [
        {
            "payment_method":"etoken"
        },
        {
            "payment_method":"google-pay"
        }
        ]
}
Figure 2. Example of the request to check availability of all payment methods supported for the specific project
{
  "general":{
    "project_id": 50,
    "signature": "qflDO7yiPKCFTyqCAaT+2/f9Gi20aV5woHKyf6J/CGJyuSjq1GH7BYgmil8APKojXw=="
    }
}

A payment method availability request is processed according to the synchronous model of interaction between the web server and the payment platform. This implies that the request is fully processed within one HTTP session and uses only the resources of the payment platform. The response to the correct request contains an HTTP response status code (200) and the required data without detailed request processing information. If the request is incorrect, or there have been issues with its acceptance and processing, then the response contains an HTTP response status code, request processing status error and the detailed description of the error that occurred. To learn more about HTTP response status codes, see Interaction concepts, and to learn more about the response codes that provide information on operation processing in the payment platform, see Information of operations performing.

Payment method availability requests are synchronous. The response to the correct request contains an HTTP response status code (200) and the required data without detailed request processing information. If the request is incorrect, or there have been issues with its acceptance and processing, then the response contains an HTTP response status code (learn more), request processing status error and the detailed description of the error that occurred (learn more).

The body of the response to the correct request contains the project identifier, the signature, and the payment method availability array.

Figure 3. Example of data in the response with information about Apple Pay and Google Pay availability
{
    "project_id": 50,
    "signature": "qflDO7yiPKCFTyqCAaT+2/f9Gi20aV5woHKyf6J/CGJyuSjq1GH7BYgmil8APKojXw==",
    "available_methods":[
        {
            "payment_method":"etoken",
            "is_available": false
        },   
        {
            "payment_method":"google-pay",
            "is_available": true
        }]
}
Figure 4. Example of data in the response with information about availability of all supported methods
{
    "project_id": 50,
    "signature": "qflDO7yiPKCFTyqCAaT+2/f9Gi20aV5woHKyf6J/CGJyuSjq1GH7BYgmil8APKojXw==",
    "available_methods":[
        {
            "payment_method":"card",
            "is_available": true
        },    
        {
            "payment_method":"etoken",
            "is_available": false
        },    
        {
            "payment_method":"google-pay",
            "is_available": true
        }]
}