We have a pre configured POSTMAN collection to speed up the understanding process of the basic functioning of the API
Disponemos de una colección en POSTMAN preconfigurada para agilizar el entendimiento del funcionamiento básico de la API, en este apartado podrás encontrar cómo configurar este entorno de pruebas que te permitirá inicializar intentos de pago para tu comercio.
<aside> <img src="/icons/info-alternate_blue.svg" alt="/icons/info-alternate_blue.svg" width="40px" /> To use the collection you need access to POSTMAN on the web or desktop app, you can access to this service on postman.com
</aside>
Import the collection with this ****link🔗
Declare the variables of the collection that the ETpay Support and Integration team sended to you before.
Assign the variables on CURRENT VALUE
excepting the “session_token”
Make a request with the preconfigurated test data
Take a look the request response
In this section of “Quick Start” we only use the “token”, but the “signature token” it’s extremely important and mandatory use for the production step
Use the URL from the “Test Results” tab
<aside> ⚠️ The QR_URL contains the payment url in QR format, this is only with test purpouse so we really recommend to use an external API to transform the URL in QR if you need this on your website or app.
</aside>
Replicate the request on your programming language
Ex: The next code on Python execute a POST request and then with the session_token redirect to the payment gateway url
import requests
import webbrowser
'''
Simple Request to the API
to redirect to the payment gateway.
'''
#ETpay global variables
API_URL = r'valid_url'
PTM_URL = r'valid_url'
INIT_API = r'/session/initialize'
MERCHANT_CODE = "valid_code"
MERCHANT_API_TOKEN = "valid_api_key"
request_data = {
"merchant_code": MERCHANT_CODE,
"merchant_api_token": MERCHANT_API_TOKEN,
"merchant_order_id": "order-1992", #Merchant Order Id
"order_amount" : 1,
}
#Obtaining the session token
resp = requests.post(API_URL+INIT_API, json=request_data)
token = resp.json()['token']
#Launch the session to the client
webbrowser.open(PTM_URL+'/session/'+token)
'''On this code we don't save the signature_token, but on the next will explain this on a detailed way, however you need to know that obtain this value is extremely important.'''