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 via this link đź”—

  2. Declare the collection variables delivered by the ETpay integration team.

    Assign invariables without considering “session_token”

    Assign inCURRENT VALUEvariables without considering “session_token”

  3. Make a request with pre-configured test data

  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 mandatory use for the transition to production.

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

    <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 to use it only for testing purposes

    </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 starts the client session.

    import requests
    import webbrowser
    
    '''
    Simple API request,
    that redirects to the payment page.
    '''
    
    #Global Variables delivered by ETpay
    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's own purchase order id
        "order_amount" : 1,
    }
    
    #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+'/tapp/session/'+token)
    '''Note that in this code the value of the signature_token is not stored. Its usefulness will be explained in detail later, but it should be noted that it is necessary to obtain its value.'''
    

    Back to TNB Tapp Integration (Direct Button)