In the following we will specify how to implement the payment service with the basic operation, there are customizations for the behavior of the payment service which are detailed in Additional Personalization Features.
The moment a client decides to pay via ETpay, a flow is triggered which is summarized as follows:
Parameter | Description |
---|---|
merchant_code | Unique trade ID code, will vary between sandbox and pre-production/production environments. It is provided at the beginning of the process once the Basic Requirements are completed. |
merchant_api_token | Authentication token for api usage will vary between sandbox and pre-production/production environments. It is provided at the beginning of the process once the Basic Requirements are completed. |
api_url | Service API URL and session creation will vary between sandbox and pre-production/production environments. It is provided at the beginning of the process once the Basic Requirements are completed. |
pmt_url | Payment funnel URL, used in conjunction with session_token to initiate an end user's payment flow, will vary between sandbox and pre-production/production environments. It is provided at the beginning of the process once the Basic Requirements are completed. |
merchant_order_id | The merchant's own order identifier, used at the time of creating a payment session, is alphanumeric in format, with a maximum length of 64 characters. |
order_amount | Amount of purchase, used in session creation. |
session_token | Unique session token, it is returned as an API response when creating a session. It is used in conjunction with pmt_url to initiate an end user's payment flow. |
signature_token | Signature token, it is returned as an API response when a session is created. It is used to validate JWT information notifications. |
JWT | JWT's are a secure and easy way to transmit information over the web. They are encrypted and have a “signature” that guarantees that the content has not changed. In our case, the signature of the JWTs we send is the signature_token. |
If the content of the JWT changes, we will be able to know that it is not true because when we try to validate the content using the signature_token we will get different values. | |
payment_token | Payment attempt identifier, this identifier is returned once the payment session has occurred and allows us to identify within our system the steps and logs that occurred during the payment. |
The first step of the payment process consists of obtaining a session_token, by means of a POST call from the merchant's server (not from the client's browser) with the merchant_code and merchant_api_key to the [API_URL]/session/initialize endpoint. The body must be a JSON with the following variables:
{
"merchant_code": "your_merchant_code",
"merchant_api_token": "your_merchant_api_token",
"merchant_order_id": "your_order_id",
"order_amount": 2000
}
<aside> <img src="/icons/info-alternate_blue.svg" alt="/icons/info-alternate_blue.svg" width="40px" /> A simplified example is available in POSTMAN at Quick Start
</aside>
<aside> ⚠️ Consider that both credentials and URLs change between environments as explained in the integration environments
</aside>