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.

POSTMAN Collection

<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>


  1. Import the collection with this ****link🔗

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c61a8627-b836-43f1-ba63-f5c7df147059/image-20220603-162042.png

  2. Declare the variables of the collection that the ETpay Support and Integration team sended to you before.

    Assign the variables on  excepting the “session_token”

    Assign the variables on CURRENT VALUE excepting the “session_token”

  3. Make a request with the preconfigurated test data

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/076cd006-a51b-4358-b80f-ba86a01be443/image-20220603-154113.png

  4. Take a look the request response

    Untitled

    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

  5. Use the URL from the “Test Results” tab

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/723cc71c-4143-49e4-af63-1433ad04e47a/image-20220603-154500.png

    <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>

  6. 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.'''
    

    Back to API Rest Integration