Introduction
MagicPayments API
Данная документация предоставляет полное описание методов API для работы с сервисом.
Authenticating requests
To authenticate requests, include an Authorization
header with the value "Bearer {ACCESS_TOKEN}"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
You can retrieve your token by visiting your dashboard and clicking Generate API token.
Операции
Пополнение
requires authentication
Запрос на пополнение кошелька
Example request:
curl --request POST \
"https://api.magic-payments.com/api/1ed7f763-6f69-3b1d-9eca-7bc1a4b2962c/invoice" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"amount\": 1000,
\"calculate\": false,
\"tokenize_card\": true,
\"tag\": \"trusted\",
\"callback_method\": \"POST\",
\"callback_url\": \"http:\\/\\/stiedemann.com\\/\",
\"success_url\": \"http:\\/\\/www.marquardt.com\\/harum-enim-ipsum-cum-temporibus-itaque-quia\",
\"fail_url\": \"http:\\/\\/www.bartell.com\\/\",
\"card_token\": \"consectetur\",
\"payin_address\": {
\"type\": \"phone\",
\"phone\": \"79991115566\",
\"mobile_provider\": \"MTS\"
},
\"card\": {
\"pan\": \"4111111111111111\",
\"cardholder\": \"IVAN IVANOV\",
\"month\": \"01\",
\"year\": \"28\",
\"cvv\": \"123\"
},
\"addition_data\": {
\"email\": \"[email protected]\",
\"payment_system_id\": \"Sberbank\"
}
}"
const url = new URL(
"https://api.magic-payments.com/api/1ed7f763-6f69-3b1d-9eca-7bc1a4b2962c/invoice"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 1000,
"calculate": false,
"tokenize_card": true,
"tag": "trusted",
"callback_method": "POST",
"callback_url": "http:\/\/stiedemann.com\/",
"success_url": "http:\/\/www.marquardt.com\/harum-enim-ipsum-cum-temporibus-itaque-quia",
"fail_url": "http:\/\/www.bartell.com\/",
"card_token": "consectetur",
"payin_address": {
"type": "phone",
"phone": "79991115566",
"mobile_provider": "MTS"
},
"card": {
"pan": "4111111111111111",
"cardholder": "IVAN IVANOV",
"month": "01",
"year": "28",
"cvv": "123"
},
"addition_data": {
"email": "[email protected]",
"payment_system_id": "Sberbank"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/1ed7f763-6f69-3b1d-9eca-7bc1a4b2962c/invoice';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'amount' => 1000.0,
'calculate' => false,
'tokenize_card' => true,
'tag' => 'trusted',
'callback_method' => 'POST',
'callback_url' => 'http://stiedemann.com/',
'success_url' => 'http://www.marquardt.com/harum-enim-ipsum-cum-temporibus-itaque-quia',
'fail_url' => 'http://www.bartell.com/',
'card_token' => 'consectetur',
'payin_address' => [
'type' => 'phone',
'phone' => '79991115566',
'mobile_provider' => 'MTS',
],
'card' => [
'pan' => '4111111111111111',
'cardholder' => 'IVAN IVANOV',
'month' => '01',
'year' => '28',
'cvv' => '123',
],
'addition_data' => [
'email' => '[email protected]',
'payment_system_id' => 'Sberbank',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/1ed7f763-6f69-3b1d-9eca-7bc1a4b2962c/invoice'
payload = {
"amount": 1000,
"calculate": false,
"tokenize_card": true,
"tag": "trusted",
"callback_method": "POST",
"callback_url": "http:\/\/stiedemann.com\/",
"success_url": "http:\/\/www.marquardt.com\/harum-enim-ipsum-cum-temporibus-itaque-quia",
"fail_url": "http:\/\/www.bartell.com\/",
"card_token": "consectetur",
"payin_address": {
"type": "phone",
"phone": "79991115566",
"mobile_provider": "MTS"
},
"card": {
"pan": "4111111111111111",
"cardholder": "IVAN IVANOV",
"month": "01",
"year": "28",
"cvv": "123"
},
"addition_data": {
"email": "[email protected]",
"payment_system_id": "Sberbank"
}
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"status": "success",
"comission": 1,
"total": 99,
"amount": 100,
"url": "https://example.com/redirect",
"transaction": {
"currency": "RUB",
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"status_transaction": "created",
"total": 99
}
}
Example response (400):
{
"status": "error",
"error": "Данный канал не поддерживает рекуррентные платежи",
"code": "recurrent_not_supported"
}
Example response (422):
{
"status": "error",
"error": {
"amount": [
"Поле amount должно быть числом."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
status
string
Статус запроса
comission
number
Комиссия
total
number
Сумма к зачислению
amount
number
Сумма к оплате
url
string
URL для перенаправления на страницу оплаты
addition_data
object
Дополнительная информация при расчете транзакции (отсутствует если calculate=false)
payment_systems
string[]
Список платежных систем (отсутствует если calculate=false или если в настройках выключены платежные системы)
last_error
string
Описание ошибки при проведении транзакции (может быть null) (отсутствует если calculate=true)
transaction
object
Блок описания транзакции (отсутствует если calculate=true)
uuid
string
UUID транзакции
order
string
Внешний идентификатор
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
card_mask
string
Маска карты (может быть null)
payment_details
object
Реквизиты для оплаты (может быть null)
Выплата
requires authentication
Запрос выплаты на карту с кошелька
Example request:
curl --request POST \
"https://api.magic-payments.com/api/45bd3942-bf12-3ce0-a2bf-10c1a7c2feef/withdrawal" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"amount\": 3250415.07682457,
\"card\": \"4111111111111111\",
\"payout_address\": {
\"type\": \"usdt_trc20\",
\"address\": \"TCgBa3WVrrcQoBfd6bZdiFLatZ....\",
\"phone\": \"79991115566\",
\"mobile_provider\": \"MTS\"
},
\"calculate\": false,
\"tag\": \"trusted\",
\"callback_url\": \"http:\\/\\/gerlach.com\\/est-at-minima-cupiditate-doloremque-enim\",
\"callback_method\": \"POST\",
\"addition_data\": {
\"email\": \"[email protected]\",
\"cardholder\": \"IVAN IVANOV\",
\"payment_system_id\": \"Sberbank\"
}
}"
const url = new URL(
"https://api.magic-payments.com/api/45bd3942-bf12-3ce0-a2bf-10c1a7c2feef/withdrawal"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 3250415.07682457,
"card": "4111111111111111",
"payout_address": {
"type": "usdt_trc20",
"address": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"phone": "79991115566",
"mobile_provider": "MTS"
},
"calculate": false,
"tag": "trusted",
"callback_url": "http:\/\/gerlach.com\/est-at-minima-cupiditate-doloremque-enim",
"callback_method": "POST",
"addition_data": {
"email": "[email protected]",
"cardholder": "IVAN IVANOV",
"payment_system_id": "Sberbank"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/45bd3942-bf12-3ce0-a2bf-10c1a7c2feef/withdrawal';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'amount' => 3250415.07682457,
'card' => '4111111111111111',
'payout_address' => [
'type' => 'usdt_trc20',
'address' => 'TCgBa3WVrrcQoBfd6bZdiFLatZ....',
'phone' => '79991115566',
'mobile_provider' => 'MTS',
],
'calculate' => false,
'tag' => 'trusted',
'callback_url' => 'http://gerlach.com/est-at-minima-cupiditate-doloremque-enim',
'callback_method' => 'POST',
'addition_data' => [
'email' => '[email protected]',
'cardholder' => 'IVAN IVANOV',
'payment_system_id' => 'Sberbank',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/45bd3942-bf12-3ce0-a2bf-10c1a7c2feef/withdrawal'
payload = {
"amount": 3250415.07682457,
"card": "4111111111111111",
"payout_address": {
"type": "usdt_trc20",
"address": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"phone": "79991115566",
"mobile_provider": "MTS"
},
"calculate": false,
"tag": "trusted",
"callback_url": "http:\/\/gerlach.com\/est-at-minima-cupiditate-doloremque-enim",
"callback_method": "POST",
"addition_data": {
"email": "[email protected]",
"cardholder": "IVAN IVANOV",
"payment_system_id": "Sberbank"
}
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"status": "success",
"comission": 1,
"total": 99,
"amount": 100,
"transaction": {
"currency": "RUB",
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"status_transaction": "created",
"total": 99
}
}
Example response (400):
{
"status": "error",
"error": "Ошибка доступа",
"code": "access_denied"
}
Example response (422):
{
"status": "error",
"error": {
"amount": [
"Поле amount должно быть числом."
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
status
string
Статус запроса
comission
number
Комиссия
total
number
Сумма к зачислению
amount
number
Сумма к оплате
addition_data
object
Дополнительная информация при расчете транзакции (отсутствует если calculate=false)
payment_systems
string[]
Список платежных систем (отсутствует если calculate=false или если в настройках выключены платежные системы)
last_error
string
Описание ошибки при проведении транзакции (может быть null) (отсутствует если calculate=true)
transaction
object
Блок описания транзакции (отсутствует если calculate=true)
uuid
string
UUID транзакции
order
string
Внешний идентификатор
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
card_mask
string
Маска карты (может быть null)
payment_details
object
Реквизиты для оплаты (может быть null)
Статус операции
requires authentication
Запрос статуса по операции (выплата/пополнение) (транзакцию можно получить по ее uuid или по внешнему идентификатору order)
Example request:
curl --request POST \
"https://api.magic-payments.com/api/881838b0-13fd-3076-ac9c-b5b9d57b1da7/status" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
const url = new URL(
"https://api.magic-payments.com/api/881838b0-13fd-3076-ac9c-b5b9d57b1da7/status"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/881838b0-13fd-3076-ac9c-b5b9d57b1da7/status';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/881838b0-13fd-3076-ac9c-b5b9d57b1da7/status'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"currency": "RUB",
"status_transaction": "created",
"created_at": "2022-03-04T08:17:54.000000Z",
"total": "99.00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
uuid
string
UUID транзакции
order
string
Внешний идентификатор
currency
string
Валюта
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
created_at
string
Дата создания в UTC
total
number
Сумма зачисления
amount
number
Сумма заказа
last_error
string
Описание последней ошибки (может быть null)
card_mask
string
Маска карты (может быть null)
card_token
string
Токен карты для формирования рекуррентных платежей (может отсутствовать)
payment_details
object
Реквизиты для оплаты (может быть null)
Refund
requires authentication
Оформить refund по операции. В ответ возвращается refund транзакция.
Example request:
curl --request POST \
"https://api.magic-payments.com/api/4083054e-0e62-3fad-a5ce-79f8e02e0725/refund" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
const url = new URL(
"https://api.magic-payments.com/api/4083054e-0e62-3fad-a5ce-79f8e02e0725/refund"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/4083054e-0e62-3fad-a5ce-79f8e02e0725/refund';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/4083054e-0e62-3fad-a5ce-79f8e02e0725/refund'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"currency": "RUB",
"status_transaction": "created",
"created_at": "2022-03-04T08:17:54.000000Z",
"total": "99.00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
uuid
string
UUID транзакции
order
string
Внешний идентификатор
currency
string
Валюта
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
created_at
string
Дата создания в UTC
total
number
Сумма зачисления
amount
number
Сумма заказа
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Chargeback
requires authentication
Оформить chargeback по операции. В ответ возвращается chargeback транзакция.
Example request:
curl --request POST \
"https://api.magic-payments.com/api/bc6ade11-7e5b-32e5-a469-2d87c9798e69/chargeback" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"arn\": null
}"
const url = new URL(
"https://api.magic-payments.com/api/bc6ade11-7e5b-32e5-a469-2d87c9798e69/chargeback"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"arn": null
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/bc6ade11-7e5b-32e5-a469-2d87c9798e69/chargeback';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'arn' => null,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/bc6ade11-7e5b-32e5-a469-2d87c9798e69/chargeback'
payload = {
"arn": null
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"currency": "RUB",
"status_transaction": "created",
"created_at": "2022-03-04T08:17:54.000000Z",
"total": "99.00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
uuid
string
UUID транзакции
order
string
Внешний идентификатор
currency
string
Валюта
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
created_at
string
Дата создания в UTC
total
number
Сумма зачисления
amount
number
Сумма заказа
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Отправка дополнительных параметров по транзакции
requires authentication
Дополнительные поля: UZS: sms_code
Example request:
curl --request POST \
"https://api.magic-payments.com/api/8c6c876d-6331-3c38-b998-32ccaf4c67db/additional_data" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"addition_data\": []
}"
const url = new URL(
"https://api.magic-payments.com/api/8c6c876d-6331-3c38-b998-32ccaf4c67db/additional_data"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"addition_data": []
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/8c6c876d-6331-3c38-b998-32ccaf4c67db/additional_data';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'addition_data' => [],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/8c6c876d-6331-3c38-b998-32ccaf4c67db/additional_data'
payload = {
"addition_data": []
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"currency": "RUB",
"status_transaction": "created",
"created_at": "2022-03-04T08:17:54.000000Z",
"total": "99.00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
uuid
string
UUID транзакции
order
string
Внешний идентификатор
currency
string
Валюта
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
created_at
string
Дата создания в UTC
total
number
Сумма зачисления
amount
number
Сумма заказа
last_error
string
Описание последней ошибки (может быть null)
card_mask
string
Маска карты (может быть null)
payment_details
object
Реквизиты для оплаты (может быть null)
Оплата счета
requires authentication
Отправка чека и реквизитов плательщика по оплаченному счету
Example request:
curl --request POST \
"https://api.magic-payments.com/api/fef146d4-1ef2-3ece-9d52-de2f5e9847bb/paid" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"receipt\": {
\"sender\": \"Иван Иванович 4432\",
\"file_extension\": \"jpg\",
\"file_name\": \"image\"
}
}"
const url = new URL(
"https://api.magic-payments.com/api/fef146d4-1ef2-3ece-9d52-de2f5e9847bb/paid"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"receipt": {
"sender": "Иван Иванович 4432",
"file_extension": "jpg",
"file_name": "image"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/fef146d4-1ef2-3ece-9d52-de2f5e9847bb/paid';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'receipt' => [
'sender' => 'Иван Иванович 4432',
'file_extension' => 'jpg',
'file_name' => 'image',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/fef146d4-1ef2-3ece-9d52-de2f5e9847bb/paid'
payload = {
"receipt": {
"sender": "Иван Иванович 4432",
"file_extension": "jpg",
"file_name": "image"
}
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200):
{
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"currency": "RUB",
"status_transaction": "created",
"created_at": "2022-03-04T08:17:54.000000Z",
"total": "99.00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
uuid
string
UUID транзакции
order
string
Внешний идентификатор
currency
string
Валюта
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
created_at
string
Дата создания в UTC
total
number
Сумма зачисления
amount
number
Сумма заказа
last_error
string
Описание последней ошибки (может быть null)
card_mask
string
Маска карты (может быть null)
payment_details
object
Реквизиты для оплаты (может быть null)
Отмена оплаты по счету
requires authentication
Example request:
curl --request POST \
"https://api.magic-payments.com/api/a6a85dfb-2ec5-34df-9778-0550a7a2f042/cancel" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
const url = new URL(
"https://api.magic-payments.com/api/a6a85dfb-2ec5-34df-9778-0550a7a2f042/cancel"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/a6a85dfb-2ec5-34df-9778-0550a7a2f042/cancel';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/a6a85dfb-2ec5-34df-9778-0550a7a2f042/cancel'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"uuid": "5a01ba3f-0170-4abd-9b60-f1879f4804c6",
"order": "73450234",
"currency": "RUB",
"status_transaction": "created",
"created_at": "2022-03-04T08:17:54.000000Z",
"total": "99.00"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
uuid
string
UUID транзакции
order
string
Внешний идентификатор
currency
string
Валюта
status_transaction
string
Статус транзакции (created - создан, working - в обработке, completed - исполнен, error - ошибка)
created_at
string
Дата создания в UTC
total
number
Сумма зачисления
amount
number
Сумма заказа
last_error
string
Описание последней ошибки (может быть null)
card_mask
string
Маска карты (может быть null)
payment_details
object
Реквизиты для оплаты (может быть null)
Профиль
Профиль
requires authentication
Получение информации по всем кошелькам
Example request:
curl --request GET \
--get "https://api.magic-payments.com/api/profile" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://api.magic-payments.com/api/profile"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/profile';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/profile'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
[
{
"uuid": "52a38a2b-fe45-45c8-850c-11f02d7d1620",
"currency": "RUB",
"balance": "800.00"
},
{
"uuid": "18ec8ec9-ebc0-494b-9871-eabef9404375",
"currency": "USD",
"balance": "100.00"
}
]
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Баланс
requires authentication
Получение баланса кошелька В блоке detailed перечислены балансы: active - активный баланс (транзакции в статусах Выполнен); current - текущий баланс (транзакции в статусах Создан, В обработке, Выполнен); frozen - ролинг-резерв (транзакции с типом Rolling Reserve); payout - выплатной баланс (баланс, доступный для проведения выплат);
Example request:
curl --request GET \
--get "https://api.magic-payments.com/api/912a09a4-af75-3e6d-b361-68a765121e33/balance" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://api.magic-payments.com/api/912a09a4-af75-3e6d-b361-68a765121e33/balance"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/912a09a4-af75-3e6d-b361-68a765121e33/balance';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/912a09a4-af75-3e6d-b361-68a765121e33/balance'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"uuid": "52a38a2b-fe45-45c8-850c-11f02d7d1620",
"currency": "RUB",
"balance": "800.00",
"detailed": {
"active": "800.00",
"current": "800.00",
"frozen": "0.00",
"payout": "500.00"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Транзакции
requires authentication
Получение транзакций за период (используется пагинация)
Example request:
curl --request GET \
--get "https://api.magic-payments.com/api/dc539ee8-377d-3669-9a72-1f3cbd7dce53/history" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://api.magic-payments.com/api/dc539ee8-377d-3669-9a72-1f3cbd7dce53/history"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/dc539ee8-377d-3669-9a72-1f3cbd7dce53/history';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/dc539ee8-377d-3669-9a72-1f3cbd7dce53/history'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200):
{
"current_page": 1,
"data": [
{
"uuid": "d6a2f3a4-59f2-4a23-a663-e2908bf18020",
"currency": "RUB",
"status_transaction": "created",
"created_at": "2022-03-04T08:17:54.000000Z",
"amount": "10342.22"
},
{
"uuid": "72f9b70c-e51f-4377-8040-77b3a0b0fcd0",
"currency": "RUB",
"status_transaction": "working",
"created_at": "2022-03-04T08:16:54.000000Z",
"amount": "194.45"
},
{
"uuid": "af2c715a-953c-405c-b755-2a11a89a3dad",
"currency": "RUB",
"status_transaction": "completed",
"created_at": "2022-03-04T08:15:54.000000Z",
"amount": "99.00"
},
],
"first_page_url": "http://example.com/api/52a38a2b-fe45-45c8-850c-11f02d7d1620/history?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://example.com/api/52a38a2b-fe45-45c8-850c-11f02d7d1620/history?page=1",
"next_page_url": null,
"path": "http://example.com/api/52a38a2b-fe45-45c8-850c-11f02d7d1620/history",
"per_page": 50,
"prev_page_url": null,
"to": 20,
"total": 20
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
current_page
integer
Текущая страница пагинации
data
object[]
Список транзакций
from
integer
Отображение записи с номера
to
integer
Отображение записи до номера
total
integer
Количество записей всего