Прием платежей
curl --location --request POST 'https://api.freedompay.kz/init_payment.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{signature}}'
# Пример подписи:
'init_payment.php;25;test;{{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' => [
[
// В случае формирования чеков в Республике Узбекистан, в параметре "name" необходимо передавать
// дополнительные значения в определённой последовательности.
// Детальную информацию можно найти в разделе "Особенности формирования фискальных чеков"
'name' => 'название товара',
'count' => '1',
'tax_type' => '3',
'price' => '900',
]
],
'pg_user_id' => '1',
'pg_param1' => 'дополнительные данные',
'pg_param2' => 'дополнительные данные',
'pg_param3' => 'дополнительные данные',
];
/**
* Функция превращает многомерный массив в плоский
*/
function makeFlatParamsArray($arrParams, $parent_name = '')
{
$arrFlatParams = [];
$i = 0;
foreach ($arrParams as $key => $val) {
$i++;
/**
* Имя делаем вида tag001subtag001
* Чтобы можно было потом нормально отсортировать и вложенные узлы не запутались при сортировке
*/
$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;
}
// Превращаем объект запроса в плоский массив
$requestForSignature = makeFlatParamsArray($requestForSignature);
// Генерация подписи
ksort($requestForSignature); // Сортировка по ключю
array_unshift($requestForSignature, 'init_payment.php'); // Добавление в начало имени скрипта
array_push($requestForSignature, $secret_key); // Добавление в конец секретного ключа
$request['pg_sig'] = md5(implode(';', $requestForSignature)); // Полученная подпись
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 'Параметры мерчанта=' \
--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>Платеж не разрешен</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 'Параметры мерчанта=' \
--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>Платеж разрешен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Платеж отменен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Заказ оплачен</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}}'
# Пример подписи:
'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' => 'название товара',
'tax_type' => '3',
'price' => '900',
]
],
'pg_user_id' => '1',
'pg_param1' => 'дополнительные данные',
'pg_param2' => 'дополнительные данные',
'pg_param3' => 'дополнительные данные',
];
/**
* Функция превращает многомерный массив в плоский
*/
function makeFlatParamsArray($arrParams, $parent_name = '')
{
$arrFlatParams = [];
$i = 0;
foreach ($arrParams as $key => $val) {
$i++;
/**
* Имя делаем вида tag001subtag001
* Чтобы можно было потом нормально отсортировать и вложенные узлы не запутались при сортировке
*/
$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;
}
// Превращаем объект запроса в плоский массив
$requestForSignature = makeFlatParamsArray($requestForSignature);
// Генерация подписи
ksort($requestForSignature); // Сортировка по ключю
array_unshift($requestForSignature, 'init_payment.php'); // Добавление в начало имени скрипта
array_push($requestForSignature, $secret_key); // Добавление в конец секретного ключа
$request['pg_sig'] = md5(implode(';', $requestForSignature)); // Полученная подпись
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 'Параметры мерчанта=' \
--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>Платеж не разрешен</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 'Параметры мерчанта=' \
--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>Платеж разрешен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Заказ оплачен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Платеж отменен</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: Ваш токен,
payment: {
amount: amount,
language: 'ru', // Язык виджета
description: 'Описание заказа',
},
successCallback: function (payment) {
console.log(payment) // Данные о платеже
},
errorCallback: function (payment) {
console.log(payment) // Данные о платеже
}
}
var widget = new PayBox(data);
widget.create();
}
<button onclick="pay(100)">Оплатить</button>
function pay(amount) {
var data = {
token: "Ваш токен",
payment: {
order: "1",
amount: "200",
currency: "KZT",
description: "Описание заказа",
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: "Коврик для мыши",
tax_type: 3,
price: 1000
},
{
count: 2,
name: "Розетка",
tax_type: 3,
price: 1000
}
]
}
},
successCallback: function (payment) {
//...
},
errorCallback: function (payment) {
//...
}
}
var widget = new PayBox(data);
widget.create();
}
successCallback: function (payment) {
// при успешном платеже
alert('Заказ номер ' + payment.order + ' успешно оплачен')
},
errorCallback: function (payment) {
// при неуспешном платеже
alert('Произошла ошибка при попытке оплаты заказа номер ' + 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 'Параметры мерчанта=' \
--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>Платеж не разрешен</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 'Параметры мерчанта=' \
--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>Платеж разрешен</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": "Описание заказа",
"payment_system": "WEBKZT",
"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'
# Пример подписи:
'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 'Параметры мерчанта=' \
--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>Платеж не разрешен</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 'Параметры мерчанта=' \
--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>Платеж разрешен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Платеж отменен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Заказ оплачен</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' => 'Описание платежа',
'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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Платеж отменен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Заказ оплачен</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' => 'Описание платежа',
'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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Платеж отменен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Заказ оплачен</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'
# Пример подписи:
'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_abonent_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_abonent_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 'Параметры мерчанта=' \
--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>Платеж разрешен</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 'Параметры мерчанта=' \
--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>Платеж не разрешен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Заказ оплачен</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=Покупка в интернет магазине 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_reference=111111111111' \
--form 'pg_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--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>Платеж отменен</pg_description>
<pg_salt>random string</pg_salt>
<pg_sig>ksdjrimzjedkljsujjemnjsuj</pg_sig>
</response>
"pg_order_id": "24012401",
"pg_merchant_id": "777777",
"pg_amount": "2000",
"pg_description": "ofd",
"pg_salt": "some random string",
"pg_sig": "6a9c25b26b9754f16b2baa7b2975cfb6",
"pg_result_url": "https://webhook.site/77777",
"pg_testing_mode": "0",
"pg_user_id": "1234",
"pg_receipt": {
"receipt_format": "kz_1_0",
"customer": {
"phone": "87077777777"
},
"positions": [
{
"price": "1000",
"name": "Товар №1",
"quantity": "1",
"vat_code": "vat_12"
},
{
"price": "500",
"name": "Товар №2",
"quantity": "1",
"vat_code": "vat_12"
},
{
"price": "500",
"name": "Товар №3",
"quantity": "1",
"vat_code": "vat_12"
}
]
}
}
name|barcode|spic|label|unitcode|package_code|discount|other|tinORpinfl
Зубные Щетки||09603002002000000||27076|1508264|||