The client can implement Direct Debit by integrating a snippet to their website, which they can implement wherever they see convenient.
The first step of the payment process consists of obtaining a session token, by means of a call from your server (not from the client's browser). This in order to obtain the necessary data to make the subsequent service invocations.
API_URL: [Provided by ETpay]
ENDPOINT: /dd/start-session
Metod: POST
Parameters: delivered as a JSON in the body of the request, as described in the following table:
Parameter Name | Type | Description | Example of sent value |
---|---|---|---|
merchant_code | Required | String with merchant code, delivered by ETpay. | cl_demo_cl |
merchant_api_token | Required | String with the key, provided by ETpay. | 4a005f0eca91cd9474cadce4e5fc6f91c64a608b48f7b4b31344f8b20e270072 |
validation_type | Required | Static string, validates the mentioned credentials. | merchant_credentials |
Example call:
{
"validation_type": "merchant_credentials",
"merchant_code": "cl_demo_cl",
"merchant_api_token": "4a005f0eca91cd9474cadce4e5fc6f91c64a608b48f7b4b31344f8b20e270079"
}
The API will return a response like the following, in JSON format. The token parameter is a session token, to be used in the next call. The signature_token parameter is a string that will be used to validate the payment confirmation call. This token is unique per session and it is recommended that it be stored with the session for later validation.
{
"token": "nzOg6F[...]E0aARi",
"signature_token": "pPpd7[...]6sQhll",
"terms_url": "<https://www.etpay.com/terms-conditions>"
}
The fields are as follows:
Field name | Description | Example of sent value |
---|---|---|
token | String with the payment code. This field is used in all the following calls. | nzOg6F[...]E0aARi |
signature_token | String with a signature token, which will allow validating the authenticity of the response delivered by the payer's browser as a JWT token. |
It is recommended that this field be stored until the end of the process. | ab76d624[…]cfde7b3a | | terms_url | URL with the terms and conditions document for the user. It is not necessary to process this parameter. | https://s.etp.com/t_y_c.pdf |
Once you have the token, you must redirect to the site provided by ETpay to continue with the flow and replace the url by the one provided and the token by the one provided by the API.
https://[FRONT_URL]/session/<token>
Luego para poder agregar el snippet a tu web se deberá ingresar el siguiente código y reemplazar las variables