Customer’s Implementation

I) Payment Preparation: Session Initialization

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.

Call

URL: /session/initialize

Method: POST

Parameter: are provided as a JSON in the body of the request, as described in the following table:

Nombre parámetro Tipo Descripción Ejemplo de valor enviado
merchant_code Required String with merchant code, provided by ETpay cl_demo_cl
merchant_api_token Required String with the key, provided by ETpay 4a005f0eca91cd9474cadce4e5fc6f91c64a608b48f7b4b31344f8b20e270079
merchant_order_id Required String with an internal identifier of the merchant, which allows to identify the payment in their own systems. OC-700104
order_amount Required Integer with the amount to be paid in $CLP, without points. 50000
customer_email Optional String with the customer's email, which can be used for returns. [email protected]
metadata Optional Arrangement with data to display to the customer during the payment process. Identifies, for example, what is being paid for (e.g., payment for basic services, products, etc.).

There is no limit to the number of fields that can be sent, but the usability of the system must be considered; 3 or 4 fields should be sufficient.

The show field indicates whether the field should be shown in the payment flow or not (true or false, respectively). | [{ "name": "Cuenta Servicio Gas", "value": "30.215", "show": true }] | | user_bank_code | Optional | String with the banking institution code that will be preloaded in the form for the customer. When included, the customer accesses directly to the credential entry form of the respective banking institution. | Accepted codes: cl_estadocl_santandercl_bchcl_bcicl_falabellacl_itaucl_scotiabank | | user_rut | Optional | String with the client's RUT, which will be preloaded in the form. | 111111111 | | is_rut_block | Optional | Boolean that in case it exists with value True, blocks the client's preloaded RUT. | True | | payment_completed_url | Optional | URL to be used for redirection of a successful payment. | https://merchant.com/success | | payment_cancellation_url | Optional | URL to be used for redirecting a cancelled payment | https://merchant.com/fail |

Call Example:

{
  "merchant_code":"cl_demo_cl",  #Provided by ETpay
  "merchant_api_token":"4a005f0eca91cd9474cadce4e5fc6f91c64a608b48f7b4b31344f8b20e270079", #Provided by ETpay
  "merchant_order_id":"OC-700104", "#Intern ID from the merchant", #For Conciliation
  "order_amount":50000, #total valuepaid by the client, in CLP  
  "customer_email":"[email protected]", #Client's E-Mail
  "metadata":[{
    "name":"Cuenta Servicio Gas",
    "value":"30.215",
    "show":true
  }]
}

Reply

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://static-dev.etpayment.com/terminos_y_condiciones.pdf>"
}
Field name Description Example of value received
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 |

II) Widget Usage

Then with the token you must generate the following url:

https://[url provided by ETpay]/session/<token>