Praxis Wiki logo

Advantages of API v 1.3


Update to the newest version:

Possessing ourselves as a company that is always ready to provide one's customers the best online experience, we create a long-lasting relationship between merchants and customers with the help of providing the best integration solutions to accept online payments. Before you migrate from an older version please look through the advantages of API v1.3. 

Advantages of API 1.3 to compare with previous version

  1. Different data structure (objects).
    Each object contains details regarding one of the parts of communication - Customer, Session, Transaction, etc. Integration with this approach is more efficient and allows more extensibility for the future. 
  2. Extended data in notifications (we are able to pass more information that we receive from the PSP in the CRM callback like account number, IBAN, etc and more system settings such as Fees, etc.).
  3. Tokenization for cards and e-wallets
  4. New API method to retrieve an information regarding all available gateways and its' parameters {get-gateway-options}
  5. General flexibility is higher than in previous versions. 
  6. Javascript SDK is a toolbox to help the merchants initialize, position and control the cashier container, tab or window.
  7. Transaction Verification is an advanced case of manual transaction update, so the ability to verify the transactions. In certain cases the transaction details are changing during the processing, and sometimes these changes may require an additional verification or confirmation with PSP. Having a breakpoint at certain conditions would solve the issue and this is exactly what the transaction verification module offers.

    Try it out

    In order to test cashier payment:

  • Download the file
  • Indicate the correct environment (sandbox, live)
  • Use the credentials (merchant id, merchant secret, application key)   The examples are presented in php 5.5+, python 2.7+, nodejs 8.10+,  Here we are going to give the files, e.g.

    Php 5.5+

    
    <?php
    ​
    if (!defined('PRAXIS_API_TEST_DOMAIN')) define('PRAXIS_API_TEST_DOMAIN', 'https://gateway.cashier-test.com');
    if (!defined('PRAXIS_API_LIVE_DOMAIN')) define('PRAXIS_API_LIVE_DOMAIN', 'https://gateway.praxispay.com');
    ​
    $url = PRAXIS_API_TEST_DOMAIN . '/cashier/cashier';
    $merchant_id = '';
    $merchant_secret = '';
    $application_key = '';
    $gateway = null;
    $time = time();
    ​
    if (empty($merchant_id) || empty($merchant_secret) || empty($application_key)) {
       die('Variables must be set: $merchant_id, $merchant_secret, $application_key');
    }
    ​
    $data = [
        'currency' => 'USD',
        'amount' => 300,
        'balance' => 10000,
        'cid' => 'praxistest-' . $time,
        'locale' => 'en-GB',
        'gateway' => $gateway,
        'version' => '1.3',
        'timestamp' => $time,
        'country' => 'GB',
        'merchant_id' => $merchant_id,
        'application_key' => $application_key,
        'intent' => 'payment',
        'customer_data' => [
            'email' => '[email protected]',
            'country' => 'GB',
            'zip' => '123456',
            'city' => 'Some City',
            'address' => 'Some st., 123',
        ],
        'notification_url' => 'https://domain.does.not.exist/notification',
        'return_url' => 'https://domain.does.not.exist/return',
        'order_id' => 'order_' . $time,
    ];
    ​
    ​
    $signature = [
        $data['merchant_id'],
        $data['application_key'],
        $data['timestamp'],
        $data['intent'],
        $data['cid'],
        $data['order_id'],
    ];
    ​
    $signature = implode('', $signature);
    $signature = hash('sha384', $signature . $merchant_secret);
    ​
    $request = curl_init();
    curl_setopt_array($request, [
        CURLOPT_URL => $url,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS => json_encode($data),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_SSL_VERIFYHOST => true,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLINFO_HEADER_OUT => true,
        CURLOPT_HTTPHEADER => [
            'Content-Type: application/json; charset=utf-8',
            'GT-Authentication: ' . $signature,
        ],
    ]);
    ​
    $response = curl_exec($request);
    $info = curl_getinfo($request);
    curl_close($request);
    ​
    try {
       $response_data = json_decode($response, true);
    ​
       if (is_array($response_data) && isset($response_data['status']) && $response_data['status'] === 0 && isset($response_data['redirect_url'])) {
           echo $response_data['redirect_url'];
           die;
       } else if (is_array($response_data) && isset($response_data['description'])) {
           echo $response_data['description'];
           die;
       } else {
           echo 'Something went wrong';
           die;
       }
    } catch (Exception $e) {
       echo $e->getMessage();
    }
    ?>