curl --location --request POST 'https://api.greenleavespay.kz/init_payment.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{greenleavespay_merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{greenleavespay_signature}}'
# Пример подписи:
'init_payment.php;25;test;{{greenleavespay_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.greenleavespay.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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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={{greenleavespay_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={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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.greenleavespay.kz/init_payment.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{greenleavespay_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={{greenleavespay_signature}}'
# Пример подписи:
'init_payment.php;25;test;{{greenleavespay_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.greenleavespay.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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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={{greenleavespay_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={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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>
{
"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@greenleavespay.kz",
"phone": "77"
},
"receipt_positions": null
},
"salt": "EitR7ZYZvhpioeCU",
"sig": "05e72b0137c52c1e941c627f42cb1f39"
}
{"status": "ok"}
curl --location --request POST 'https://api.greenleavespay.kz/any_amount.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{greenleavespay_merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{greenleavespay_signature}}' \
--form 'pg_payment_method=mobile_commerce'
# Пример подписи:
'any_amount.php;25;test;{{greenleavespay_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.greenleavespay.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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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={{greenleavespay_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={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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.greenleavespay.kz/v1/merchant/{{greenleavespay_merchant_id}}/card/pay" method="post" id="redirect-form">
<input type="hidden" name="pg_merchant_id" value="{{greenleavespay_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="{{greenleavespay_signature}}" />
</form>
<script type="text/javascript">
document.getElementById('redirect-form').submit();
</script>
</body>
</html>
$pg_merchant_id = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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.greenleavespay.kz/init_payment.php' \
--form 'pg_order_id=23' \
--form 'pg_merchant_id={{greenleavespay_merchant_id}}' \
--form 'pg_amount=25' \
--form 'pg_description=test' \
--form 'pg_salt=molbulak' \
--form 'pg_sig={{greenleavespay_signature}}' \
--form 'pg_payment_method=mobile_commerce'
# Пример подписи:
'init_payment.php;25;test;{{greenleavespay_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.greenleavespay.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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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 = {{greenleavespay_merchant_id}};
$secret_key = {{greenleavespay_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={{greenleavespay_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={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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_card_pan=5483-18XX-XXXX-0293' \
--form 'Параметры мерчанта=' \
--form 'pg_salt=some random string' \
--form 'pg_sig={{greenleavespay_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>
name|barcode|spic|label|unitcode|package_code|discount|other|tinORpinfl
Зубные Щетки||09603002002000000||27076|1508264|||