Introduction
MagicPayments API
Данная документация предоставляет полное описание методов API для работы с сервисом.
Gate Invoice
- Пользователь вводит сумму и данные карты и отправляет запрос на создание инвойса мерчанту
- Мерчант создает инвойс через
/api/{wallet_id}/invoice
- Мерчант разбирает ответ от MagicPayments:
- Если
http_code == 200 и data.status == 'success'
: инвойс создан успешно, перенаправить клиента по ссылкеdata.url
- Если
(http_code >= 400 и http_code < 500) и data.status == 'error'
: причина ошибки передается в полеdata.error
. Инвойс считать неуспешным. Сообщить пользователю об ошибке - Если таймаут: считать инвойс неуспешным. Внимание: это возможно только при гейт-интеграции. Сообщить пользователю об ошибке
- Если
http_code >= 500
: считать инвойс неуспешным. Сообщить пользователю об ошибке
- Если
- Мерчант отвечает пользователю ссылкой для редиректа или ошибкой
- При получении колбека по инвойсу мерчант обновляет его статус
Payout
- Пользователь вводит сумму и отправляет запрос на создание выплаты мерчанту
- Мерчант создает выплату через
/api/{wallet_id}/withdraw
- Мерчант разбирает ответ от MagicPayments:
- Если
http_code == 200 и data.status == 'success'
: выплата создана успешно. Сообщить пользователю. Внимание: в ответе может прийти сразу как финальным статус (в этом случае никаких дальнейших изменений с выплатой не предполагается), так и промежуточный (в этом случае при изменении статуса придет колбек) - Если
(http_code >= 400 и http_code < 500) и data.status == 'error'
: причина ошибки передается в полеdata.error
. Выплату считать неуспешной. Сообщить пользователю об ошибке - Если таймаут: считать выплату созданной. Запросить актуальный статус через
/status
поorder_id
или обратиться в поддержку MagicPayments для уточнения статуса - Если
http_code >= 500
: считать выплату неуспешной. Сообщить пользователю об ошибке
- Если
- При получении колбека по выплате мерчант обновляет ее статус
Аутентификация запросов
Для аутентификации запросов включите заголовок Authorization
со значением "Bearer {ACCESS_TOKEN}"
.
Все методы которые требуют авторизации помечены значком "requires authentication"
в документации ниже.
Операции
Пополнение
requires authentication
Запрос на пополнение кошелька
Example request:
curl --request POST \
"https://api.magic-payments.com/api/0eae84d3-b5f9-34f0-9b02-8d14e237fd98/invoice" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"amount\": 1000,
\"currency\": \"USD\",
\"calculate\": true,
\"tokenize_card\": true,
\"tag\": \"trusted\",
\"callback_method\": \"POST\",
\"callback_url\": \"http:\\/\\/www.keeling.com\\/odio-adipisci-labore-perferendis-quia.html\",
\"success_url\": \"http:\\/\\/gusikowski.com\\/quae-excepturi-atque-nobis-quis.html\",
\"fail_url\": \"http:\\/\\/www.daugherty.net\\/reprehenderit-amet-rerum-quos-dolor.html\",
\"card_token\": \"nisi\",
\"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/0eae84d3-b5f9-34f0-9b02-8d14e237fd98/invoice"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 1000,
"currency": "USD",
"calculate": true,
"tokenize_card": true,
"tag": "trusted",
"callback_method": "POST",
"callback_url": "http:\/\/www.keeling.com\/odio-adipisci-labore-perferendis-quia.html",
"success_url": "http:\/\/gusikowski.com\/quae-excepturi-atque-nobis-quis.html",
"fail_url": "http:\/\/www.daugherty.net\/reprehenderit-amet-rerum-quos-dolor.html",
"card_token": "nisi",
"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/0eae84d3-b5f9-34f0-9b02-8d14e237fd98/invoice';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'amount' => 1000.0,
'currency' => 'USD',
'calculate' => true,
'tokenize_card' => true,
'tag' => 'trusted',
'callback_method' => 'POST',
'callback_url' => 'http://www.keeling.com/odio-adipisci-labore-perferendis-quia.html',
'success_url' => 'http://gusikowski.com/quae-excepturi-atque-nobis-quis.html',
'fail_url' => 'http://www.daugherty.net/reprehenderit-amet-rerum-quos-dolor.html',
'card_token' => 'nisi',
'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/0eae84d3-b5f9-34f0-9b02-8d14e237fd98/invoice'
payload = {
"amount": 1000,
"currency": "USD",
"calculate": true,
"tokenize_card": true,
"tag": "trusted",
"callback_method": "POST",
"callback_url": "http:\/\/www.keeling.com\/odio-adipisci-labore-perferendis-quia.html",
"success_url": "http:\/\/gusikowski.com\/quae-excepturi-atque-nobis-quis.html",
"fail_url": "http:\/\/www.daugherty.net\/reprehenderit-amet-rerum-quos-dolor.html",
"card_token": "nisi",
"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": 12.5,
"total": 487.5,
"amount": 500,
"url": "https://example.com/redirect",
"transaction": {
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
}
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 транзакции
currency
string
Код валюты в ISO 4217
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/73384f2b-c1f2-3919-9cfd-42cb2fddeb77/withdrawal" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"amount\": 211094519.08,
\"currency\": \"USD\",
\"card\": \"4111111111111111\",
\"payout_address\": {
\"type\": \"usdt_trc20\",
\"address\": \"TCgBa3WVrrcQoBfd6bZdiFLatZ....\",
\"wallet\": \"TCgBa3WVrrcQoBfd6bZdiFLatZ....\",
\"phone\": \"79991115566\",
\"mobile_provider\": \"MTS\"
},
\"calculate\": true,
\"tag\": \"trusted\",
\"callback_url\": \"http:\\/\\/aufderhar.com\\/ipsum-repellendus-fugit-accusantium-placeat-distinctio-culpa-dignissimos-molestiae\",
\"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/73384f2b-c1f2-3919-9cfd-42cb2fddeb77/withdrawal"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 211094519.08,
"currency": "USD",
"card": "4111111111111111",
"payout_address": {
"type": "usdt_trc20",
"address": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"wallet": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"phone": "79991115566",
"mobile_provider": "MTS"
},
"calculate": true,
"tag": "trusted",
"callback_url": "http:\/\/aufderhar.com\/ipsum-repellendus-fugit-accusantium-placeat-distinctio-culpa-dignissimos-molestiae",
"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/73384f2b-c1f2-3919-9cfd-42cb2fddeb77/withdrawal';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'amount' => 211094519.08,
'currency' => 'USD',
'card' => '4111111111111111',
'payout_address' => [
'type' => 'usdt_trc20',
'address' => 'TCgBa3WVrrcQoBfd6bZdiFLatZ....',
'wallet' => 'TCgBa3WVrrcQoBfd6bZdiFLatZ....',
'phone' => '79991115566',
'mobile_provider' => 'MTS',
],
'calculate' => true,
'tag' => 'trusted',
'callback_url' => 'http://aufderhar.com/ipsum-repellendus-fugit-accusantium-placeat-distinctio-culpa-dignissimos-molestiae',
'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/73384f2b-c1f2-3919-9cfd-42cb2fddeb77/withdrawal'
payload = {
"amount": 211094519.08,
"currency": "USD",
"card": "4111111111111111",
"payout_address": {
"type": "usdt_trc20",
"address": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"wallet": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"phone": "79991115566",
"mobile_provider": "MTS"
},
"calculate": true,
"tag": "trusted",
"callback_url": "http:\/\/aufderhar.com\/ipsum-repellendus-fugit-accusantium-placeat-distinctio-culpa-dignissimos-molestiae",
"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": 12.5,
"total": 487.5,
"amount": 500,
"transaction": {
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
}
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
Внешний идентификатор
currency
string
Код валюты в ISO 4217
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/deae37b2-0246-3ed5-8cbd-d33eb1717697/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/deae37b2-0246-3ed5-8cbd-d33eb1717697/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/deae37b2-0246-3ed5-8cbd-d33eb1717697/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/deae37b2-0246-3ed5-8cbd-d33eb1717697/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):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Refund
requires authentication
Оформить refund по операции. В ответ возвращается refund транзакция.
Example request:
curl --request POST \
"https://api.magic-payments.com/api/e427f173-9dbd-3459-86f8-acc9a1190b51/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/e427f173-9dbd-3459-86f8-acc9a1190b51/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/e427f173-9dbd-3459-86f8-acc9a1190b51/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/e427f173-9dbd-3459-86f8-acc9a1190b51/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):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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/c1069307-328d-3312-8b55-d894a9b813d8/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/c1069307-328d-3312-8b55-d894a9b813d8/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/c1069307-328d-3312-8b55-d894a9b813d8/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/c1069307-328d-3312-8b55-d894a9b813d8/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):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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/e7f0876c-f8f8-3eb0-bb12-ed21848a54c4/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/e7f0876c-f8f8-3eb0-bb12-ed21848a54c4/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/e7f0876c-f8f8-3eb0-bb12-ed21848a54c4/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/e7f0876c-f8f8-3eb0-bb12-ed21848a54c4/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):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Оплата счета
requires authentication
Отправка чека и реквизитов плательщика по оплаченному счету
Example request:
curl --request POST \
"https://api.magic-payments.com/api/3079abaf-fc22-39ab-a79f-024ddd9e83bc/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/3079abaf-fc22-39ab-a79f-024ddd9e83bc/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/3079abaf-fc22-39ab-a79f-024ddd9e83bc/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/3079abaf-fc22-39ab-a79f-024ddd9e83bc/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):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Отмена оплаты по счету
requires authentication
Example request:
curl --request POST \
"https://api.magic-payments.com/api/f66cb70d-0d5a-37ec-b4ee-8383a7469f32/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/f66cb70d-0d5a-37ec-b4ee-8383a7469f32/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/f66cb70d-0d5a-37ec-b4ee-8383a7469f32/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/f66cb70d-0d5a-37ec-b4ee-8383a7469f32/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):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Начать спор по пополнению
requires authentication
Example request:
curl --request POST \
"https://api.magic-payments.com/api/5769a08f-80ba-3175-a9a5-669aa8fa46d2/dispute" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
const url = new URL(
"https://api.magic-payments.com/api/5769a08f-80ba-3175-a9a5-669aa8fa46d2/dispute"
);
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/5769a08f-80ba-3175-a9a5-669aa8fa46d2/dispute';
$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/5769a08f-80ba-3175-a9a5-669aa8fa46d2/dispute'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Получение сообщений по спору
requires authentication
Example request:
curl --request POST \
"https://api.magic-payments.com/api/b10afab4-99c7-3be0-aee9-bf19cf15e72e/dispute/messages" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
const url = new URL(
"https://api.magic-payments.com/api/b10afab4-99c7-3be0-aee9-bf19cf15e72e/dispute/messages"
);
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/b10afab4-99c7-3be0-aee9-bf19cf15e72e/dispute/messages';
$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/b10afab4-99c7-3be0-aee9-bf19cf15e72e/dispute/messages'
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()
Example response (200):
[
{
"created_at": "2024-01-01T12:00:00Z",
"direction": "INCOME",
"type": "TEXT",
"message": "Не пришли деньги"
},
{
"created_at": "2024-01-01T12:01:00Z",
"type": "IMAGE",
"direction": "INCOME",
"base64_content": "0L/RgNC40LzQtdGA",
"filename": "photo",
"extension": ".jpg"
},
{
"created_at": "2024-01-01T12:03:00Z",
"direction": "OUTCOME",
"type": "TEXT",
"message": "Разобрались"
}
]
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
data
object[]
Список транзакций
created_at
string
Дата создания
type
string
Тип сообщения. Возможные значения: IMAGE - изображение, TEXT - сообщение
direction
string
Направление сообщения. Возможные значения: INCOME - входящие, OUTCOME - исходящие
message
string
Текст сообщения. Обязательно, если type = TEXT
base64_content
string
Изображение в кодировке base64. Обязательно, если type = IMAGE
filename
string
Название файла. Обязательно, если type = IMAGE
extension
string
Тип файла. Обязательно, если type = IMAGE
Отправка сообщения по спору
requires authentication
Example request:
curl --request POST \
"https://api.magic-payments.com/api/6f110b89-ce3c-3963-a42c-536e4808c207/dispute/messages/send" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"message\": {
\"type\": \"image\",
\"message\": \"Не пришли деньги\",
\"base64_content\": \"0L\\/RgNC40LzQtdGA\",
\"filename\": \"photo\",
\"extension\": \".jpg\"
}
}"
const url = new URL(
"https://api.magic-payments.com/api/6f110b89-ce3c-3963-a42c-536e4808c207/dispute/messages/send"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"message": {
"type": "image",
"message": "Не пришли деньги",
"base64_content": "0L\/RgNC40LzQtdGA",
"filename": "photo",
"extension": ".jpg"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://api.magic-payments.com/api/6f110b89-ce3c-3963-a42c-536e4808c207/dispute/messages/send';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'message' => [
'type' => 'image',
'message' => 'Не пришли деньги',
'base64_content' => '0L/RgNC40LzQtdGA',
'filename' => 'photo',
'extension' => '.jpg',
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.magic-payments.com/api/6f110b89-ce3c-3963-a42c-536e4808c207/dispute/messages/send'
payload = {
"message": {
"type": "image",
"message": "Не пришли деньги",
"base64_content": "0L\/RgNC40LzQtdGA",
"filename": "photo",
"extension": ".jpg"
}
}
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):
{
"currency": "RUB",
"order": "73450234",
"uuid": "26549f4f-fcea-44bb-a65b-f4bf2ae78aea",
"created_at": "2024-01-26T09:59:01.000000Z",
"status_transaction": "created",
"total": 487.5,
"amount": 500,
"type_alias": "payin",
"card_mask": null
}
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
Код валюты в ISO 4217
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)
type_alias
string
Тип транзакции (payin - пополнение, payout - выплата, refund - Refund, chargeback - Chargeback)
Профиль
Профиль
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/42623128-dc32-3e91-a5ef-0fbdb8472207/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/42623128-dc32-3e91-a5ef-0fbdb8472207/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/42623128-dc32-3e91-a5ef-0fbdb8472207/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/42623128-dc32-3e91-a5ef-0fbdb8472207/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/3915eb3f-964c-3b60-a922-cb2cbf364ba0/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/3915eb3f-964c-3b60-a922-cb2cbf364ba0/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/3915eb3f-964c-3b60-a922-cb2cbf364ba0/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/3915eb3f-964c-3b60-a922-cb2cbf364ba0/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
Количество записей всего