Checking current payment information
Overview
While working with the ecommpay payment platform, you can monitor up-to-date payment processing information using Dashboard and at the API level—through callbacks sent automatically according to a set of specified conditions (to learn more, see Callbacks) and responses to payment status requests. These requests can be sent whenever needed—for example, you may need to check the status of the payment made at the payment kiosk because its processing can take more than a day—but not earlier than 10 seconds after the initial request to process a payment was sent.
Via the API, you can check payment status information with the use of:
- Payment ID. Use this option when you need payment information after the payment request has been accepted and the payment has been registered in the platform. In this case, the response to the payment status request contains essential information about the payment. If the payment request has not been accepted yet, for example, in case when the Payment Page was opened and the customer closed it without confirming the purchase, the response to the payment status request contains an error message that this payment has not been found in the platform.
- Request ID. Use this option if you need to check payment status information when the request has not been accepted for processing due to errors in the request. The response to such a request contains error information. However, once the payment has been registered in the platform, the preferred method of checking payment status information is by the payment identifier.
A payment status 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.
Checking payment information by payment ID
Request format
A request to check payment status by payment ID is formatted according to the guidelines listed in Interaction concepts. It is sent to the endpoint /v2/payment/status, and its body must contain a general
object with the following identification information:
project_id
—a project ID assigned by ecommpay at the stage of integration;payment_id
—an ID of the payment to be monitored;signature
—a request signature generated after required parameters listed above have been specified. To learn more, see Signature generation and verification.
Response format
A response to the payment status request is formatted according to the guidelines listed in Interaction concepts. If the request has been successfully accepted and processed, the response header contains the status line indicating the protocol and its version (HTTP/1.1
), the response status code and the explanatory phrase (for instance, 200 OK
). The body of such response contains the following data:
- a project identifier and a signature;
- information about the payment status and all operations initiated within this payment;
- additional data that can vary depending on the payment method used and can be customised for different payment methods with the assistance of the technical support specialists.
The basic set of parameters passed in the response to the payment status request is listed in the Gate API specification.
Response examples
The following response contains information about a completed two-step purchase. It includes:
- response status code indicating that the payment status request has been successfully processed (
200
); - status of the payment in question (
success
); - code of the payment method used (
card
); - information about the
auth
andcapture
operations contained in theoperations
array.
The following response contains information about a one-step purchase in progress which includes:
- response status code indicating that the payment status request has been successfully processed (
200
); - status of the payment in question (
awaiting redirect result
); - code of the payment method used (
Malaysian Banks
); - information about the
sale
operation contained in theoperations
array
The following is the response to the incorrect request. If the request contains an error, the response includes:
- response status code indicating the reason for the error that occurred (
400 Bad Request
); - request processing status (
error
); - detailed description of the error that occurred: error code (
2004
) and the explanatory phrase (Required field not provided
).
For comparison, the following is the example of the response with the information about a declined payment. This response contains:
- response status code indicating that the payment status request has been successfully processed (
200
); - status of the payment in question (
decline
); - information about the
sale
operation which includes operation processing error code (20502
) and the explanatory phrase (Error during operation validation
).
The following example is the response to the payment status request when the payment in question has not been initiated in the payment platform (for instance, when the customer has closed the Payment Page without confirming the purchase and, thus, the request to initiate the payment has not been actually sent). In this case, the response contains:
- response status code indicating that the payment status request has been successfully processed (
200
); - status of the payment in question (
error
); - detailed description of the error that occurred: error code (
3061
) and the explanatory phrase (Transaction not found
).
Checking payment information by request ID
Request format
A request to check payment status by request ID is formatted according to the guidelines listed in Interaction concepts. It is sent to the endpoint /v2/payment/status/request, and its body must contain the following identification information:
project_id
—a project ID assigned by ecommpay at the stage of integration;request_id
—an ID of the request to be monitored, can be found in the synchronous response from the payment platform;signature
—a request signature generated after required parameters listed above have been specified. To learn more, see Signature generation and verification.
Response format
A response to the payment status request is formatted according to the guidelines listed in Interaction concepts. If the request has been successfully accepted and processed, the response header contains the status line indicating the protocol and its version (HTTP/1.1), the response status code and the explanatory phrase (for instance, 200 OK
). The body of such response contains information about the payment in question: it is either the information about the payment status and all operations initiated within this payment, or the information about errors in the payment request.