We have a preconfigured collection in POSTMAN to speed up the understanding of the basic operation of the API, in this section you will find how to configure this test environment that will allow you to initialize payment attempts for your merchant.

POSTMAN Collection

<aside> <img src="/icons/info-alternate_blue.svg" alt="/icons/info-alternate_blue.svg" width="40px" /> In order to make use of the collection you need to have access to POSTMAN either in its application or website format, you can access this service at postman.com

</aside>


  1. import the POSTMAN collection using 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 collection variables delivered by the ETpay integration team.

    Assign in  the variables without considering “session_token”.

    Assign in CURRENT VALUE the variables without considering “session_token”.

  3. Make a call with pre-configured test data.

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

  4. Observe request response

    Untitled

    Note that in this quick start section we will only use the token, however, consider that the signature token is extremely important and of obligatory use for the transition to production.

  5. Use the URL in the result “TEST”.

    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 URL of the payment attempt in QR format, this is so you can more easily test the payment system from a smartphone, however, it uses an external API to transform the URL into QR. We recommend using it only as a test

    </aside>

  6. Replicate call in your programming language.

    The following Python code executes the POST request described above, and with the session_token obtained redirects to the url that initiates the client session.

    import requests
    import webbrowser
    
    '''
    Simple API request,
    which redirects to the payment page.
    '''
    
    #Global variables delivered by ETpay
    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's own purchase order id
    }
    
    #Obtaining session token
    resp = requests.post(API_URL+INIT_API, json=request_data)
    token = resp.json()['token']
    
    #Client session is launched
    webbrowser.open(PTM_URL+'/session/'+token)
    '''Note that in this code the value of the signature_token is not stored. Its usefulness will be explained in detail later on, but it is necessary to obtain its value.'''
    

    Back to API Rest integration