API Description
Complete Guide to Integration with MoonlightPay Payment Gateway
General principles of working with the API
The API is a custom RPC protocol based on HTTP.All requests are made using the POST method and all parameters are passed in the HTTP request body.The called API method is passed in the URL, nothing else is passed in the URL.Headers Content-Type
and Accept
are also required to transmit the request format and desired response.Currently only application/json
format is supported.Transmitting any other format or the absence of these headers in the request will result in an error.
Requests signature
Each request must contain a "sign"
field containing the request signature.The signature is a simple md5 hash of the concatenation of the entity identifier to which the request is made and the secret key, which is unique for each client.
The following identifiers can participate in signature calculation:
transaction - transaction identifier. Used in requests related to a specific transaction, such as auto-payments or refunds.
product - the client's point of sale identifier. Used in payment creation requests.
client - the client's own identifier. Used in payout requests, balance retrieval, and other requests not tied to a specific transaction or client's point of sale.
The secret key can be found in the "settings" section of the personal account, you can also change it there.
Examples of signature calculation in different programming languages can be seen below.
Signature calculation examples
<?php
$secretKey = 'o87z5off7u0v2rw';
// Пример для платежа (product + secretKey)
$product = '2';
$sign = md5($product . $secretKey);
// Пример для автоплатежа/возврата (transaction + secretKey)
$transaction = '32131';
$sign = md5($transaction . $secretKey);
// Пример для баланса/выплат (client + secretKey)
$client = '1';
$sign = md5($client . $secretKey);
?>
import hashlib
secret_key = "o87z5off7u0v2rw"
# Пример для платежа (product + secretKey)
product = "2"
sign = hashlib.md5((product + secret_key).encode()).hexdigest()
# Пример для автоплатежа/возврата (transaction + secretKey)
transaction = "32131"
sign = hashlib.md5((transaction + secret_key).encode()).hexdigest()
# Пример для баланса/выплат (client + secretKey)
client = "1"
sign = hashlib.md5((client + secret_key).encode()).hexdigest()
require 'digest'
secret_key = "o87z5off7u0v2rw"
# Пример для платежа (product + secretKey)
product = "2"
sign = Digest::MD5.hexdigest(product + secret_key)
# Пример для автоплатежа/возврата (transaction + secretKey)
transaction = "32131"
sign = Digest::MD5.hexdigest(transaction + secret_key)
# Пример для баланса/выплат (client + secretKey)
client = "1"
sign = Digest::MD5.hexdigest(client + secret_key)
const crypto = require('crypto');
const secretKey = 'o87z5off7u0v2rw';
// Пример для платежа (product + secretKey)
const product = '2';
const sign = crypto.createHash('md5').update(product + secretKey).digest('hex');
// Пример для автоплатежа/возврата (transaction + secretKey)
const transaction = '32131';
const sign = crypto.createHash('md5').update(transaction + secretKey).digest('hex');
// Пример для баланса/выплат (client + secretKey)
const client = '1';
const sign = crypto.createHash('md5').update(client + secretKey).digest('hex');
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class SignatureGenerator {
public static String generateSign(String identifier, String secretKey) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
String input = identifier + secretKey;
byte[] hash = md.digest(input.getBytes());
StringBuilder hexString = new StringBuilder();
for (byte b : hash) {
String hex = Integer.toHexString(0xff & b);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
public static void main(String[] args) {
String secretKey = "o87z5off7u0v2rw";
// Пример для платежа (product + secretKey)
String product = "2";
String sign = generateSign(product, secretKey);
// Пример для автоплатежа/возврата (transaction + secretKey)
String transaction = "32131";
String signTransaction = generateSign(transaction, secretKey);
// Пример для баланса/выплат (client + secretKey)
String client = "1";
String signClient = generateSign(client, secretKey);
}
}
import java.security.MessageDigest
fun generateSign(identifier: String, secretKey: String): String {
val input = identifier + secretKey
val md = MessageDigest.getInstance("MD5")
val hash = md.digest(input.toByteArray())
return hash.joinToString("") { "%02x".format(it) }
}
fun main() {
val secretKey = "o87z5off7u0v2rw"
// Пример для платежа (product + secretKey)
val product = "2"
val sign = generateSign(product, secretKey)
// Пример для автоплатежа/возврата (transaction + secretKey)
val transaction = "32131"
val signTransaction = generateSign(transaction, secretKey)
// Пример для баланса/выплат (client + secretKey)
val client = "1"
val signClient = generateSign(client, secretKey)
}
using System;
using System.Security.Cryptography;
using System.Text;
public class SignatureGenerator
{
public static string GenerateSign(string identifier, string secretKey)
{
string input = identifier + secretKey;
using (MD5 md5 = MD5.Create())
{
byte[] hash = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
}
}
public static void Main()
{
string secretKey = "o87z5off7u0v2rw";
// Пример для платежа (product + secretKey)
string product = "2";
string sign = GenerateSign(product, secretKey);
// Пример для автоплатежа/возврата (transaction + secretKey)
string transaction = "32131";
string signTransaction = GenerateSign(transaction, secretKey);
// Пример для баланса/выплат (client + secretKey)
string client = "1";
string signClient = GenerateSign(client, secretKey);
}
}
package main
import (
"crypto/md5"
"fmt"
)
func generateSign(identifier, secretKey string) string {
input := identifier + secretKey
hash := md5.Sum([]byte(input))
return fmt.Sprintf("%x", hash)
}
func main() {
secretKey := "o87z5off7u0v2rw"
// Пример для платежа (product + secretKey)
product := "2"
sign := generateSign(product, secretKey)
// Пример для автоплатежа/возврата (transaction + secretKey)
transaction := "32131"
signTransaction := generateSign(transaction, secretKey)
// Пример для баланса/выплат (client + secretKey)
client := "1"
signClient := generateSign(client, secretKey)
}
Response format and statuses
The response body will contain business data directly: an object or collection of objects. There are no response codes, metadata, or wrappers for business data. All metadata is passed in headers, and HTTP status codes are used as response codes:
200
- Successful request to retrieve or update data201
- Successful creation of a new entity400
- Request validation error403
- Access to the operation denied404
- API method not found405
- Unsupported HTTP method (POST required)406
- Request is missing Accept header or unsupported data format is specified415
- Request is missing Content-Type header or unsupported data type is specified500
- Error executing the request on the server side. Possible reasons: gateway error, payment rejection by the bank, etc.
Error codes
If an error occurs (HTTP code 4xx or 5xx is returned) - the response will contain a specific error code and a brief explanation.The specific code consists of two digits, the first of which is grouping, and the second is specifying.
Grouping codes:
0x
- Technical errors that occur due to incorrect operation of the payment gateway1x
- Input data validation errors. Occur when data does not meet API requirements2x
- Preprocessing errors that occur during the preparation or verification of data for payment execution3x
- Processing errors detected during payment processing
Error codes:
00
- Undescribed error. This is a general code for errors that do not have a specific code or were not accounted for in the system10
- General data validation error. Possibly, a required field is missing in the request or data is specified in an incorrect format20
- General preprocessing error. Occurs if the payment does not comply with internal payment processing rules21
- Failed to identify the country in which the card was issued23
- Daily limit on the number or amount of operations allowed for this card has been exceeded25
- No available channels for payment execution. Possible reasons:- Payment amount exceeds the system's allowable limits or is below the minimum requirements
- Card is issued in a country with payment restrictions
- Card is issued by a bank with payment restrictions
- Card is issued by a payment system with payment restrictions
- Transaction limit reached for this card for the current day
30
- General payment processing error. This code is used for errors that do not have their own assigned code31
- Error processing payment by the acquiring bank gateway32
- Payment confirmation error from the bank gateway. Possibly, restrictions were imposed by the bank33
- The current transaction status does not allow the requested operation to be performed. For example, an attempt to confirm an already completed payment34
- Insufficient data to complete the transaction
Test environment
For testing integration with the payment gateway, you can use our sandbox, it works similarly but does not process real money.
Card payment
Real-time processing of payments from bank cards. Used for one-step payments. The method automatically determines the need for 3DS authentication and supports any payment systems.
Parameters
Amount is specified in minor units, sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payment HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"product": 2,
"money": {
"amount": 10000,
"currency": "EUR"
},
"card": {
"pan": "4111111111111111",
"expMonth": "09",
"expYear": "2028",
"cvv": "123",
"name": "JOHN DOE"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {"orderId": "72346", "userId": "8164"},
"merchant": "52137"
}
curl --location --request POST 'http://localhost:8085/api/payment' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"product": 2,
"money": {
"amount": 10000,
"currency": "EUR"
},
"card": {
"pan": "4111111111111111",
"expMonth": "09",
"expYear": "2028",
"cvv": "123",
"name": "JOHN DOE"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {"orderId": "72346", "userId": "8164"},
"merchant": "52137"
}'
<?php
$productId = 2;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($productId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payment',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'product' => $productId,
'money' => [
'amount' => 10000,
'currency' => 'EUR',
],
'card' => [
'pan' => '4111111111111111',
'expMonth' => '09',
'expYear' => '2028',
'cvv' => '123',
'name' => 'JOHN DOE',
],
'payer' => [
'email' => 'john@doe.com',
'phone' => '447899226230',
'ip' => '136.226.191.72',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country' => 'EN',
],
'customData' => [
'orderId' => '72346',
'userId' => '8164',
],
'merchant' => '52137',
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(product_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'product': product_id,
'money': {
'amount': 10000,
'currency': 'EUR',
},
'card': {
'pan': '4111111111111111',
'expMonth': '09',
'expYear': '2028',
'cvv': '123',
'name': 'JOHN DOE',
},
'payer': {
'email': 'john@doe.com',
'phone': '447899226230',
'ip': '136.226.191.72',
'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country': 'EN',
},
'customData': {
'orderId': '72346',
'userId': '8164',
},
'merchant': '52137',
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payment',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(product_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payment')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'product' => product_id,
'money' => {
'amount' => 10000,
'currency' => 'EUR',
},
'card' => {
'pan' => '4111111111111111',
'expMonth' => '09',
'expYear' => '2028',
'cvv' => '123',
'name' => 'JOHN DOE',
},
'payer' => {
'email' => 'john@doe.com',
'phone' => '447899226230',
'ip' => '136.226.191.72',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country' => 'EN',
},
'customData' => {
'orderId' => '72346',
'userId' => '8164',
},
'merchant' => '52137',
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const productId = 2;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(productId + secretKey).digest('hex');
const data = {
sign: sign,
product: productId,
money: {
amount: 10000,
currency: 'EUR',
},
card: {
pan: '4111111111111111',
expMonth: '09',
expYear: '2028',
cvv: '123',
name: 'JOHN DOE',
},
payer: {
email: 'john@doe.com',
phone: '447899226230',
ip: '136.226.191.72',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
country: 'EN',
},
customData: {
orderId: '72346',
userId: '8164',
},
merchant: '52137',
};
try {
const response = await fetch('http://localhost:8085/api/payment', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PaymentExample {
public static void main(String[] args) throws Exception {
int productId = 2;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(productId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"product\": " + productId + ","
+ "\"money\": {"
+ "\"amount\": 10000,"
+ "\"currency\": \"EUR\""
+ "},"
+ "\"card\": {"
+ "\"pan\": \"4111111111111111\","
+ "\"expMonth\": \"09\","
+ "\"expYear\": \"2028\","
+ "\"cvv\": \"123\","
+ "\"name\": \"JOHN DOE\""
+ "},"
+ "\"payer\": {"
+ "\"email\": \"john@doe.com\","
+ "\"phone\": \"447899226230\","
+ "\"ip\": \"136.226.191.72\","
+ "\"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36\","
+ "\"country\": \"EN\""
+ "},"
+ "\"customData\": {"
+ "\"orderId\": \"72346\","
+ "\"userId\": \"8164\""
+ "},"
+ "\"merchant\": \"52137\""
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val productId = 2
val secretKey = "o87z5off7u0v2rw"
val sign = md5(productId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"product": $productId,
"money": {
"amount": 10000,
"currency": "EUR"
},
"card": {
"pan": "4111111111111111",
"expMonth": "09",
"expYear": "2028",
"cvv": "123",
"name": "JOHN DOE"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {
"orderId": "72346",
"userId": "8164"
},
"merchant": "52137"
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int productId = 2;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(productId.ToString() + secretKey);
var data = new
{
sign = sign,
product = productId,
money = new
{
amount = 10000,
currency = "EUR"
},
card = new
{
pan = "4111111111111111",
expMonth = "09",
expYear = "2028",
cvv = "123",
name = "JOHN DOE"
},
payer = new
{
email = "john@doe.com",
phone = "447899226230",
ip = "136.226.191.72",
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
country = "EN"
},
customData = new
{
orderId = "72346",
userId = "8164"
},
merchant = "52137"
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payment", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
productId := 2
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(productId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"product": productId,
"money": map[string]interface{}{
"amount": 10000,
"currency": "EUR",
},
"card": map[string]interface{}{
"pan": "4111111111111111",
"expMonth": "09",
"expYear": "2028",
"cvv": "123",
"name": "JOHN DOE",
},
"payer": map[string]interface{}{
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN",
},
"customData": map[string]interface{}{
"orderId": "72346",
"userId": "8164",
},
"merchant": "52137",
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payment", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
3DS authentication required
Response parameters
Example response
{
"transactionId": 234134,
"type": "init",
"date": "2022-10-42 11:01:56",
"acsUrl": "https://ds2.mirconnect.ru:443/sc1/pareq",
"paReq": "eJxUUV1v4jAQ/Cuo72H9ESBGW0t8nER0aoWgle7VNQvk7gjBcRD997UhKeVtZ7wz3p3Ft70jmq/J\nNo40vlBdmx31is3z08dWsREXMjGZMElq7ChRZD4SbtPMKtpy2mZPGpeTFZ00nsnVxbHUvM/6AqGD\nwdHZvSm9RmNP0/xVD9JUDYcILcQDuXyuRaCZQrghLM2BdPMvqb3xTd2v3BHhyqE9NqV3n3qYSoQO\nYOP+67331RjgQQUI8QnhPsayiVUdrC7FRuezyS6fzRX8+fUX1tVveWZ2vZRqcWbPCLEDN8aTFkww\npkTWE3w84GM5QLjyaA5xhrg2663ep2GvG4FV/GfSvjKG8JPAELej0nZ7dAjpUh1LCh0hw+8a4T70\nbBGTtD6kJIUcDWWqgkHLRHkR8hCc86s+AoSogfZOIYnriUP1cPovAAAA//8FwIEAAAAAAJD/awAP\nw6nY",
"md": "KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08"
}
Amount is specified in minor units, sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Payment without 3DS authentication. A successfully processed payment will have type "payment". Payment type can also be "pending" if the bank has not yet confirmed the payment.
Response parameters
Example response
{
"transactionId": 234134,
"type": "payment",
"date": "2023-10-12 08:58:21"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to complete the operation
Response parameters
Example response
{
"code": "32",
"message": "Payment declined"
}
Transition to ACS for 3DS authentication
Redirecting the user to the issuing bank's ACS page for 3DS authentication. The process of transitioning to ACS is based on the 3D Secure version 1.0 protocol interface and looks similar to it. But the actual authentication occurs according to the bank's current protocol (including 3D Secure version 2.0).
Parameters
Code examples
<body>
<form action="http://localhost:8085/acs/redirect" method="POST">
<input type="hidden" name="acsUrl" value="https://ds2.mirconnect.ru:443/sc1/pareq"/>
<input type="hidden" name="paReq" value="eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm..."/>
<input type="hidden" name="md" value="KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08"/>
<input type="hidden" name="termUrl" value="https://example.com/"/>
</form>
<script>document.getElementsByTagName('form')[0].submit();</script>
</body>
Completion of card payment with 3DS authentication
Processing 3DS authentication results and completing the payment.
Parameters
Code examples
POST /api/complete HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"paRes": "eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...",
"md": "KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08"
}
curl --location --request POST 'http://localhost:8085/api/complete' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"paRes": "eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...",
"md": "KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08"
}'
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/complete',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'paRes' => 'eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...',
'md' => 'KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08',
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import json
import urllib.request
import urllib.parse
data = {
'paRes': 'eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...',
'md': 'KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08'
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/complete',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'json'
require 'net/http'
require 'uri'
uri = URI('http://localhost:8085/api/complete')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'paRes' => 'eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...',
'md' => 'KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08'
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
const data = {
paRes: 'eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...',
md: 'KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08'
};
try {
const response = await fetch('http://localhost:8085/api/complete', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
public class CompletePaymentExample {
public static void main(String[] args) throws Exception {
String jsonData = "{"
+ "\"paRes\": \"eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...\","
+ "\"md\": \"KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08\""
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/complete"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
fun main() {
val jsonData = """
{
"paRes": "eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...",
"md": "KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08"
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/complete"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var data = new
{
paRes = "eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...",
md = "KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08"
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/complete", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
data := map[string]interface{}{
"paRes": "eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...",
"md": "KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500322d97b2bd6990316ef6ea08",
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/complete", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
3DS authorization passed. A successfully processed payment will have type "payment". Payment type can also be "pending" if the bank has not yet confirmed the payment.
Response parameters
Example response
{
"transactionId": 234134,
"type": "payment",
"date": "2023-10-12 08:58:21"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
P2P Payment
Alternative method of accepting payments from bank cards through direct transfer of funds to an individual's card.
Parameters
Amount is specified in minor units, sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payment/p2p HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"product": 2,
"money": {
"amount": 70000,
"currency": "EUR"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {"orderId": "72346", "userId": "8164"},
"merchant": "52137",
}
curl --location --request POST 'http://localhost:8085/api/payment/p2p' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"product": 2,
"money": {
"amount": 70000,
"currency": "EUR"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {"orderId": "72346", "userId": "8164"},
"merchant": "52137",
}'
$productId = 2;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($productId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payment/p2p',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'product' => $productId,
'money' => [
'amount' => 70000,
'currency' => 'EUR',
],
'payer' => [
'email' => 'john@doe.com',
'phone' => '447899226230',
'ip' => '136.226.191.72',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country' => 'EN',
],
'customData' => [
'orderId' => '72346',
'userId' => '8164',
],
'merchant' => '52137',
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(product_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'product': product_id,
'money': {
'amount': 70000,
'currency': 'EUR',
},
'payer': {
'email': 'john@doe.com',
'phone': '447899226230',
'ip': '136.226.191.72',
'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country': 'EN',
},
'customData': {
'orderId': '72346',
'userId': '8164',
},
'merchant': '52137',
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payment/p2p',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(product_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payment/p2p')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'product' => product_id,
'money' => {
'amount' => 70000,
'currency' => 'EUR',
},
'payer' => {
'email' => 'john@doe.com',
'phone' => '447899226230',
'ip' => '136.226.191.72',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country' => 'EN',
},
'customData' => {
'orderId' => '72346',
'userId' => '8164',
},
'merchant' => '52137',
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const productId = 2;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(productId + secretKey).digest('hex');
const data = {
sign: sign,
product: productId,
money: {
amount: 70000,
currency: 'EUR',
},
payer: {
email: 'john@doe.com',
phone: '447899226230',
ip: '136.226.191.72',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
country: 'EN',
},
customData: {
orderId: '72346',
userId: '8164',
},
merchant: '52137',
};
try {
const response = await fetch('http://localhost:8085/api/payment/p2p', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class P2PPaymentExample {
public static void main(String[] args) throws Exception {
int productId = 2;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(productId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"product\": " + productId + ","
+ "\"money\": {"
+ "\"amount\": 70000,"
+ "\"currency\": \"EUR\""
+ "},"
+ "\"payer\": {"
+ "\"email\": \"john@doe.com\","
+ "\"phone\": \"447899226230\","
+ "\"ip\": \"136.226.191.72\","
+ "\"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36\","
+ "\"country\": \"EN\""
+ "},"
+ "\"customData\": {"
+ "\"orderId\": \"72346\","
+ "\"userId\": \"8164\""
+ "},"
+ "\"merchant\": \"52137\""
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val productId = 2
val secretKey = "o87z5off7u0v2rw"
val sign = md5(productId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"product": $productId,
"money": {
"amount": 70000,
"currency": "EUR"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {
"orderId": "72346",
"userId": "8164"
},
"merchant": "52137"
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int productId = 2;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(productId.ToString() + secretKey);
var data = new
{
sign = sign,
product = productId,
money = new
{
amount = 70000,
currency = "EUR"
},
payer = new
{
email = "john@doe.com",
phone = "447899226230",
ip = "136.226.191.72",
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
country = "EN"
},
customData = new
{
orderId = "72346",
userId = "8164"
},
merchant = "52137"
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payment/p2p", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
productId := 2
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(productId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"product": productId,
"money": map[string]interface{}{
"amount": 70000,
"currency": "EUR",
},
"payer": map[string]interface{}{
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN",
},
"customData": map[string]interface{}{
"orderId": "72346",
"userId": "8164",
},
"merchant": "52137",
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payment/p2p", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
Текущее состояние транзакции
Response parameters
Example response
{
"transactionId": 348524,
"type": "init",
"date": "2023-11-23 19:42:33"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Getting payment details for P2P payment
Getting payment details for making a P2P transfer by the buyer. In addition to the recipient's details required for the transfer of funds, the method also provides the amount for transfer, which may slightly differ from the original payment amount. It is important to transfer exactly the amount returned by this method, this will allow the payment to be credited as quickly as possible without additional checks and confirmations.
Parameters
Sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payment/p2p/requisite HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "934002f5c8ce49c788c1a8d74a4a5e18",
"transaction": 348524,
"requisiteType": "sbp"
}
curl --location --request POST 'http://localhost:8085/api/payment/p2p/requisite' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "934002f5c8ce49c788c1a8d74a4a5e18",
"transaction": 348524,
"requisiteType": "sbp"
}'
$transactionId = 348524;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($transactionId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payment/p2p/requisite',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'transaction' => $transactionId,
'requisiteType' => 'sbp',
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
transaction_id = 348524
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(transaction_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'transaction': transaction_id,
'requisiteType': 'sbp'
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payment/p2p/requisite',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
transaction_id = 348524
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(transaction_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payment/p2p/requisite')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'transaction' => transaction_id,
'requisiteType' => 'sbp'
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const transactionId = 348524;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(transactionId + secretKey).digest('hex');
const data = {
sign: sign,
transaction: transactionId,
requisiteType: 'sbp'
};
try {
const response = await fetch('http://localhost:8085/api/payment/p2p/requisite', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class P2PRequisiteExample {
public static void main(String[] args) throws Exception {
int transactionId = 348524;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(transactionId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"transaction\": " + transactionId + ","
+ "\"requisiteType\": \"sbp\""
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p/requisite"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val transactionId = 348524
val secretKey = "o87z5off7u0v2rw"
val sign = md5(transactionId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"transaction": $transactionId,
"requisiteType": "sbp"
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p/requisite"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int transactionId = 348524;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(transactionId.ToString() + secretKey);
var data = new
{
sign = sign,
transaction = transactionId,
requisiteType = "sbp"
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payment/p2p/requisite", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
transactionId := 348524
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(transactionId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"transaction": transactionId,
"requisiteType": "sbp",
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payment/p2p/requisite", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
Текущее состояние транзакции
Response parameters
Example response
{
"transactionId": 348524,
"type": "init",
"date": "2023-11-23 19:42:33",
"requisite": {
"amount": "80010",
"type": "sbp",
"value": "79292453814",
"description": "Зубайру Ш.",
"bank": "alfabank"
}
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
P2P transfer confirmation
Confirmation of the fact that the buyer has transferred funds to the specified payment details.
Parameters
Sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payment/p2p/confirm HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "934002f5c8ce49c788c1a8d74a4a5e18",
"transaction": 348524
}
curl --location --request POST 'http://localhost:8085/api/payment/p2p/confirm' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "934002f5c8ce49c788c1a8d74a4a5e18",
"transaction": 348524
}'
$transactionId = 348524;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($transactionId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payment/p2p/confirm',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'transaction' => $transactionId,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
transaction_id = 348524
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(transaction_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'transaction': transaction_id,
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payment/p2p/confirm',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
transaction_id = 348524
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(transaction_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payment/p2p/confirm')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'transaction' => transaction_id,
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const transactionId = 348524;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(transactionId + secretKey).digest('hex');
const data = {
sign: sign,
transaction: transactionId,
};
try {
const response = await fetch('http://localhost:8085/api/payment/p2p/confirm', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class P2PConfirmExample {
public static void main(String[] args) throws Exception {
int transactionId = 348524;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(transactionId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"transaction\": " + transactionId
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p/confirm"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val transactionId = 348524
val secretKey = "o87z5off7u0v2rw"
val sign = md5(transactionId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"transaction": $transactionId
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p/confirm"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int transactionId = 348524;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(transactionId.ToString() + secretKey);
var data = new
{
sign = sign,
transaction = transactionId
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payment/p2p/confirm", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
transactionId := 348524
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(transactionId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"transaction": transactionId,
}
jsonData, err := json.Marshal(data)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payment/p2p/confirm", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
Responses
Текущее состояние транзакции
Response parameters
Example response
{
"transactionId": 348524,
"type": "pending",
"date": "2023-11-23 19:42:33"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Sending P2P transfer confirmation (receipt)
Sending documentary confirmation of a successfully completed P2P transfer to the required payment details
Parameters
Sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payment/p2p/receipt HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "934002f5c8ce49c788c1a8d74a4a5e18",
"transaction": 348524,
"receipt": "JVBERi0xLjUKJeLjz9MKNCAwIG9iago8PC9Db2xvclNwYWNlL0Rldml..."
}
curl --location --request POST 'http://localhost:8085/api/payment/p2p/receipt' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "934002f5c8ce49c788c1a8d74a4a5e18",
"transaction": 348524,
"receipt": "JVBERi0xLjUKJeLjz9MKNCAwIG9iago8PC9Db2xvclNwYWNlL0Rldml..."
}'
$transactionId = 348524;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($transactionId . $secretKey);
$receipt = base64_encode(file_get_contents('receipt_24.06.2024.pdf'));
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payment/p2p/receipt',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'transaction' => $transactionId,
'receipt' => $receipt,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
import base64
transaction_id = 348524
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(transaction_id) + secret_key).encode()).hexdigest()
# Read receipt file and encode it to base64
with open('receipt_24.06.2024.pdf', 'rb') as f:
receipt_content = f.read()
receipt = base64.b64encode(receipt_content).decode('utf-8')
data = {
'sign': sign,
'transaction': transaction_id,
'receipt': receipt
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payment/p2p/receipt',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
require 'base64'
transaction_id = 348524
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(transaction_id.to_s + secret_key)
# Read receipt file and encode it to base64
receipt_content = File.binread('receipt_24.06.2024.pdf')
receipt = Base64.strict_encode64(receipt_content)
uri = URI('http://localhost:8085/api/payment/p2p/receipt')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'transaction' => transaction_id,
'receipt' => receipt
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
import fs from 'fs';
const transactionId = 348524;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(transactionId + secretKey).digest('hex');
// Read receipt file and encode it to base64
const receiptContent = fs.readFileSync('receipt_24.06.2024.pdf');
const receipt = receiptContent.toString('base64');
const data = {
sign: sign,
transaction: transactionId,
receipt: receipt
};
try {
const response = await fetch('http://localhost:8085/api/payment/p2p/receipt', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.nio.file.Files;
import java.nio.file.Paths;
public class P2PReceiptExample {
public static void main(String[] args) throws Exception {
int transactionId = 348524;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(transactionId + secretKey);
// Read receipt file and encode it to base64
byte[] receiptContent = Files.readAllBytes(Paths.get("receipt_24.06.2024.pdf"));
String receipt = Base64.getEncoder().encodeToString(receiptContent);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"transaction\": " + transactionId + ","
+ "\"receipt\": \"" + receipt + "\""
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p/receipt"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
import java.util.Base64
import java.nio.file.Files
import java.nio.file.Paths
fun main() {
val transactionId = 348524
val secretKey = "o87z5off7u0v2rw"
val sign = md5(transactionId.toString() + secretKey)
// Read receipt file and encode it to base64
val receiptContent = Files.readAllBytes(Paths.get("receipt_24.06.2024.pdf"))
val receipt = Base64.getEncoder().encodeToString(receiptContent)
val jsonData = """
{
"sign": "$sign",
"transaction": $transactionId,
"receipt": "$receipt"
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/p2p/receipt"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.IO;
class Program
{
static async Task Main(string[] args)
{
int transactionId = 348524;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(transactionId.ToString() + secretKey);
// Read receipt file and encode it to base64
byte[] receiptContent = File.ReadAllBytes("receipt_24.06.2024.pdf");
string receipt = Convert.ToBase64String(receiptContent);
var data = new
{
sign = sign,
transaction = transactionId,
receipt = receipt
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payment/p2p/receipt", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"strconv"
)
func main() {
transactionId := 348524
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(transactionId)+secretKey)))
// Read receipt file and encode it to base64
receiptContent, err := os.ReadFile("receipt_24.06.2024.pdf")
if err != nil {
fmt.Println("Error reading receipt file:", err)
return
}
receipt := base64.StdEncoding.EncodeToString(receiptContent)
data := map[string]interface{}{
"sign": sign,
"transaction": transactionId,
"receipt": receipt,
}
jsonData, err := json.Marshal(data)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payment/p2p/receipt", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
Responses
Текущее состояние транзакции
Response parameters
Example response
{
"transactionId": 348524,
"type": "pending",
"date": "2023-11-23 19:42:33"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
PIX Payment
Accepting payments through the Brazilian instant transfer system PIX using QR codes.
Parameters
Amount is specified in minor units, sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payment/pix HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"product": 2,
"money": {
"amount": 10000,
"currency": "BRL"
},
"pix": {
"cpf": "12345678909",
"name": "Francisco da Silva"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {"orderId": "72346", "userId": "8164"},
"merchant": "52137",
}
curl --location --request POST 'http://localhost:8085/api/payment/pix' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"product": 2,
"money": {
"amount": 10000,
"currency": "BRL"
},
"pix": {
"cpf": "12345678909",
"name": "Francisco da Silva"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {"orderId": "72346", "userId": "8164"},
"merchant": "52137",
}'
$productId = 2;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($productId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payment/pix',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'product' => $productId,
'money' => [
'amount' => 10000,
'currency' => 'BRL',
],
'pix' => [
'cpf' => '12345678909',
'name' => 'Francisco da Silva',
],
'payer' => [
'email' => 'john@doe.com',
'phone' => '447899226230',
'ip' => '136.226.191.72',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country' => 'EN',
],
'customData' => [
'orderId' => '72346',
'userId' => '8164',
],
'merchant' => '52137',
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(product_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'product': product_id,
'money': {
'amount': 10000,
'currency': 'BRL',
},
'pix': {
'cpf': '12345678909',
'name': 'Francisco da Silva',
},
'payer': {
'email': 'john@doe.com',
'phone': '447899226230',
'ip': '136.226.191.72',
'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country': 'EN',
},
'customData': {
'orderId': '72346',
'userId': '8164',
},
'merchant': '52137',
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payment/pix',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(product_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payment/pix')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'product' => product_id,
'money' => {
'amount' => 10000,
'currency' => 'BRL',
},
'pix' => {
'cpf' => '12345678909',
'name' => 'Francisco da Silva',
},
'payer' => {
'email' => 'john@doe.com',
'phone' => '447899226230',
'ip' => '136.226.191.72',
'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
'country' => 'EN',
},
'customData' => {
'orderId' => '72346',
'userId' => '8164',
},
'merchant' => '52137',
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const productId = 2;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(productId + secretKey).digest('hex');
const data = {
sign: sign,
product: productId,
money: {
amount: 10000,
currency: 'BRL',
},
pix: {
cpf: '12345678909',
name: 'Francisco da Silva',
},
payer: {
email: 'john@doe.com',
phone: '447899226230',
ip: '136.226.191.72',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
country: 'EN',
},
customData: {
orderId: '72346',
userId: '8164',
},
merchant: '52137',
};
try {
const response = await fetch('http://localhost:8085/api/payment/pix', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PixPaymentExample {
public static void main(String[] args) throws Exception {
int productId = 2;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(productId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"product\": " + productId + ","
+ "\"money\": {"
+ "\"amount\": 10000,"
+ "\"currency\": \"BRL\""
+ "},"
+ "\"pix\": {"
+ "\"cpf\": \"12345678909\","
+ "\"name\": \"Francisco da Silva\""
+ "},"
+ "\"payer\": {"
+ "\"email\": \"john@doe.com\","
+ "\"phone\": \"447899226230\","
+ "\"ip\": \"136.226.191.72\","
+ "\"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36\","
+ "\"country\": \"EN\""
+ "},"
+ "\"customData\": {"
+ "\"orderId\": \"72346\","
+ "\"userId\": \"8164\""
+ "},"
+ "\"merchant\": \"52137\""
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/pix"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val productId = 2
val secretKey = "o87z5off7u0v2rw"
val sign = md5(productId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"product": $productId,
"money": {
"amount": 10000,
"currency": "BRL"
},
"pix": {
"cpf": "12345678909",
"name": "Francisco da Silva"
},
"payer": {
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN"
},
"customData": {
"orderId": "72346",
"userId": "8164"
},
"merchant": "52137"
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payment/pix"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int productId = 2;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(productId.ToString() + secretKey);
var data = new
{
sign = sign,
product = productId,
money = new
{
amount = 10000,
currency = "BRL"
},
pix = new
{
cpf = "12345678909",
name = "Francisco da Silva"
},
payer = new
{
email = "john@doe.com",
phone = "447899226230",
ip = "136.226.191.72",
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
country = "EN"
},
customData = new
{
orderId = "72346",
userId = "8164"
},
merchant = "52137"
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payment/pix", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
productId := 2
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(productId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"product": productId,
"money": map[string]interface{}{
"amount": 10000,
"currency": "BRL",
},
"pix": map[string]interface{}{
"cpf": "12345678909",
"name": "Francisco da Silva",
},
"payer": map[string]interface{}{
"email": "john@doe.com",
"phone": "447899226230",
"ip": "136.226.191.72",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"country": "EN",
},
"customData": map[string]interface{}{
"orderId": "72346",
"userId": "8164",
},
"merchant": "52137",
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payment/pix", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
Successful payment will have type "payment"
Response parameters
Example response
{
"transactionId": 174673,
"type": "init",
"date": "2023-10-15 17:03:42",
"pixCopiaECola": "00020101021226830014BR.GOV.BCB.PIX2561qrcodespix.sejaefi.com.br/v2/e657d620c72c47ffaa3a8ce629656d2b5204000053039865802BR5905EFISA6008SAOPAULO62070503***63042ED7",
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOQAAADkCAYAAACIV4iNAAAAAklEQVR4AewaftIAAAxcSURBVO3BQW4ERxLAQLKh/3+Z62OeCmjMSC4vMsL+wVrrCg9rrWs8rLWu8bDWusbDWusaD2utazysta7xsNa6xsNa6xoPa61rPKy1rvGw1rrGw1rrGg9rrWs8rLWu8bDWusYPH1L5SxWTyjdVnKh8omJSmSreUPlExYnKVDGpTBUnKm9UnKhMFZPKX6r4xMNa6xoPa61rPKy1rvHDl1V8k8pJxSdUTlROKiaVqWJSOVE5qZgqTlSmihOVE5UTlaliqphUTlS+qeKbVL7pYa11jYe11jUe1lrX+OGXqbxR8U0qU8VUcVIxqbyhclIxqXxCZao4UflExYnKVPFGxaTyTSpvVPymh7XWNR7WWtd4WGtd44f/OJWp4kTlpGJSOVH5SypTxYnKJyomlW+q+ETF/5OHtdY1HtZa13hYa13jh/8zKv8lKp9Q+U0qJypTxVQxqbxRMVX8P3tYa13jYa11jYe11jV++GUVN6v4popJZaqYVKaKSWWqeENlqjhRmSomlROVqWKqeENlqvimips8rLWu8bDWusbDWusaP3yZyr+pYlKZKiaVqeKkYlL5N6lMFW+oTBWTylQxqUwVk8pUMalMFW+oTBUnKjd7WGtd42GtdY2HtdY1fvhQxU1UTlROVD6hMlWcVHyi4ptUTlSmiknlmyo+UfFf8rDWusbDWusaD2uta/zwIZWp4g2VqWJSeaNiUnmjYlKZVE4qJpWTiknlROUmKlPFpHJScaIyVZyofFPFicpU8YmHtdY1HtZa13hYa13jh8tVnKhMKlPFN1WcqLyh8psqJpWp4kRlqviEylQxqbxRcaIyVUwqU8WkclLxTQ9rrWs8rLWu8bDWusYPv0xlqjhROamYKiaVSeWk4hMqU8UnVKaKSWWqmFQmlROVqWKqOFGZKk4qvkllqpgqTiomlTdUpopPPKy1rvGw1rrGw1rrGj/8MZWpYlKZKiaVqeKNiknlDZUTlaniRGWq+ETFpDJVnKhMFScVJxUnKlPFicqJylTxmyq+6WGtdY2HtdY1HtZa17B/8EUqf6liUpkqJpWTihOVv1RxonJScaIyVUwqU8WJyknFicpJxaQyVUwqb1S8oTJVfOJhrXWNh7XWNR7WWtewf/ABlaniRGWq+ITKVDGpfKJiUpkqJpWp4g2Vv1QxqUwVn1D5RMUbKlPFpHJS8YbKVPGJh7XWNR7WWtd4WGtd44c/VjGpvFExVUwqU8WJyhsVk8onVE4qJpWpYlKZKiaVSeVE5aTipOJE5Q2VT1RMKicqJxXf9LDWusbDWusaD2uta/xwmYo3VKaKNyreUJkqTlTeqDipmFROVN6omFSmik+oTBUnKlPFpPKGyhsVk8pvelhrXeNhrXWNh7XWNX74MpWTiqliUjmpmCo+ofKXKv5LKj6h8obKicobKt9UMalMFZ94WGtd42GtdY2HtdY1fvhQxaQyVUwqb1RMKicVk8obFZPKVDGpnFS8oTJVTCpTxaQyVZyoTCpTxaQyVUwqJxWfqPg3qUwV3/Sw1rrGw1rrGg9rrWv88CGVqWJSmSomlaliUpkqJpVPVEwqU8Wk8pdU3qh4o2JSeUPlEypTxTepnFR8QmWq+MTDWusaD2utazysta7xwy+rOKmYVKaKSWWqOKk4UflExYnKVPFGxYnKJypOVE4qJpUTlW9SmSqmiknlROWkYlL5poe11jUe1lrXeFhrXeOHD1VMKlPFpHJSMalMFW+oTBVTxRsVk8pJxSdUpoqpYlKZKk5UpooTlU9UnKicVEwVn1CZKiaVv/Sw1rrGw1rrGg9rrWv88GUVk8obKlPFpHJSMVWcqEwVJypTxaQyqbxRcaJyUnGiMlWcqPwmlaliUnlDZaqYKiaVk4q/9LDWusbDWusaD2uta/zwZSpTxaTyhsonVKaKqWJSmSq+qeJE5RMqJxWTylQxVZyoTBUnKlPFpDJVnKicqLyhMlVMKr/pYa11jYe11jUe1lrX+OFDKlPFJyreUPmEylTxhspUcaLyiYo3VE4qJpU3KiaVqWKqOKmYVN6oeEPlJg9rrWs8rLWu8bDWusYPH6r4TSpTxYnKVDGpnKhMFVPFicpJxYnKGypTxScqJpUTlROVqWJSmSpOKiaVE5Wp4g2VqWJS+aaHtdY1HtZa13hYa13jhw+p/KaKb6qYVKaKSeWkYqo4UZkqpopJ5aTiDZWp4hMVb6icqHxTxTepTBXf9LDWusbDWusaD2uta/zwoYoTlaliUplUvknlExVvqHxC5UTl31TxhsonKiaVE5VPVEwqf+lhrXWNh7XWNR7WWtf44UMqU8WJylQxqUwVk8pU8YbKN6lMFZPKVDGpnFRMKicVn1A5UZkq3qiYVE5UpopJ5aRiUpkqJpWTit/0sNa6xsNa6xoPa61r2D/4gMpUcaIyVZyoTBVvqEwVk8pJxaQyVUwqJxWTylQxqUwVk8obFZ9QeaNiUpkqJpVPVEwqU8Wk8k0Vn3hYa13jYa11jYe11jXsH3yRyknFicpUMam8UTGpfKLiROUTFScqU8WkMlVMKlPFicpJxTepnFScqHyi4g2VqeITD2utazysta7xsNa6xg8fUpkqTlSmiqliUpkqTlQmlaniN1WcqEwVn1CZKj6hMlVMKicqU8Wk8kbFpPJGxRsqU8WkMlV808Na6xoPa61rPKy1rvHDL1M5UTmpmFSmijdU3qg4UZkqTipOVE4qJpVJ5aRiUvlNKlPFN1VMKm+onKhMFb/pYa11jYe11jUe1lrX+OHLVE4qTlQmlU9UTCp/SWWqOKl4o2JSmSpOKiaVSeVE5aTiROU3qbxRMalMKicVn3hYa13jYa11jYe11jV++FDFN1W8oTJVvFExqUwqU8U3qUwVk8obFScqU8VUMalMFZPKVHGi8omKSWWqmFTeUJkqJpXf9LDWusbDWusaD2uta9g/+IDKScUbKp+oOFGZKv6SyjdVnKi8UfFNKicVb6hMFZPKScWk8omKb3pYa13jYa11jYe11jV+uEzFJ1SmiqniDZWTihOVqWJSmSpOVE5UTiomlUnlpOI3qUwVJypTxaRyUjGpnFT8poe11jUe1lrXeFhrXeOHf5nKGxWTyonKVDGpTBVTxaTyRsUnVH5TxRsqn6iYVKaKNyomlTdUpooTlanimx7WWtd4WGtd42GtdY0fvqxiUpkq3qiYVN6oeENlqjhR+UTFScWJyidUpopJZaqYVKaKSeUTKicqJxWTylRxk4e11jUe1lrXeFhrXcP+wRepTBVvqJxUTCpTxTepfFPFicpJxaQyVZyoTBUnKlPFJ1S+qWJSOan4hMpJxSce1lrXeFhrXeNhrXUN+wdfpPJGxRsqb1RMKicVJypvVHyTylTxCZWTiknljYo3VKaKT6icVEwqJxW/6WGtdY2HtdY1HtZa17B/8AGVNyreUDmpOFGZKk5U3qiYVE4q3lD5popJ5RMVJypTxaQyVbyh8pcqJpWp4hMPa61rPKy1rvGw1rqG/YP/MJWp4kRlqphUpopJ5aTiROWkYlKZKt5QeaPim1ROKiaVqeJEZap4Q2WqmFROKr7pYa11jYe11jUe1lrX+OFDKn+p4kTlpOKkYlKZKiaVE5XfpDJVvFHxCZWp4g2VE5VPqEwVJypTxaQyqUwVn3hYa13jYa11jYe11jV++LKKb1I5qZhUpoo3VD6h8kbFJyreqDhRmSomlaliUnmj4g2VNyreqPg3Pay1rvGw1rrGw1rrGj/8MpU3Kt5QmSomlW9SOamYVE5UpooTlW9SmSomlTcqJpWp4kTlpGJSmVQ+oTJVTBWTyjc9rLWu8bDWusbDWusaP/zHVUwqb1R8QmVSOak4UXmjYlJ5o+KkYlJ5o+KNijcqfpPKVPGbHtZa13hYa13jYa11jR/+z1ScqEwqn6iYVN5QmSpOVCaVk4pJZaqYVL5J5aTiDZWpYlKZKj5RMalMFd/0sNa6xsNa6xoPa61r/PDLKv5NKlPFicpU8UbFicpvqnhDZaqYVKaKNyomlROVN1SmijdUTiqmit/0sNa6xsNa6xoPa61r/PBlKn9J5Q2VqWKq+EsVJypTxaRyovKJik+ofKLim1SmikllUpkqJpWp4hMPa61rPKy1rvGw1rqG/YO11hUe1lrXeFhrXeNhrXWNh7XWNR7WWtd4WGtd42GtdY2HtdY1HtZa13hYa13jYa11jYe11jUe1lrXeFhrXeNhrXWN/wFs9ZR1SJGcGAAAAABJRU5ErkJggg==",
"link": "https://pix.sejaefi.com.br/cob/pagar/e657d620c72c47ffaa3a8ce629656d2b"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Payment notification (callback)
In case of successful payment, a payment notification will be sent to the notification URL, which can be specified in the personal account
Parameters
All amounts are specified in minor units, sign is calculated as md5(transaction.id + secretKey), secretKey will be specified in the personal account.
Code examples
{
"sign": "2e323fe1571752af70f59e72a59a84bd",
"transaction": {
"id": 234134,
"parentId": null,
"type": "payment",
"paymentMethod": {
"pan": "546960******7736",
"name": "VIKTORIIA SPASOVA",
"paymentSystem": "mastercard"
},
"currency": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"commission": 0.27,
"commissionFixed": 0,
"amountCredited": 1095,
"amountCommission": 405,
"amountTotal": 1500,
"amountSource": 1500,
"currencySource": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"amountRolling": 0,
"rollingPeriod": 0,
"customData": {
"orderId": "72346",
"userId": "8164"
},
"dateCreate": "2023-10-17T13:47:53+00:00",
"dateComplete": "2023-10-17T13:52:16+00:00"
}
}
Payment refund
Refund of a previously processed payment to the card or account from which the payment was made. Allows returning the full or partial transaction amount. Not available for payments made via P2P transfer.
Parameters
Sign is calculated as md5(transaction + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/refund HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "a985127c12ced236eaf06c2e5932ed73",
"transaction": 1573
}
curl --location --request POST 'http://localhost:8085/api/refund' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "a985127c12ced236eaf06c2e5932ed73",
"transaction": 1573
}'
$transactionId = 1573;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($transactionId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/refund',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'transaction' => $transactionId,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
transaction_id = 1573
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(transaction_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'transaction': transaction_id
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/refund',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
transaction_id = 1573
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(transaction_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/refund')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'transaction' => transaction_id
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const transactionId = 1573;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(transactionId + secretKey).digest('hex');
const data = {
sign: sign,
transaction: transactionId
};
try {
const response = await fetch('http://localhost:8085/api/refund', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class RefundExample {
public static void main(String[] args) throws Exception {
int transactionId = 1573;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(transactionId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"transaction\": " + transactionId
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/refund"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val transactionId = 1573
val secretKey = "o87z5off7u0v2rw"
val sign = md5(transactionId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"transaction": $transactionId
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/refund"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int transactionId = 1573;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(transactionId.ToString() + secretKey);
var data = new
{
sign = sign,
transaction = transactionId
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/refund", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
transactionId := 1573
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(transactionId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"transaction": transactionId,
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/refund", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
Successful refund will have type "refund"
Response parameters
Example response
{
"transactionId": 4187,
"type": "refund",
"date": "2023-10-29 13:32:19"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Auto-payment (rebill)
Performs repeated debiting of funds from a tokenized payment instrument. Used for automatic processing of regular or one-time payments without direct client participation. Applied for recurring payments and subscriptions.
Parameters
Sign is calculated as md5(transaction + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/rebill HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "a985127c12ced236eaf06c2e5932ed73",
"transaction": 1573,
"money": {
"amount": 20000,
"currency": "EUR"
},
"customData": {
"orderId": "72346",
"userId": "8164"
}
}
curl --location --request POST 'http://localhost:8085/api/rebill' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "a985127c12ced236eaf06c2e5932ed73",
"transaction": 1573,
"money": {
"amount": 20000,
"currency": "EUR"
},
"customData": {
"orderId": "72346",
"userId": "8164"
}
}'
$transactionId = 1573;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($transactionId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/rebill',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'transaction' => $transactionId,
'money' => [
'amount' => 20000,
'currency' => 'EUR',
],
'customData' => [
'orderId' => '72346',
'userId' => '8164',
],
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
transaction_id = 1573
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(transaction_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'transaction': transaction_id,
'money': {
'amount': 20000,
'currency': 'EUR',
},
'customData': {
'orderId': '72346',
'userId': '8164',
}
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/rebill',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
transaction_id = 1573
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(transaction_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/rebill')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'transaction' => transaction_id,
'money' => {
'amount' => 20000,
'currency' => 'EUR',
},
'customData' => {
'orderId' => '72346',
'userId' => '8164',
}
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const transactionId = 1573;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(transactionId + secretKey).digest('hex');
const data = {
sign: sign,
transaction: transactionId,
money: {
amount: 20000,
currency: 'EUR',
},
customData: {
orderId: '72346',
userId: '8164',
}
};
try {
const response = await fetch('http://localhost:8085/api/rebill', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class RebillExample {
public static void main(String[] args) throws Exception {
int transactionId = 1573;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(transactionId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"transaction\": " + transactionId + ","
+ "\"money\": {"
+ "\"amount\": 20000,"
+ "\"currency\": \"EUR\""
+ "},"
+ "\"customData\": {"
+ "\"orderId\": \"72346\","
+ "\"userId\": \"8164\""
+ "}"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/rebill"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val transactionId = 1573
val secretKey = "o87z5off7u0v2rw"
val sign = md5(transactionId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"transaction": $transactionId,
"money": {
"amount": 20000,
"currency": "EUR"
},
"customData": {
"orderId": "72346",
"userId": "8164"
}
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/rebill"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int transactionId = 1573;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(transactionId.ToString() + secretKey);
var data = new
{
sign = sign,
transaction = transactionId,
money = new
{
amount = 20000,
currency = "EUR"
},
customData = new
{
orderId = "72346",
userId = "8164"
}
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/rebill", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
transactionId := 1573
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(transactionId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"transaction": transactionId,
"money": map[string]interface{}{
"amount": 20000,
"currency": "EUR",
},
"customData": map[string]interface{}{
"orderId": "72346",
"userId": "8164",
},
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/rebill", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
Successful auto-payment will have type "payment"
Response parameters
Example response
{
"transactionId": 234134,
"type": "payment",
"date": "2023-11-05 12:03:29"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Getting a list of transactions
Getting a list of transactions of any type with filtering by specified parameters
Parameters
Sign is calculated as md5(product + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/transaction-list HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "7ade5b8d547549c6bc9893a441cca355",
"product": 2,
"filter": {
"id": 220,
"parent": 25,
"type": "payment",
"pan": "411111",
"paymentSystem": "visa",
"country": "EN",
"commissionFrom": 0.10,
"commissionTo": 0.25,
"amountCreditedFrom": 15000,
"amountCreditedTo": 150000,
"amountCommissionFrom": 5000,
"amountCommissionTo": 50000,
"amountTotalFrom": 20000,
"amountTotalTo": 200000,
"customData": {
"orderId": "72346",
"userId": "8164"
},
"dateCreateFrom": "2023-10-07",
"dateCreateTo": "2023-11-29 17:59:45"
},
"limit": 10,
"offset": 0
}
curl --location --request POST 'http://localhost:8085/api/transaction-list' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "7ade5b8d547549c6bc9893a441cca355",
"product": 2,
"filter": {
"id": 220,
"parent": 25,
"type": "payment",
"pan": "411111",
"paymentSystem": "visa",
"country": "EN",
"commissionFrom": 0.10,
"commissionTo": 0.25,
"amountCreditedFrom": 15000,
"amountCreditedTo": 150000,
"amountCommissionFrom": 5000,
"amountCommissionTo": 50000,
"amountTotalFrom": 20000,
"amountTotalTo": 200000,
"customData": {
"orderId": "72346",
"userId": "8164"
},
"dateCreateFrom": "2023-10-07",
"dateCreateTo": "2023-11-29 17:59:45"
},
"limit": 10,
"offset": 0
}'
$productId = 2;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($productId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/transaction-list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'product' => $productId,
'filter' => [
'id' => 220,
'parent' => 25,
'type' => 'payment',
'pan' => '411111',
'paymentSystem' => 'visa',
'country' => 'EN',
'commissionFrom' => 0.1,
'commissionTo' => 0.25,
'amountCreditedFrom' => 15000,
'amountCreditedTo' => 150000,
'amountCommissionFrom' => 5000,
'amountCommissionTo' => 50000,
'amountTotalFrom' => 20000,
'amountTotalTo' => 200000,
'customData' => [
'orderId' => '72346',
'userId' => '8164',
],
'dateCreateFrom' => '2023-10-07',
'dateCreateTo' => '2023-11-29 17:59:45',
],
'limit' => 10,
'offset' => 0,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(product_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'product': product_id,
'filter': {
'id': 220,
'parent': 25,
'type': 'payment',
'pan': '411111',
'paymentSystem': 'visa',
'country': 'EN',
'commissionFrom': 0.1,
'commissionTo': 0.25,
'amountCreditedFrom': 15000,
'amountCreditedTo': 150000,
'amountCommissionFrom': 5000,
'amountCommissionTo': 50000,
'amountTotalFrom': 20000,
'amountTotalTo': 200000,
'customData': {
'orderId': '72346',
'userId': '8164',
},
'dateCreateFrom': '2023-10-07',
'dateCreateTo': '2023-11-29 17:59:45',
},
'limit': 10,
'offset': 0,
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/transaction-list',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
product_id = 2
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(product_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/transaction-list')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'product' => product_id,
'filter' => {
'id' => 220,
'parent' => 25,
'type' => 'payment',
'pan' => '411111',
'paymentSystem' => 'visa',
'country' => 'EN',
'commissionFrom' => 0.1,
'commissionTo' => 0.25,
'amountCreditedFrom' => 15000,
'amountCreditedTo' => 150000,
'amountCommissionFrom' => 5000,
'amountCommissionTo' => 50000,
'amountTotalFrom' => 20000,
'amountTotalTo' => 200000,
'customData' => {
'orderId' => '72346',
'userId' => '8164',
},
'dateCreateFrom' => '2023-10-07',
'dateCreateTo' => '2023-11-29 17:59:45',
},
'limit' => 10,
'offset' => 0,
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const productId = 2;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(productId + secretKey).digest('hex');
const data = {
sign: sign,
product: productId,
filter: {
id: 220,
parent: 25,
type: 'payment',
pan: '411111',
paymentSystem: 'visa',
country: 'EN',
commissionFrom: 0.1,
commissionTo: 0.25,
amountCreditedFrom: 15000,
amountCreditedTo: 150000,
amountCommissionFrom: 5000,
amountCommissionTo: 50000,
amountTotalFrom: 20000,
amountTotalTo: 200000,
customData: {
orderId: '72346',
userId: '8164',
},
dateCreateFrom: '2023-10-07',
dateCreateTo: '2023-11-29 17:59:45',
},
limit: 10,
offset: 0,
};
try {
const response = await fetch('http://localhost:8085/api/transaction-list', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class TransactionListExample {
public static void main(String[] args) throws Exception {
int productId = 2;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(productId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"product\": " + productId + ","
+ "\"filter\": {"
+ "\"id\": 220,"
+ "\"parent\": 25,"
+ "\"type\": \"payment\","
+ "\"pan\": \"411111\","
+ "\"paymentSystem\": \"visa\","
+ "\"country\": \"EN\","
+ "\"commissionFrom\": 0.1,"
+ "\"commissionTo\": 0.25,"
+ "\"amountCreditedFrom\": 15000,"
+ "\"amountCreditedTo\": 150000,"
+ "\"amountCommissionFrom\": 5000,"
+ "\"amountCommissionTo\": 50000,"
+ "\"amountTotalFrom\": 20000,"
+ "\"amountTotalTo\": 200000,"
+ "\"customData\": {"
+ "\"orderId\": \"72346\","
+ "\"userId\": \"8164\""
+ "},"
+ "\"dateCreateFrom\": \"2023-10-07\","
+ "\"dateCreateTo\": \"2023-11-29 17:59:45\""
+ "},"
+ "\"limit\": 10,"
+ "\"offset\": 0"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/transaction-list"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val productId = 2
val secretKey = "o87z5off7u0v2rw"
val sign = md5(productId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"product": $productId,
"filter": {
"id": 220,
"parent": 25,
"type": "payment",
"pan": "411111",
"paymentSystem": "visa",
"country": "EN",
"commissionFrom": 0.1,
"commissionTo": 0.25,
"amountCreditedFrom": 15000,
"amountCreditedTo": 150000,
"amountCommissionFrom": 5000,
"amountCommissionTo": 50000,
"amountTotalFrom": 20000,
"amountTotalTo": 200000,
"customData": {
"orderId": "72346",
"userId": "8164"
},
"dateCreateFrom": "2023-10-07",
"dateCreateTo": "2023-11-29 17:59:45"
},
"limit": 10,
"offset": 0
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/transaction-list"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.Text.Json;
class Program
{
static async Task Main(string[] args)
{
int productId = 2;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(productId.ToString() + secretKey);
var filter = new
{
id = 220,
parent = 25,
type = "payment",
pan = "411111",
paymentSystem = "visa",
country = "EN",
commissionFrom = 0.1,
commissionTo = 0.25,
amountCreditedFrom = 15000,
amountCreditedTo = 150000,
amountCommissionFrom = 5000,
amountCommissionTo = 50000,
amountTotalFrom = 20000,
amountTotalTo = 200000,
customData = new
{
orderId = "72346",
userId = "8164"
},
dateCreateFrom = "2023-10-07",
dateCreateTo = "2023-11-29 17:59:45"
};
var data = new
{
sign = sign,
product = productId,
filter = filter,
limit = 10,
offset = 0
};
string jsonData = JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/transaction-list", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
productId := 2
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(productId)+secretKey)))
filter := map[string]interface{}{
"id": 220,
"parent": 25,
"type": "payment",
"pan": "411111",
"paymentSystem": "visa",
"country": "EN",
"commissionFrom": 0.1,
"commissionTo": 0.25,
"amountCreditedFrom": 15000,
"amountCreditedTo": 150000,
"amountCommissionFrom": 5000,
"amountCommissionTo": 50000,
"amountTotalFrom": 20000,
"amountTotalTo": 200000,
"customData": map[string]interface{}{
"orderId": "72346",
"userId": "8164",
},
"dateCreateFrom": "2023-10-07",
"dateCreateTo": "2023-11-29 17:59:45",
}
data := map[string]interface{}{
"sign": sign,
"product": productId,
"filter": filter,
"limit": 10,
"offset": 0,
}
jsonData, err := json.Marshal(data)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/transaction-list", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
Responses
List of transactions that meet the filter conditions
Response parameters
Example response
{
"count": 27238,
"items": [
{
"id": 221,
"parentId": null,
"type": "decline",
"card": {
"pan": "546960******7736",
"name": "VIKTORIIA SPASOVA",
"paymentSystem": "mastercard"
},
"currency": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"commission": 0.27,
"commissionFixed": 0,
"amountCredited": 1095,
"amountCommission": 405,
"amountTotal": 1500,
"amountSource": 1500,
"currencySource": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"customData": {
"orderId": "72346",
"userId": "8164"
},
"amountRolling": 0,
"rollingPeriod": 0,
"dateCreate": "2023-10-08T12:54:14+00:00",
"dateComplete": "2023-10-08T12:59:01+00:00"
},
{
"id": 220,
"parentId": null,
"type": "init",
"card": {
"pan": "435696******1492",
"name": "FEODORA DARII",
"paymentSystem": "visa"
},
"currency": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"commission": 0.27,
"commissionFixed": 0,
"amountCredited": 146,
"amountCommission": 54,
"amountTotal": 200,
"amountSource": 200,
"currencySource": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"amountRolling": 0,
"rollingPeriod": 0,
"customData": {},
"dateCreate": "2023-10-10T20:09:33+00:00",
"dateComplete": null
},
{
"id": 219,
"parentId": null,
"type": "payment",
"card": {
"pan": "220038******7008",
"name": "JULIA KOVALENKO",
"paymentSystem": "mir"
},
"currency": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"commission": 0.27,
"commissionFixed": 0,
"amountCredited": 146,
"amountCommission": 54,
"amountTotal": 200,
"amountSource": 200,
"currencySource": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"amountRolling": 0,
"rollingPeriod": 0,
"customData": {},
"dateCreate": "2023-10-11T23:19:32+00:00",
"dateComplete": "2023-10-11T23:26:48+00:00"
},
]
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Current balance
Getting a list of current balances with information about funds available for payout and blocked funds.
Parameters
Sign is calculated as md5(client + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/balance HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1
}
curl --location --request POST 'http://localhost:8085/api/balance' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1
}'
$clientId = 1;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($clientId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/balance',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'client' => $clientId,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(client_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'client': client_id,
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/balance',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(client_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/balance')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'client' => client_id,
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const clientId = 1;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(clientId + secretKey).digest('hex');
const data = {
sign: sign,
client: clientId,
};
try {
const response = await fetch('http://localhost:8085/api/balance', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class BalanceExample {
public static void main(String[] args) throws Exception {
int clientId = 1;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(clientId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"client\": " + clientId
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/balance"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val clientId = 1
val secretKey = "o87z5off7u0v2rw"
val sign = md5(clientId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"client": $clientId
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/balance"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int clientId = 1;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(clientId.ToString() + secretKey);
var data = new
{
sign = sign,
client = clientId
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/balance", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
clientId := 1
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(clientId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"client": clientId,
}
jsonData, err := json.Marshal(data)
if err != nil {
fmt.Println("Error marshaling JSON:", err)
return
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/balance", bytes.NewBuffer(jsonData))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
Responses
List of client balances, grouped by currencies
Response parameters
Example response
[
{
"currency": {
"code": "EUR",
"decimal": 2,
"name": "Euro"
},
"total": 52837509,
"rolling": 0
},
{
"currency": {
"code": "USD",
"decimal": 2,
"name": "Доллар США"
},
"total": 423624,
"rolling": 0
}
]
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Setting up payment details for payouts
Adding recipient details to the system for making payouts.
Parameters
Sign is calculated as md5(client + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payout-requisite HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"requisite": {
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк"
}
}
curl --location --request POST 'http://localhost:8085/api/payout-requisite' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"requisite": {
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк"
}
}'
$clientId = 1;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($clientId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payout-requisite',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'client' => $clientId,
'requisite' => [
'type' => 'card',
'value' => '4111111111111111',
'description' => 'Иванов сбербанк',
],
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(client_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'client': client_id,
'requisite': {
'type': 'card',
'value': '4111111111111111',
'description': 'Иванов сбербанк',
}
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payout-requisite',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(client_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payout-requisite')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'client' => client_id,
'requisite' => {
'type' => 'card',
'value' => '4111111111111111',
'description' => 'Иванов сбербанк',
}
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const clientId = 1;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(clientId + secretKey).digest('hex');
const data = {
sign: sign,
client: clientId,
requisite: {
type: 'card',
value: '4111111111111111',
description: 'Иванов сбербанк',
}
};
try {
const response = await fetch('http://localhost:8085/api/payout-requisite', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PayoutRequisiteExample {
public static void main(String[] args) throws Exception {
int clientId = 1;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(clientId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"client\": " + clientId + ","
+ "\"requisite\": {"
+ "\"type\": \"card\","
+ "\"value\": \"4111111111111111\","
+ "\"description\": \"Иванов сбербанк\""
+ "}"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout-requisite"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val clientId = 1
val secretKey = "o87z5off7u0v2rw"
val sign = md5(clientId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"client": $clientId,
"requisite": {
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк"
}
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout-requisite"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int clientId = 1;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(clientId.ToString() + secretKey);
var data = new
{
sign = sign,
client = clientId,
requisite = new
{
type = "card",
value = "4111111111111111",
description = "Иванов сбербанк"
}
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payout-requisite", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
clientId := 1
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(clientId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"client": clientId,
"requisite": map[string]interface{}{
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк",
},
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payout-requisite", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
Характеристики нового реквизита выплат
Response parameters
Example response
{
"id": 9,
"value": "7201234567",
"type": "sbp",
"currency": "EUR",
"description": "Иванов мегафон"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Getting a list of payout details
Getting a list of saved payment details for payouts with filtering by specified parameters
Parameters
Sign is calculated as md5(client + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payout-requisite-list HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"filter": {
"id": 123,
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк"
},
"limit": 10,
"offset": 0
}
curl --location --request POST 'http://localhost:8085/api/payout-requisite-list' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"filter": {
"id": 123,
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк"
},
"limit": 10,
"offset": 0
}'
$clientId = 1;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($clientId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payout-requisite-list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'client' => $clientId,
'filter' => [
'id' => 123,
'type' => 'card',
'value' => '4111111111111111',
'description' => 'Иванов сбербанк',
],
'limit' => 10,
'offset' => 0,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(client_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'client': client_id,
'filter': {
'id': 123,
'type': 'card',
'value': '4111111111111111',
'description': 'Иванов сбербанк',
},
'limit': 10,
'offset': 0
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payout-requisite-list',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(client_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payout-requisite-list')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'client' => client_id,
'filter' => {
'id' => 123,
'type' => 'card',
'value' => '4111111111111111',
'description' => 'Иванов сбербанк',
},
'limit' => 10,
'offset' => 0
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const clientId = 1;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(clientId + secretKey).digest('hex');
const data = {
sign: sign,
client: clientId,
filter: {
id: 123,
type: 'card',
value: '4111111111111111',
description: 'Иванов сбербанк',
},
limit: 10,
offset: 0
};
try {
const response = await fetch('http://localhost:8085/api/payout-requisite-list', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PayoutRequisiteListExample {
public static void main(String[] args) throws Exception {
int clientId = 1;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(clientId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"client\": " + clientId + ","
+ "\"filter\": {"
+ "\"id\": 123,"
+ "\"type\": \"card\","
+ "\"value\": \"4111111111111111\","
+ "\"description\": \"Иванов сбербанк\""
+ "},"
+ "\"limit\": 10,"
+ "\"offset\": 0"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout-requisite-list"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val clientId = 1
val secretKey = "o87z5off7u0v2rw"
val sign = md5(clientId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"client": $clientId,
"filter": {
"id": 123,
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк"
},
"limit": 10,
"offset": 0
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout-requisite-list"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int clientId = 1;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(clientId.ToString() + secretKey);
var data = new
{
sign = sign,
client = clientId,
filter = new
{
id = 123,
type = "card",
value = "4111111111111111",
description = "Иванов сбербанк"
},
limit = 10,
offset = 0
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payout-requisite-list", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
clientId := 1
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(clientId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"client": clientId,
"filter": map[string]interface{}{
"id": 123,
"type": "card",
"value": "4111111111111111",
"description": "Иванов сбербанк",
},
"limit": 10,
"offset": 0,
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payout-requisite-list", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
List of payout details that meet the filter conditions
Response parameters
Example response
{
"count": 2,
"items": [
{
"id": 8,
"value": "4111111111111111",
"type": "card",
"currency": "EUR",
"description": "Иванов сбербанк"
},
{
"id": 9,
"value": "7201234567",
"type": "sbp",
"currency": "RUB",
"description": "Иванов мегафон"
}
]
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Payout request
Creating a request to pay funds to the recipient using the specified payment details
Parameters
Sign is calculated as md5(client + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payout HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"requisite": 8,
"money": {
"amount": 100000,
"currency": "EUR"
}
}
curl --location --request POST 'http://localhost:8085/api/payout' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"requisite": 8,
"money": {
"amount": 100000,
"currency": "EUR"
}
}'
$clientId = 1;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($clientId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payout',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'client' => $clientId,
'requisite' => 8,
'money' => [
'amount' => 100000,
'currency' => 'EUR',
],
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(client_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'client': client_id,
'requisite': 8,
'money': {
'amount': 100000,
'currency': 'EUR',
}
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payout',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(client_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payout')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'client' => client_id,
'requisite' => 8,
'money' => {
'amount' => 100000,
'currency' => 'EUR',
}
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const clientId = 1;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(clientId + secretKey).digest('hex');
const data = {
sign: sign,
client: clientId,
requisite: 8,
money: {
amount: 100000,
currency: 'EUR',
}
};
try {
const response = await fetch('http://localhost:8085/api/payout', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PayoutExample {
public static void main(String[] args) throws Exception {
int clientId = 1;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(clientId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"client\": " + clientId + ","
+ "\"requisite\": 8,"
+ "\"money\": {"
+ "\"amount\": 100000,"
+ "\"currency\": \"EUR\""
+ "}"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val clientId = 1
val secretKey = "o87z5off7u0v2rw"
val sign = md5(clientId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"client": $clientId,
"requisite": 8,
"money": {
"amount": 100000,
"currency": "EUR"
}
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int clientId = 1;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(clientId.ToString() + secretKey);
var data = new
{
sign = sign,
client = clientId,
requisite = 8,
money = new
{
amount = 100000,
currency = "EUR"
}
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payout", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
clientId := 1
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(clientId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"client": clientId,
"requisite": 8,
"money": map[string]interface{}{
"amount": 100000,
"currency": "EUR",
},
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payout", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
Payout request has been successfully created and queued.
Response parameters
Example response
{
"id": 6,
"amount": 800000,
"amountCommission": 40000,
"amountSent": 0,
"amountSentCommission": 0,
"status": "pending",
"date": "2023-10-09T21:02:10+00:00"
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}
Getting a list of payouts
Getting a list of payouts with filtering by specified parameters
Parameters
Sign is calculated as md5(client + secretKey), secretKey will be specified in the personal account.
Code examples
POST /api/payout-list HTTP/1.1
Host: localhost:8085
Accept: application/json
Content-Type: application/json
{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"filter": {
"id": 123,
"status": "done",
"type": "card",
"requisite": 256,
"amountFrom": 1000,
"amountTo": 10000,
"amountSentFrom": 1000,
"amountSentTo": 10000,
"dateFrom": "2023-10-07",
"dateTo": "2023-11-22T08:43:00"
},
"limit": 10,
"offset": 0
}
curl --location --request POST 'http://localhost:8085/api/payout-list' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sign": "d135691a9cecc77b8921ad440d3967ed",
"client": 1,
"filter": {
"id": 123,
"status": "done",
"type": "card",
"requisite": 256,
"amountFrom": 1000,
"amountTo": 10000,
"amountSentFrom": 1000,
"amountSentTo": 10000,
"dateFrom": "2023-10-07",
"dateTo": "2023-11-22T08:43:00"
},
"limit": 10,
"offset": 0
}'
$clientId = 1;
$secretKey = 'o87z5off7u0v2rw';
$sign = md5($clientId . $secretKey);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://localhost:8085/api/payout-list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode([
'sign' => $sign,
'client' => $clientId,
'filter' => [
'id' => 123,
'status' => 'done',
'type' => 'card',
'requisite' => 256,
'amountFrom' => 1000,
'amountTo' => 10000,
'amountSentFrom' => 1000,
'amountSentTo' => 10000,
'dateFrom' => '2023-10-07',
'dateTo' => '2023-11-22T08:43:00',
],
'limit' => 10,
'offset' => 0,
]),
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import hashlib
import json
import urllib.request
import urllib.parse
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = hashlib.md5((str(client_id) + secret_key).encode()).hexdigest()
data = {
'sign': sign,
'client': client_id,
'filter': {
'id': 123,
'status': 'done',
'type': 'card',
'requisite': 256,
'amountFrom': 1000,
'amountTo': 10000,
'amountSentFrom': 1000,
'amountSentTo': 10000,
'dateFrom': '2023-10-07',
'dateTo': '2023-11-22T08:43:00',
},
'limit': 10,
'offset': 0
}
json_data = json.dumps(data).encode('utf-8')
req = urllib.request.Request(
'http://localhost:8085/api/payout-list',
data=json_data,
headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
},
method='POST'
)
try:
with urllib.request.urlopen(req) as response:
result = response.read().decode('utf-8')
print(result)
except urllib.error.HTTPError as e:
print(f"HTTP Error {e.code}: {e.reason}")
error_body = e.read().decode('utf-8')
print(error_body)
except urllib.error.URLError as e:
print(f"URL Error: {e.reason}")
except Exception as e:
print(f"Other error: {e}")
require 'digest'
require 'json'
require 'net/http'
require 'uri'
client_id = 1
secret_key = 'o87z5off7u0v2rw'
sign = Digest::MD5.hexdigest(client_id.to_s + secret_key)
uri = URI('http://localhost:8085/api/payout-list')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
data = {
'sign' => sign,
'client' => client_id,
'filter' => {
'id' => 123,
'status' => 'done',
'type' => 'card',
'requisite' => 256,
'amountFrom' => 1000,
'amountTo' => 10000,
'amountSentFrom' => 1000,
'amountSentTo' => 10000,
'dateFrom' => '2023-10-07',
'dateTo' => '2023-11-22T08:43:00',
},
'limit' => 10,
'offset' => 0
}
request = Net::HTTP::Post.new(uri)
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request.body = data.to_json
response = http.request(request)
puts response.body
import crypto from 'crypto';
const clientId = 1;
const secretKey = 'o87z5off7u0v2rw';
const sign = crypto.createHash('md5').update(clientId + secretKey).digest('hex');
const data = {
sign: sign,
client: clientId,
filter: {
id: 123,
status: 'done',
type: 'card',
requisite: 256,
amountFrom: 1000,
amountTo: 10000,
amountSentFrom: 1000,
amountSentTo: 10000,
dateFrom: '2023-10-07',
dateTo: '2023-11-22T08:43:00',
},
limit: 10,
offset: 0
};
try {
const response = await fetch('http://localhost:8085/api/payout-list', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
const result = await response.text();
console.log(result);
} catch (error) {
console.error('Request error:', error.message);
}
import java.io.*;
import java.net.http.*;
import java.net.URI;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PayoutListExample {
public static void main(String[] args) throws Exception {
int clientId = 1;
String secretKey = "o87z5off7u0v2rw";
String sign = md5(clientId + secretKey);
String jsonData = "{"
+ "\"sign\": \"" + sign + "\","
+ "\"client\": " + clientId + ","
+ "\"filter\": {"
+ "\"id\": 123,"
+ "\"status\": \"done\","
+ "\"type\": \"card\","
+ "\"requisite\": 256,"
+ "\"amountFrom\": 1000,"
+ "\"amountTo\": 10000,"
+ "\"amountSentFrom\": 1000,"
+ "\"amountSentTo\": 10000,"
+ "\"dateFrom\": \"2023-10-07\","
+ "\"dateTo\": \"2023-11-22T08:43:00\""
+ "},"
+ "\"limit\": 10,"
+ "\"offset\": 0"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout-list"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String md5(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(input.getBytes());
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.net.URI
import java.security.MessageDigest
fun main() {
val clientId = 1
val secretKey = "o87z5off7u0v2rw"
val sign = md5(clientId.toString() + secretKey)
val jsonData = """
{
"sign": "$sign",
"client": $clientId,
"filter": {
"id": 123,
"status": "done",
"type": "card",
"requisite": 256,
"amountFrom": 1000,
"amountTo": 10000,
"amountSentFrom": 1000,
"amountSentTo": 10000,
"dateFrom": "2023-10-07",
"dateTo": "2023-11-22T08:43:00"
},
"limit": 10,
"offset": 0
}
""".trimIndent()
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:8085/api/payout-list"))
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
fun md5(input: String): String {
val md = MessageDigest.getInstance("MD5")
val digest = md.digest(input.toByteArray())
return digest.joinToString("") { "%02x".format(it) }
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
class Program
{
static async Task Main(string[] args)
{
int clientId = 1;
string secretKey = "o87z5off7u0v2rw";
string sign = ComputeMD5Hash(clientId.ToString() + secretKey);
var data = new
{
sign = sign,
client = clientId,
filter = new
{
id = 123,
status = "done",
type = "card",
requisite = 256,
amountFrom = 1000,
amountTo = 10000,
amountSentFrom = 1000,
amountSentTo = 10000,
dateFrom = "2023-10-07",
dateTo = "2023-11-22T08:43:00"
},
limit = 10,
offset = 0
};
string jsonData = System.Text.Json.JsonSerializer.Serialize(data);
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Accept", "application/json");
var response = await client.PostAsync("http://localhost:8085/api/payout-list", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
static string ComputeMD5Hash(string input)
{
using (MD5 md5 = MD5.Create())
{
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("x2"));
}
return sb.ToString();
}
}
}
package main
import (
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"net/http"
"strconv"
)
func main() {
clientId := 1
secretKey := "o87z5off7u0v2rw"
sign := fmt.Sprintf("%x", md5.Sum([]byte(strconv.Itoa(clientId)+secretKey)))
data := map[string]interface{}{
"sign": sign,
"client": clientId,
"filter": map[string]interface{}{
"id": 123,
"status": "done",
"type": "card",
"requisite": 256,
"amountFrom": 1000,
"amountTo": 10000,
"amountSentFrom": 1000,
"amountSentTo": 10000,
"dateFrom": "2023-10-07",
"dateTo": "2023-11-22T08:43:00",
},
"limit": 10,
"offset": 0,
}
jsonData, err := json.Marshal(data)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", "http://localhost:8085/api/payout-list", bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
Responses
List of payouts that meet the filter conditions
Response parameters
Example response
{
"count": 2,
"items": [
{
"id": 5,
"amount": 400000,
"amountCommission": 20000,
"amountSent": 3900.00,
"amountSentCommission": 100.00,
"status": "done",
"date": "2023-10-30T15:21:52+00:00"
},
{
"id": 6,
"amount": 800000,
"amountCommission": 40000,
"amountSent": 0,
"amountSentCommission": 0,
"status": "error",
"date": "2023-11-22T17:46:18+00:00"
}
]
}
Input data is not valid
Response parameters
Example response
{
"code": "10",
"message": "Invalid request",
"fields": {
"money.currency": {
"message": "This value is not a valid currency."
},
"card.name": {
"message": "This value should not be blank."
},
"payer.email": {
"message": "This value is not a valid email address."
},
"payer.phone": {
"message": "This value is too short. It should have from 11 to 13 digits."
}
}
}
Failed to perform the operation
Response parameters
Example response
{
"code": "00",
"message": "Internal Server Error"
}