Developer - Api Documentation

Introduction

This section describes the PayX payment gateway API. PayX API is easy to integrate into your business software. Our API uses structured URLs, accepts cURL requests, and returns JSON responses. You can use the API in test mode, which does not affect your live data. The API key is used to authenticate the request and determines whether the request is a valid payment or not. For test mode, use the sandbox URL. For live mode, use the live URL provided in the Initiate Payment section.

Supported Currencies

This section describes the currencies supported by PayX. PayX allows for making transactions with the currencies listed below. New currencies may be updated in the future.

Currency Name Currency Symbol Currency Code
United States Dollar $ USD
Euro EUR
British pound £ GBP
KZT KZT
Tether USDT
USD Coin 🅤 USDC
Bitcoin BTC

Get API Keys

This section describes how you can get your API keys. Login to your PayX merchant account. If you don't have one, please click 'Here'. Click Here


Next, find the API Keys menu in your dashboard sidebar and click it. There you will find your Public Key and Secret Key. Use these keys to initiate API requests. You can generate a new API key at any time by clicking the Generate API Key button. Important: do not share these keys with anyone.

Initiate Payment

This section describes the process of initiating a payment. To initiate a payment, use the example code and carefully check the request parameters. Use the following API endpoints to send requests.


To initiate the payment follow the example code and be careful with the perameters. You will need to make request with these following API end points.

Live End Point: https://www.payx.kz/payment/initiate

Test End Point: https://www.payx.kz/sandbox/payment/initiate

Test Mode Mail: [email protected]

Test Mode Verification Code: 222666

Request Method: POST

Request to the end point with the following parameters below.

Param Name Param Type Description
public_key string (50) Required Your Public API key
identifier string (20) Required Identifier is basically for identify payment at your end
currency string (4) Required Currency Code, Must be in Upper Case. e.g. USD,EUR
amount decimal Required Payment amount.
details string (100) Required Details of your payment or transaction.
ipn_url string Required The url of instant payment notification.
success_url string Required Payment success redirect url.
cancel_url string Required Payment cancel redirect url.
site_logo string/url Required Your business site logo.
checkout_theme string Optional Checkout form theme dark/light. Default theme is light
customer_name string (30) Required Customer name.
customer_email string (30) Required Customer valid email.
Example PHP code
<?php
    $parameters = [
        'identifier' => 'DFU80XZIKS',
        'currency' => 'USD',
        'amount' => 100.00,
        'details' => 'Purchase T-shirt',
        'ipn_url' => 'http://example.com/ipn_url.php',
        'cancel_url' => 'http://example.com/cancel_url.php',
        'success_url' => 'http://example.com/success_url.php',
        'public_key' => 'your_public_key',
        'site_logo' => 'https://www.payx.kz/assets/images/logoIcon/logo.png',
        'checkout_theme' => 'dark',
        'customer_name' => 'John Doe',
        'customer_email' => '[email protected]',

    ];

    //live end point
    $url = "https://www.payx.kz/payment/initiate";

    //test end point
    $url = "https://www.payx.kz/sandbox/payment/initiate";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $parameters);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);

    //$result contains the response back.
?>
Example Responses
//Error Response.
{
    "error": "true",
    "message": "Invalid api key"
}

//Success Response.
{
    "success": "ok",
    "message": "Payment Initiated. Redirect to url.",
    "url":"http://example.com/initiate/payment/checkout?payment_id=eJSAASDxdrt4DASDASVNASJA7893232432cvmdsamnvASF"
}

IPN & Payment Validation

This section describes the process of receiving instant payment notifications (IPN) and validating payment data. To set up payment notifications, use the example code and carefully check the request parameters. For this, use the following API endpoint.


To initiate the payment follow the example code and be careful with the perameters. You will need to make request with these following API end points.

End Point: Your business application ipn url.

Request Method: POST

You will get following parameters below.

Param Name Description
status Payment success status.
identifier Identifier is basically for identify payment at your end.
signature A hash signature to verify your payment at your end.
data Data contains some basic information with charges, amount, currency, payment transaction id etc.
Example PHP code
<?php
    //Receive the response parameter
    $status = $_POST['status'];
    $signature = $_POST['signature'];
    $identifier = $_POST['identifier'];
    $data = $_POST['data'];

    // Generate your signature
    $customKey = $data['amount'].$identifier;
    $secret = 'YOUR_SECRET_KEY';
    $mySignature = strtoupper(hash_hmac('sha256', $customKey , $secret));

    $myIdentifier = 'YOUR_GIVEN_IDENTIFIER';

    if($status == "success" && $signature == $mySignature &&  $identifier ==  $myIdentifier){
        //your operation logic
    }
?>

We may use cookies or any other tracking technologies when you visit our website, including any other media form, mobile website, or mobile application related or connected to help customize the Site and improve your experience. learn more

Allow