Payment
curl --location --request POST 'https://api.freedompay.kz/init_payment.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{paybox_merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{paybox_signature}}'
# Signature example:
'init_payment.php;25;test;{{paybox_merchant_id}};23;molbulak;{{secret_key}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_payment_id>4567788</pg_payment_id>
<pg_redirect_url>https://api.freedompay.kz/pay.html?customer=498333170d6a895148c57c53ffb18287</pg_redirect_url>
<pg_redirect_url_type>need data</pg_redirect_url_type>
<pg_salt>bdwLavL9lg6It91b</pg_salt>
<pg_sig>709633e91387c56ac6fb7cb33d1e07d8</pg_sig>
</response>
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = $requestForSignature = [
'pg_order_id' => '23',
'pg_merchant_id'=> $pg_merchant_id,
'pg_amount' => '25',
'pg_description' => 'test',
'pg_salt' => 'molbulak',
'pg_currency' => 'KZT',
'pg_check_url' => 'http://site.kz/check',
'pg_result_url' => 'http://site.kz/result',
'pg_request_method' => 'POST',
'pg_success_url' => 'http://site.kz/success',
'pg_failure_url' => 'http://site.kz/failure',
'pg_success_url_method' => 'GET',
'pg_failure_url_method' => 'GET',
'pg_state_url' => 'http://site.kz/state',
'pg_state_url_method' => 'GET',
'pg_site_url' => 'http://site.kz/return',
'pg_payment_system' => 'EPAYWEBKZT',
'pg_lifetime' => '86400',
'pg_user_phone' => '77777777777',
'pg_user_contact_email' => 'mail@customer.kz',
'pg_user_ip' => '127.0.0.1',
'pg_postpone_payment' => '0',
'pg_language' => 'ru',
'pg_testing_mode' => '1',
'pg_user_id' => '1',
'pg_recurring_start' => '1',
'pg_recurring_lifetime' => '156',
'pg_receipt_positions' => [
[
'count' => '1',
'name' => 'product name',
'tax_type' => '3',
'price' => '900',
]
],
'pg_user_id' => '1',
'pg_param1' => 'additional data',
'pg_param2' => 'additional data',
'pg_param3' => 'additional data',
];
/**
* The function turns a multidimensional array into a flat one
*/
function makeFlatParamsArray($arrParams, $parent_name = '')
{
$arrFlatParams = [];
$i = 0;
foreach ($arrParams as $key => $val) {
$i++;
/**
* Make the name like tag001subtag001
* So that you can then sort normally and nested nodes do not get confused when sorting
*/
$name = $parent_name . $key. sprintf('%03d', $i);
if (is_array($val)) {
$arrFlatParams = array_merge($arrFlatParams, makeFlatParamsArray($val, $name));
continue;
}
$arrFlatParams += array($name => (string)$val);
}
return $arrFlatParams;
}
// Turn the request object into a flat array
$requestForSignature = makeFlatParamsArray($requestForSignature);
// Signature generation
ksort($requestForSignature); // Sort by key
array_unshift($requestForSignature, 'init_payment.php'); // Adding to the beginning of the script name
array_push($requestForSignature, $secret_key); // Adding the private key to the end
$request['pg_sig'] = md5(implode(';', $requestForSignature)); // Received signature
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment not allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Payment allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=0' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment cancelled</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=1' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Order paid</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST 'https://api.freedompay.kz/init_payment.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{paybox_merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_payment_route=frame' \
--form 'pg_user_id=12345' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{paybox_signature}}'
# Signature example:
'init_payment.php;25;test;{{paybox_merchant_id}};23;molbulak;{{secret_key}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_payment_id>123456789</pg_payment_id>
<pg_redirect_url>https://api.freedompay.kz/v1/merchant/12345/card/payment?pg_payment_id=12343245dfsdfij123</pg_redirect_url>
<pg_redirect_url_type>need data</pg_redirect_url_type>
<pg_salt>some_random_string</pg_salt>
<pg_sig>your_signature</pg_sig>
</response>
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = $requestForSignature = [
'pg_order_id' => '23',
'pg_merchant_id'=> $pg_merchant_id,
'pg_amount' => '25',
'pg_description' => 'test',
'pg_salt' => 'molbulak',
'pg_payment_route' => 'frame',
'pg_currency' => 'KZT',
'pg_check_url' => 'http://site.kz/check',
'pg_result_url' => 'http://site.kz/result',
'pg_request_method' => 'POST',
'pg_success_url' => 'http://site.kz/success',
'pg_failure_url' => 'http://site.kz/failure',
'pg_success_url_method' => 'GET',
'pg_failure_url_method' => 'GET',
'pg_state_url' => 'http://site.kz/state',
'pg_state_url_method' => 'GET',
'pg_site_url' => 'http://site.kz/return',
'pg_payment_system' => 'EPAYWEBKZT',
'pg_lifetime' => '86400',
'pg_user_phone' => '77777777777',
'pg_user_contact_email' => 'mail@customer.kz',
'pg_user_ip' => '127.0.0.1',
'pg_postpone_payment' => '0',
'pg_language' => 'ru',
'pg_testing_mode' => '1',
'pg_user_id' => '1',
'pg_recurring_start' => '1',
'pg_recurring_lifetime' => '156',
'pg_receipt_positions' => [
[
'count' => '1',
'name' => 'product name',
'tax_type' => '3',
'price' => '900',
]
],
'pg_user_id' => '1',
'pg_param1' => 'additional data',
'pg_param2' => 'additional data',
'pg_param3' => 'additional data',
];
/**
* The function turns a multidimensional array into a flat one
*/
function makeFlatParamsArray($arrParams, $parent_name = '')
{
$arrFlatParams = [];
$i = 0;
foreach ($arrParams as $key => $val) {
$i++;
/**
* Make the name like tag001subtag001
* So that you can then sort normally and nested nodes do not get confused when sorting
*/
$name = $parent_name . $key. sprintf('%03d', $i);
if (is_array($val)) {
$arrFlatParams = array_merge($arrFlatParams, makeFlatParamsArray($val, $name));
continue;
}
$arrFlatParams += array($name => (string)$val);
}
return $arrFlatParams;
}
// Turn the request object into a flat array
$requestForSignature = makeFlatParamsArray($requestForSignature);
// Signature generation
ksort($requestForSignature); // Sort by key
array_unshift($requestForSignature, 'init_payment.php'); // Adding to the beginning of the script name
array_push($requestForSignature, $secret_key); // Adding the private key to the end
$request['pg_sig'] = md5(implode(';', $requestForSignature)); // Received signature
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment not allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Payment allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=1' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Order paid</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=0' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment cancelled</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
<script>
(function (p, a, y, b, o, x) {
o = p.createElement(a);
x = p.getElementsByTagName(a)[0];
o.async=1;
o.src = 'https://cdn.freedompay.kz/widget/pbwidget.js?' + 1 * new Date();
x.parentNode.insertBefore(o, x);
})(document, 'script');
</script>
function pay(amount) {
var data = {
token: Your token,
payment: {
amount: amount
language: 'ru', // Widget language
description: 'Order description',
},
successCallback: function (payment) {
console.log(payment) // Payment details
},
errorCallback: function (payment) {
console.log(payment) // Payment details
}
}
var widget = new PayBox(data);
widget.create();
}
<button onclick="pay(100)">Pay</button>
function pay(amount) {
var data = {
token: "your token",
payment: {
order: "1",
amount: "200",
currency: "KZT",
description: "Description of the order",
expires_at: "2020-12-12 00:00:00",
param1: "string",
param2: "string",
param3: "string",
test: 1, // testing mode
options: {
callbacks: {
result_url: "https://my-domain.com/result",
check_url: "https://my-domain.com/check"
},
custom_params: {},
user: {
email: "user@test.com",
phone: "77777777777",
},
receipt_positions: [
{
count: 2,
name: "Mouse pad",
tax_type: 3,
price: 1000
},
{
count: 2,
name: "Socket",
tax_type: 3,
price: 1000
}
]
}
},
successCallback: function (payment) {
//...
},
errorCallback: function (payment) {
//...
}
}
var widget = new PayBox(data);
widget.create();
}
successCallback: function (payment) {
// upon successful payment
alert('Order number ' + payment.order + ' paid successfully')
},
errorCallback: function (payment) {
// in case of unsuccessful payment
alert('An error occurred while trying to pay for order number ' + payment.order)
}
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment not allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Payment allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
{
"id": 12345,
status: {
"code": "success"
},
"order": 1234,
"amount": "100.00",
"refund_amount": "0.00",
"currency": "KZT",
"description": "Order description",
"payment_system": "EPAYWEBKZT",
"expires_at": "2022-01-18T05:58:58Z",
"created_at": "2022-01-17T11:58:58Z",
"updated_at": "2022-01-17T11:59:07Z",
"param1": null
"param2": null
"param3": null
"options": {
"callbacks": {
"result_url": "",
"check_url": ""
},
"user": {
"email": "widget@freedompay.kz",
"phone": "77"
},
"receipt_positions": null
},
"salt": "EitR7ZYZvhpioeCU",
"sig": "05e72b0137c52c1e941c627f42cb1f39"
}
{"status": "ok"}
curl --location --request POST 'https://api.freedompay.kz/any_amount.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{paybox_merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=mobile_commerce'
# Signature example:
'any_amount.php;25;test;{{paybox_merchant_id}};23;KZT;molbulak;{{secret_key}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_payment_id>4567788</pg_payment_id>
<pg_redirect_url>https://api.freedompay.kz/any_amount?customer=498333170d6a895148c57c53ffb18287</pg_redirect_url>
<pg_redirect_url_type>need data</pg_redirect_url_type>
<pg_salt>bdwLavL9lg6It91b</pg_salt>
<pg_sig>709633e91387c56ac6fb7cb33d1e07d8</pg_sig>
</response>
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_amount' => 10,
'pg_salt' => 'some random string',
'pg_order_id'=> '00102',
'pg_description' => 'Ticket',
'pg_result_url' => 'http://site.kz/result'
];
// $request['pg_testing_mode'] = 1; //add this parameter to request for testing payments
//if you pass any of your parameters, which you want to get back after the payment, then add them. For example:
// $request['client_name'] = 'My Name';
// $request['client_address'] = 'Earth Planet';
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'any_amount.php');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment not allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Payment allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=0' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment cancelled</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=1' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Order paid</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_amount' => 100,
'pg_order_id' => 12345,
'pg_user_id' => 1234,
'pg_card_token' => 'ef741cfc-f85e-41a0-84e6-2ba964912182',
'pg_description' => 'Payment description',
'pg_salt' => 'some random string',
];
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'init');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
<html>
<body>
<form action="https://api.freedompay.kz/v1/merchant/{{paybox_merchant_id}}/card/pay" method="post" id="redirect-form">
<input type="hidden" name="pg_merchant_id" value="{{paybox_merchant_id}}" />
<input type="hidden" name="pg_payment_id" value="12345" />
<input type="hidden" name="pg_salt" value="some random string" />
<input type="hidden" name="pg_sig" value="{{paybox_signature}}" />
</form>
<script type="text/javascript">
document.getElementById('redirect-form').submit();
</script>
</body>
</html>
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_payment_id' => 12345,
'pg_salt' => 'some random string',
];
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'pay');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=0' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment cancelled</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=1' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Order paid</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_amount' => 100,
'pg_order_id' => 12345,
'pg_user_id' => 1234,
'pg_card_token' => 'ef741cfc-f85e-41a0-84e6-2ba964912182',
'pg_description' => 'Payment description',
'pg_salt' => 'some random string',
];
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'init');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_payment_id' => 12345,
'pg_salt' => 'some random string',
];
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'direct');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=0' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment cancelled</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=500' \
--form 'pg_currency=KZT' \
--form 'pg_net_amount=482.5' \
--form 'pg_ps_amount=500' \
--form 'pg_ps_full_amount=500' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=1' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Order paid</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST 'https://api.freedompay.kz/init_payment.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{paybox_merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=mobile_commerce'
# Signature example:
'init_payment.php;25;test;{{paybox_merchant_id}};23;KZT;molbulak;{{secret_key}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_payment_id>4567788</pg_payment_id>
<pg_redirect_url>https://api.freedompay.kz/pay.html?customer=498333170d6a895148c57c53ffb18287</pg_redirect_url>
<pg_redirect_url_type>need data</pg_redirect_url_type>
<pg_salt>bdwLavL9lg6It91b</pg_salt>
<pg_sig>709633e91387c56ac6fb7cb33d1e07d8</pg_sig>
</response>
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_amount' => 10,
'pg_salt' => 'some random string',
'pg_order_id'=> '00102',
'pg_description' => 'Ticket',
'pg_result_url' => 'http://site.kz/result'
];
// $request['pg_testing_mode'] = 1; //add this parameter to request for testing payments
//if you pass any of your parameters, which you want to get back after the payment, then add them. For example:
// $request['client_name'] = 'My Name';
// $request['client_address'] = 'Earth Planet';
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'init_payment.php');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_payment_id' => 12345,
'pg_subscriber_phone' => 77077777777,
'pg_payment_system_code' => 'ALTELKZT',
'pg_salt' => 'some random string',
];
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'pay');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_payment_id' => 12345,
'pg_approval_code' => '077587',
'pg_salt' => 'some random string',
];
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'approve');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
$pg_merchant_id = {{paybox_merchant_id}};
$secret_key = {{paybox_merchant_secret}};
$request = [
'pg_merchant_id'=> $pg_merchant_id,
'pg_payment_id' => 12345,
'pg_subscriber_phone' => 77077777777,
'pg_salt' => 'some random string',
];
//generate a signature and add it to the array
ksort($request); // sort alphabetically
array_unshift($request, 'resend_otp');
array_push($request, $secret_key);
$request['pg_sig'] = md5(implode(';', $request)); // signature
unset($request[0], $request[1]);
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Payment allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{check_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_amount=10' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_ps_amount=5' \
--form 'pg_ps_full_amount=5' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment not allowed</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=1' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>ok</pg_status>
<pg_description>Order paid</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
curl --location --request POST '{{result_url}}' \
--form 'pg_order_id=123456789' \
--form 'pg_payment_id=12345' \
--form 'pg_currency=KZT' \
--form 'pg_ps_currency=KZT' \
--form 'pg_description=Purchase in the online store Site.kz' \
--form 'pg_result=1' \
--form 'pg_payment_date=2019-01-01 12:00:00' \
--form 'pg_can_reject=1' \
--form 'pg_user_phone=7077777777777' \
--form 'pg_user_contact_email=mail@customer.kz' \
--form 'pg_need_email_notification=1' \
--form 'pg_testing_mode=1' \
--form 'pg_captured=0' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Merchant parameters=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{paybox_signature}}' \
--form 'pg_payment_method=bankcard'
<?xml version="1.0" encoding="utf-8"?>
<response>
<pg_status>rejected</pg_status>
<pg_description>Payment cancelled</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>