Payment solution RU 4
- Создание платежей по нашей форме (реквизиты карты)
- Создание платежей по H2H (получение реквизитов по API)
- Создание платежей по H2H (получение номера телефона по API)
- Создание платежей по H2H (SberPay)
- Создание платежей по форме (Платёжный счёт)
- Создание платежей по H2H (Платёжный счёт)
- Example
- Создание выплат через метод "СБП"
- Создание выплат через метод "Платежный счёт"
Создание платежей по нашей форме
URL | POST https://api-merchant.alikassa.com/v1/payment |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Link https://merchant.alikassa.com/cabinet/form/setting-api-certs generate "API certificate for payment", save the archive, unpack
- password.txt
- private.pem
- public.pem
We keep only public.pem for signature verification.
Wrap all POST data in json (in the same order) and sign
$data = json_encode($data);
$privateKey = openssl_pkey_get_private(
file_get_contents('private.pem'),
file_get_contents('password.txt')
);
if ($privateKey===false) {
throw new \Exception('Error cert.');
}
openssl_sign($data, $sign, $privateKey);
$sign = base64_encode($sign);
Pass the received $sign in the Sign header. You can find a sample code at the end of the document.
* - Required fieldsName | Type | Description |
amount* | decimal (11.2) | Amount |
order_id* | string (128) | Your id must be unique |
service* | string (100) | payment_card_number_rub_hpp |
customer_ip* | ip | Payer's IP address |
customer_user_id* | string (100) | Id плательщика в вашей системе |
success_redirect_id | int | Id of redirect upon successful payment |
fail_redirect_id | int | Id of redirect in case of unsuccessful payment |
notification_endpoint_id | int | Notification id |
success_redirect_url | string|max:255 | Link to redirect after successful payment |
fail_redirect_url | string|max:255 | Link to redirect after unsuccessful payment |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized |
Response
Name | Description |
url | Link to payment |
payment_status |
Payment status wait — in the process of payment |
id | AliKassa payment id |
uuid | AliKassa payment uuid |
success_redirect_url | Ссылка на вашу страницу, для редирека клиента после успешной оплаты |
When creating, always wait, check the payment status via the API or wait for a notification!
Example of a successful HTTP CODE 200 response:
{
"url" => "https://pay-merchant.alikassa.com/bd291fe1-5c19-4113-ae62-a2d3c4d01d20"
"payment_status" => "wait"
"id" => 108465371
"uuid" => "bd291fe1-5c19-4113-ae62-a2d3c4d01d20"
"success_redirect_url" => null
}
An example of an unsuccessful HTTP CODE 400 response:
{
"message": "The given data was invalid.",
"errors": {
...
}
}
After receiving the url, redirect the client to the link.
Possible values of payment_status, see the documentation "Payment status".
Если вы передали notification_endpoint_id или notification_endpoint_url, то вы получите уведомление о смене статуса оплаты
Создание платежей по H2H (получение реквизитов по API)
URL | POST https://api-merchant.alikassa.com/v1/payment |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Link https://merchant.alikassa.com/cabinet/form/setting-api-certs generate "API certificate for payment", save the archive, unpack
- password.txt
- private.pem
- public.pem
We keep only public.pem for signature verification.
Wrap all POST data in json (in the same order) and sign
$data = json_encode($data);
$privateKey = openssl_pkey_get_private(
file_get_contents('private.pem'),
file_get_contents('password.txt')
);
if ($privateKey===false) {
throw new \Exception('Error cert.');
}
openssl_sign($data, $sign, $privateKey);
$sign = base64_encode($sign);
Pass the received $sign in the Sign header. You can find a sample code at the end of the document.
* - Required fieldsName | Type | Description |
amount* | decimal (11.2) | Amount |
order_id* | string (128) | Your id must be unique |
service* | string (100) | payment_card_number_card |
customer_ip* | ip | Payer's IP address |
customer_user_id* | string (100) | Id плательщика в вашей системе |
customer_code* | string (100) |
Full list of banks
Пример, "100000000111" |
notification_endpoint_id | int | Notification id |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized |
Response
Name | Description |
url | null |
payment_status |
Payment status wait — in the process of payment |
id | AliKassa payment id |
uuid | AliKassa payment uuid |
success_redirect_url | Ссылка на вашу страницу, для редирека клиента после успешной оплаты |
cardNumber | Реквизиты карты в формате "1111111111110019" |
cardHolderName | Данные владельца карты в формате "Имя Отчество Ф." |
When creating, always wait, check the payment status via the API or wait for a notification!
Example of a successful HTTP CODE 200 response:
{
"url" => null
"payment_status" => "wait"
"id" => 108465371
"uuid" => "bd291fe1-5c19-4113-ae62-a2d3c4d01d20"
"success_redirect_url" => null
"cardNumber" => "1111111111110019"
"cardHolderName" => "Имя Отчество Ф."
}
An example of an unsuccessful HTTP CODE 400 response:
{
"message": "The given data was invalid.",
"errors": {
...
}
}
После получения реквизитов, покажите их на своей форме.
Possible values of payment_status, see the documentation "Payment status".
Если вы передали notification_endpoint_id или notification_endpoint_url, то вы получите уведомление о смене статуса оплаты
Создание платежей по H2H (получение номера телефона по API)
URL | POST https://api-merchant.alikassa.com/v1/payment |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Link https://merchant.alikassa.com/cabinet/form/setting-api-certs generate "API certificate for payment", save the archive, unpack
- password.txt
- private.pem
- public.pem
We keep only public.pem for signature verification.
Wrap all POST data in json (in the same order) and sign
$data = json_encode($data);
$privateKey = openssl_pkey_get_private(
file_get_contents('private.pem'),
file_get_contents('password.txt')
);
if ($privateKey===false) {
throw new \Exception('Error cert.');
}
openssl_sign($data, $sign, $privateKey);
$sign = base64_encode($sign);
Pass the received $sign in the Sign header. You can find a sample code at the end of the document.
* - Required fieldsName | Type | Description |
amount* | decimal (11.2) | Amount |
order_id* | string (128) | Your id must be unique |
service* | string (100) | payment_card_sbp_rub_card |
customer_ip* | ip | Payer's IP address |
customer_user_id* | string (100) | Id плательщика в вашей системе |
notification_endpoint_id | int | Notification id |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized |
Response
Name | Description |
url | null |
payment_status |
Payment status wait — in the process of payment |
id | AliKassa payment id |
uuid | AliKassa payment uuid |
success_redirect_url | Ссылка на вашу страницу, для редирека клиента после успешной оплаты |
cardNumber | Номер телефона в формате "79031112233" |
cardHolderName | Данные владельца карты в формате "Имя Отчество Ф." |
When creating, always wait, check the payment status via the API or wait for a notification!
Example of a successful HTTP CODE 200 response:
{
"url" => null
"payment_status" => "wait"
"id" => 108465371
"uuid" => "5e628a85-b94a-3678-a63b-a9511e80e60b"
"success_redirect_url" => null
"cardNumber" => "79031112233"
"cardHolderName" => "Имя Отчество Ф."
}
An example of an unsuccessful HTTP CODE 400 response:
{
"message": "The given data was invalid.",
"errors": {
...
}
}
После получения реквизитов, покажите их на своей форме.
Possible values of payment_status, see the documentation "Payment status".
Если вы передали notification_endpoint_id или notification_endpoint_url, то вы получите уведомление о смене статуса оплаты
Создание платежей по H2H (SberPay)
URL | POST https://api-merchant.alikassa.com/v1/payment |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Link https://merchant.alikassa.com/cabinet/form/setting-api-certs generate "API certificate for payment", save the archive, unpack
- password.txt
- private.pem
- public.pem
We keep only public.pem for signature verification.
Wrap all POST data in json (in the same order) and sign
$data = json_encode($data);
$privateKey = openssl_pkey_get_private(
file_get_contents('private.pem'),
file_get_contents('password.txt')
);
if ($privateKey===false) {
throw new \Exception('Error cert.');
}
openssl_sign($data, $sign, $privateKey);
$sign = base64_encode($sign);
Pass the received $sign in the Sign header. You can find a sample code at the end of the document.
* - Required fieldsName | Type | Description |
amount* | decimal (11.2) | Amount |
order_id* | string (128) | Your id must be unique |
service* | string (100) | payment_card_sberpay_rub_card |
customer_ip* | ip | Payer's IP address |
customer_user_id* | string (100) | Id плательщика в вашей системе |
notification_endpoint_id | int | Notification id |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized |
Response
Name | Description |
url | Ссылка для переадресации клиента, https://p2p.cloudpaypro.com/5e628a85-b94a-3678-a63b-a9511e80e60b |
payment_status |
Payment status wait — in the process of payment |
id | AliKassa payment id |
uuid | AliKassa payment uuid |
success_redirect_url | Ссылка на вашу страницу, для редирека клиента после успешной оплаты |
cardNumber | Номер телефона в формате "79031112233" |
cardHolderName | Данные владельца карты в формате "Имя Отчество Ф." |
When creating, always wait, check the payment status via the API or wait for a notification!
Example of a successful HTTP CODE 200 response:
{
"url" => "https://p2p.cloudpaypro.com/5e628a85-b94a-3678-a63b-a9511e80e60b"
"payment_status" => "wait"
"id" => 108465371
"uuid" => "5e628a85-b94a-3678-a63b-a9511e80e60b"
"success_redirect_url" => null
"cardNumber" => "79031112233"
"cardHolderName" => "Имя Отчество Ф."
}
An example of an unsuccessful HTTP CODE 400 response:
{
"message": "The given data was invalid.",
"errors": {
...
}
}
После получения реквизитов, покажите их на своей форме.
Possible values of payment_status, see the documentation "Payment status".
Если вы передали notification_endpoint_id или notification_endpoint_url, то вы получите уведомление о смене статуса оплаты
Создание платежей по форме (Платёжный счёт)
URL | POST https://api-merchant.alikassa.com/v1/payment |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Link https://merchant.alikassa.com/cabinet/form/setting-api-certs generate "API certificate for payment", save the archive, unpack
- password.txt
- private.pem
- public.pem
We keep only public.pem for signature verification.
Wrap all POST data in json (in the same order) and sign
$data = json_encode($data);
$privateKey = openssl_pkey_get_private(
file_get_contents('private.pem'),
file_get_contents('password.txt')
);
if ($privateKey===false) {
throw new \Exception('Error cert.');
}
openssl_sign($data, $sign, $privateKey);
$sign = base64_encode($sign);
Pass the received $sign in the Sign header. You can find a sample code at the end of the document.
* - Required fieldsName | Type | Description |
amount* | decimal (11.2) | Amount |
order_id* | string (128) | Your id must be unique |
service* | string (100) | virtual_account_rub_hpp |
customer_ip* | ip | Payer's IP address |
customer_user_id* | string (100) | Id плательщика в вашей системе |
notification_endpoint_id | int | Notification id |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized |
Response
Name | Description |
url | Ссылка для переадресации клиента, https://p2p.cloudpaypro.com/5e628a85-b94a-3678-a63b-a9511e80e60b |
payment_status |
Payment status wait — in the process of payment |
id | AliKassa payment id |
uuid | AliKassa payment uuid |
success_redirect_url | Ссылка на вашу страницу, для редирека клиента после успешной оплаты |
cardNumber | Платёжный счёт |
cardHolderName | Данные владельца карты в формате "Имя Отчество Ф." |
When creating, always wait, check the payment status via the API or wait for a notification!
Example of a successful HTTP CODE 200 response:
{
"url" => "https://p2p.cloudpaypro.com/5e628a85-b94a-3678-a63b-a9511e80e60b"
"payment_status" => "wait"
"id" => 108465371
"uuid" => "5e628a85-b94a-3678-a63b-a9511e80e60b"
"success_redirect_url" => null
"cardNumber" => "***"
"cardHolderName" => "Имя Отчество Ф."
}
An example of an unsuccessful HTTP CODE 400 response:
{
"message": "The given data was invalid.",
"errors": {
...
}
}
После получения реквизитов, покажите их на своей форме.
Possible values of payment_status, see the documentation "Payment status".
Если вы передали notification_endpoint_id или notification_endpoint_url, то вы получите уведомление о смене статуса оплаты
Создание платежей по H2H (Платёжный счёт)
URL | POST https://api-merchant.alikassa.com/v1/payment |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Link https://merchant.alikassa.com/cabinet/form/setting-api-certs generate "API certificate for payment", save the archive, unpack
- password.txt
- private.pem
- public.pem
We keep only public.pem for signature verification.
Wrap all POST data in json (in the same order) and sign
$data = json_encode($data);
$privateKey = openssl_pkey_get_private(
file_get_contents('private.pem'),
file_get_contents('password.txt')
);
if ($privateKey===false) {
throw new \Exception('Error cert.');
}
openssl_sign($data, $sign, $privateKey);
$sign = base64_encode($sign);
Pass the received $sign in the Sign header. You can find a sample code at the end of the document.
* - Required fieldsName | Type | Description |
amount* | decimal (11.2) | Amount |
order_id* | string (128) | Your id must be unique |
service* | string (100) | virtual_account_rub_card |
customer_ip* | ip | Payer's IP address |
customer_user_id* | string (100) | Id плательщика в вашей системе |
notification_endpoint_id | int | Notification id |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized |
Response
Name | Description |
payment_status |
Payment status wait — in the process of payment |
id | AliKassa payment id |
uuid | AliKassa payment uuid |
success_redirect_url | Ссылка на вашу страницу, для редирека клиента после успешной оплаты |
cardNumber | Платёжный счёт |
cardHolderName | Данные владельца карты в формате "Имя Отчество Ф." |
When creating, always wait, check the payment status via the API or wait for a notification!
Example of a successful HTTP CODE 200 response:
{
"payment_status" => "wait"
"id" => 108465371
"uuid" => "5e628a85-b94a-3678-a63b-a9511e80e60b"
"success_redirect_url" => null
"cardNumber" => "***"
"cardHolderName" => "Имя Отчество Ф."
}
An example of an unsuccessful HTTP CODE 400 response:
{
"message": "The given data was invalid.",
"errors": {
...
}
}
После получения реквизитов, покажите их на своей форме.
Possible values of payment_status, see the documentation "Payment status".
Если вы передали notification_endpoint_id или notification_endpoint_url, то вы получите уведомление о смене статуса оплаты
Example
Unpack the downloaded archive into the folder "path to script/cert/payment /"
function requestPayment(string $method, string $account, array $data)
{
$data = json_encode($data);
$privateKey = openssl_pkey_get_private(
file_get_contents(__DIR__ . '/cert/payment/private.pem'),
file_get_contents(__DIR__ . '/cert/payment/password.txt')
);
if ($privateKey===false) {
throw new \Exception('Error cert.');
}
openssl_sign($data, $sign, $privateKey);
$sign = base64_encode($sign);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api-merchant.alikassa.com/' . $method);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Account: ' . $account,
'Sign: ' . $sign,
]);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_USERAGENT, 'AliKassa2.0 API');
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
return json_decode($response, true);
}
$payment = requestPayment('v1/payment', '93d5df06-996c-48c3-9847-348d6b580b80', [
'order_id' => (string)time(),
'amount' => 500,
'customer_browser_user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0',
'customer_ip' => '18.191.80.10',
'success_redirect_id' => 1,
'fail_redirect_id' => 1,
'notification_endpoint_id' => 5,
'service' => 'payment_card_rub_hpp',
]);
var_dump($payment);
Создание выплат через метод СБП
URL | POST https://api-merchant.alikassa.com/v1/payout |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Name | Type | Description | Example |
amount* | decimal (11.2) | Amount | "3000.00" |
order_id* | string (128) | "1234" | Your id must be unique |
service* | string (100) | payment_card_sbp_rub | "payment_card_sbp_rub" |
number* | phone | Client phone | "79031112233" |
customer_code* | string (100) | Full list of banks | "100000000111" |
notification_endpoint_id | int | Notification id | 100 |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized | "https://google.com" |
Response
Name | Description |
id | AliKassa payment id |
payment_status |
Payment status wait — in the process of payment |
Создание выплат через метод "Платежный счёт"
URL | POST https://api-merchant.alikassa.com/v1/payout |
HEADER | |
Content-Type | application/json |
Account | Your account uuid, you can find in Accounts https://merchant.alikassa.com/cabinet/resources/project-accounts |
Sign | Request signature |
Name | Type | Description | Example |
amount* | decimal (11.2) | Amount | "3000.00" |
order_id* | string (128) | "1234" | Your id must be unique |
service* | string (100) | virtual_account_rub | "virtual_account_rub" |
number* | string (100) | Платежный счёт | "40817120273018899310" |
customer_code* | string (100) | Full list of banks | "100000000111" |
bik_bank* | string (100) | Бик Банка получателя | "041351902" |
notification_endpoint_id | int | Notification id | 100 |
notification_endpoint_url | string|max:255 | Link to send a callback after the statuses are finalized | "https://google.com" |
Response
Name | Description |
id | AliKassa payment id |
payment_status |
Payment status wait — in the process of payment |