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/2dc173bc-fc37-39ec-b7f9-089728ea857c/invoice" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"amount\": 1000,
\"currency\": \"USD\",
\"calculate\": false,
\"tokenize_card\": false,
\"tag\": \"trusted\",
\"callback_method\": \"POST\",
\"callback_url\": \"https:\\/\\/kuhlman.biz\\/ea-qui-maiores-repellat-eos-quia-aut.html\",
\"success_url\": \"http:\\/\\/mosciski.com\\/beatae-accusantium-ipsum-laboriosam-non\",
\"fail_url\": \"http:\\/\\/wilderman.com\\/animi-aut-et-nesciunt-culpa-molestiae-ut\",
\"card_token\": \"blanditiis\",
\"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/2dc173bc-fc37-39ec-b7f9-089728ea857c/invoice"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 1000,
"currency": "USD",
"calculate": false,
"tokenize_card": false,
"tag": "trusted",
"callback_method": "POST",
"callback_url": "https:\/\/kuhlman.biz\/ea-qui-maiores-repellat-eos-quia-aut.html",
"success_url": "http:\/\/mosciski.com\/beatae-accusantium-ipsum-laboriosam-non",
"fail_url": "http:\/\/wilderman.com\/animi-aut-et-nesciunt-culpa-molestiae-ut",
"card_token": "blanditiis",
"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/2dc173bc-fc37-39ec-b7f9-089728ea857c/invoice';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'amount' => 1000.0,
'currency' => 'USD',
'calculate' => false,
'tokenize_card' => false,
'tag' => 'trusted',
'callback_method' => 'POST',
'callback_url' => 'https://kuhlman.biz/ea-qui-maiores-repellat-eos-quia-aut.html',
'success_url' => 'http://mosciski.com/beatae-accusantium-ipsum-laboriosam-non',
'fail_url' => 'http://wilderman.com/animi-aut-et-nesciunt-culpa-molestiae-ut',
'card_token' => 'blanditiis',
'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/2dc173bc-fc37-39ec-b7f9-089728ea857c/invoice'
payload = {
"amount": 1000,
"currency": "USD",
"calculate": false,
"tokenize_card": false,
"tag": "trusted",
"callback_method": "POST",
"callback_url": "https:\/\/kuhlman.biz\/ea-qui-maiores-repellat-eos-quia-aut.html",
"success_url": "http:\/\/mosciski.com\/beatae-accusantium-ipsum-laboriosam-non",
"fail_url": "http:\/\/wilderman.com\/animi-aut-et-nesciunt-culpa-molestiae-ut",
"card_token": "blanditiis",
"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/a206943c-4e4a-335e-ba1e-4a7558fd8e45/withdrawal" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"amount\": 0.289968,
\"currency\": \"USD\",
\"card\": \"4111111111111111\",
\"payout_address\": {
\"type\": \"usdt_trc20\",
\"address\": \"TCgBa3WVrrcQoBfd6bZdiFLatZ....\",
\"wallet\": \"TCgBa3WVrrcQoBfd6bZdiFLatZ....\",
\"bank_account\": \"912723874....\",
\"phone\": \"79991115566\",
\"mobile_provider\": \"MTS, 1000000112\"
},
\"calculate\": false,
\"tag\": \"trusted\",
\"callback_url\": \"http:\\/\\/www.champlin.org\\/modi-debitis-et-molestiae-repudiandae\",
\"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/a206943c-4e4a-335e-ba1e-4a7558fd8e45/withdrawal"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": 0.289968,
"currency": "USD",
"card": "4111111111111111",
"payout_address": {
"type": "usdt_trc20",
"address": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"wallet": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"bank_account": "912723874....",
"phone": "79991115566",
"mobile_provider": "MTS, 1000000112"
},
"calculate": false,
"tag": "trusted",
"callback_url": "http:\/\/www.champlin.org\/modi-debitis-et-molestiae-repudiandae",
"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/a206943c-4e4a-335e-ba1e-4a7558fd8e45/withdrawal';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'amount' => 0.289968,
'currency' => 'USD',
'card' => '4111111111111111',
'payout_address' => [
'type' => 'usdt_trc20',
'address' => 'TCgBa3WVrrcQoBfd6bZdiFLatZ....',
'wallet' => 'TCgBa3WVrrcQoBfd6bZdiFLatZ....',
'bank_account' => '912723874....',
'phone' => '79991115566',
'mobile_provider' => 'MTS, 1000000112',
],
'calculate' => false,
'tag' => 'trusted',
'callback_url' => 'http://www.champlin.org/modi-debitis-et-molestiae-repudiandae',
'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/a206943c-4e4a-335e-ba1e-4a7558fd8e45/withdrawal'
payload = {
"amount": 0.289968,
"currency": "USD",
"card": "4111111111111111",
"payout_address": {
"type": "usdt_trc20",
"address": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"wallet": "TCgBa3WVrrcQoBfd6bZdiFLatZ....",
"bank_account": "912723874....",
"phone": "79991115566",
"mobile_provider": "MTS, 1000000112"
},
"calculate": false,
"tag": "trusted",
"callback_url": "http:\/\/www.champlin.org\/modi-debitis-et-molestiae-repudiandae",
"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/ee4c1921-1d87-3e84-8c1e-cbef6f2c21ae/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/ee4c1921-1d87-3e84-8c1e-cbef6f2c21ae/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/ee4c1921-1d87-3e84-8c1e-cbef6f2c21ae/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/ee4c1921-1d87-3e84-8c1e-cbef6f2c21ae/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/1d5953d4-e85f-31ce-8c52-e89d53c5acd2/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/1d5953d4-e85f-31ce-8c52-e89d53c5acd2/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/1d5953d4-e85f-31ce-8c52-e89d53c5acd2/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/1d5953d4-e85f-31ce-8c52-e89d53c5acd2/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/86a035f8-c646-3edb-bf77-54e252946a47/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/86a035f8-c646-3edb-bf77-54e252946a47/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/86a035f8-c646-3edb-bf77-54e252946a47/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/86a035f8-c646-3edb-bf77-54e252946a47/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/42133b3f-791e-3ef2-9cf1-a0b059d57d2f/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/42133b3f-791e-3ef2-9cf1-a0b059d57d2f/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/42133b3f-791e-3ef2-9cf1-a0b059d57d2f/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/42133b3f-791e-3ef2-9cf1-a0b059d57d2f/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/773f0039-2ed1-33ac-adfe-5d2fe211a6e9/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/773f0039-2ed1-33ac-adfe-5d2fe211a6e9/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/773f0039-2ed1-33ac-adfe-5d2fe211a6e9/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/773f0039-2ed1-33ac-adfe-5d2fe211a6e9/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/4e4d6bc5-cb33-309c-9dcd-a1ec40fb7f80/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/4e4d6bc5-cb33-309c-9dcd-a1ec40fb7f80/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/4e4d6bc5-cb33-309c-9dcd-a1ec40fb7f80/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/4e4d6bc5-cb33-309c-9dcd-a1ec40fb7f80/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/f15f094b-a32c-3e8e-a861-5949fcc095ef/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/f15f094b-a32c-3e8e-a861-5949fcc095ef/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/f15f094b-a32c-3e8e-a861-5949fcc095ef/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/f15f094b-a32c-3e8e-a861-5949fcc095ef/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/d10f95b2-118b-37a1-a6e6-a86b95b8b46b/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/d10f95b2-118b-37a1-a6e6-a86b95b8b46b/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/d10f95b2-118b-37a1-a6e6-a86b95b8b46b/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/d10f95b2-118b-37a1-a6e6-a86b95b8b46b/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/5c61a34e-f300-35ed-a865-91f09eb4fd8e/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/5c61a34e-f300-35ed-a865-91f09eb4fd8e/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/5c61a34e-f300-35ed-a865-91f09eb4fd8e/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/5c61a34e-f300-35ed-a865-91f09eb4fd8e/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/26ef3326-67b1-32e8-8b01-2e871936787a/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/26ef3326-67b1-32e8-8b01-2e871936787a/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/26ef3326-67b1-32e8-8b01-2e871936787a/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/26ef3326-67b1-32e8-8b01-2e871936787a/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/5c51673e-03c7-352e-929d-23cb6819bc68/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/5c51673e-03c7-352e-929d-23cb6819bc68/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/5c51673e-03c7-352e-929d-23cb6819bc68/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/5c51673e-03c7-352e-929d-23cb6819bc68/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
Количество записей всего