ENGENG
ENGENG
PORPOR
RUSRUS

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 data
  • 201 - Successful creation of a new entity
  • 400 - Request validation error
  • 403 - Access to the operation denied
  • 404 - API method not found
  • 405 - Unsupported HTTP method (POST required)
  • 406 - Request is missing Accept header or unsupported data format is specified
  • 415 - Request is missing Content-Type header or unsupported data type is specified
  • 500 - 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 gateway
  • 1x - Input data validation errors. Occur when data does not meet API requirements
  • 2x - Preprocessing errors that occur during the preparation or verification of data for payment execution
  • 3x - 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 system
  • 10 - General data validation error. Possibly, a required field is missing in the request or data is specified in an incorrect format
  • 20 - General preprocessing error. Occurs if the payment does not comply with internal payment processing rules
  • 21 - Failed to identify the country in which the card was issued
  • 23 - Daily limit on the number or amount of operations allowed for this card has been exceeded
  • 25 - 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 code
  • 31 - Error processing payment by the acquiring bank gateway
  • 32 - Payment confirmation error from the bank gateway. Possibly, restrictions were imposed by the bank
  • 33 - The current transaction status does not allow the requested operation to be performed. For example, an attempt to confirm an already completed payment
  • 34 - 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.

POSThttp://localhost:8085/api/payment

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
product
Integer
Product identifier
2
Yes
money.amount
Integer
Payment amount (in minor units)
10000
Yes
money.currency
String
Currency
EUR
Yes
card.pan
String
Card number
4111111111111111
Yes
card.expMonth
String
Month
09
Yes
card.expYear
String
Year
2028
Yes
card.cvv
String
CVV/CVC code from the back of the card
123
Yes
card.name
String
Card owner's name
JOHN DOE
Yes
payer.email
String
Buyer's email address
john@doe.com
Yes
payer.phone
String
Buyer's mobile phone
447899226230
Yes
payer.ip
String
Buyer's IP address
136.226.191.72
Yes
payer.userAgent
String
Buyer's browser UserAgent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
Yes
payer.country
String
Buyer's country
BR
Yes
payer.state
String
Buyer's region
MG
No
payer.city
String
Buyer's city
Ouro Preto
No
payer.district
String
Buyer's district
Bauxita
No
payer.street
String
Buyer's street
Av JK
No
payer.building
String
Buyer's house number
909
No
payer.zipcode
String
Buyer's postal code
35400000
No
payer.birth
String
Buyer's date of birth
1990-01-15
No
payer.cpf
String
Buyer's CPF (only for Brazilian citizens)
94271564656
No
customData
Map<String, String>
Any client data in "key: value" format
{"orderId": "72346", "userId": "8164"}
No
merchant
String
Unique merchant identifier if the client is a PSP that serves other merchants. For PSP, the parameter is mandatory, others can ignore it
52137
No

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
init
Yes
date
String
Date
2022-10-42 11:01:56
Yes
acsUrl
String
Acs Url
https://ds2.mirconnect.ru:443/sc1/pareq
Yes
paReq
String
PaReq
eJxUUV1v4jAQ/Cuo72H9ESBGW0t8nER0aoWgle7VNQvk7gjBcRD997UhKe...
Yes
md
String
MD
KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuqWwFUoRBkzDr5J7oU-ad6e3500...
Yes

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
payment
Yes
date
String
Transaction creation date
2023-10-12 08:58:21
Yes

Example response

{
    "transactionId": 234134,
    "type": "payment",
    "date": "2023-10-12 08:58:21"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error message
Invalid request
Yes
fields
Map<String, Map<String, String>>
If the error is related to validation of specific fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
31
Yes
message
String
Error message
Payment declined
Yes

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).

POSThttp://localhost:8085/acs/redirect

Parameters

Name
Type
Description
Example
Required
acsUrl
String
Acs Url
https://ds2.mirconnect.ru:443/sc1/pareq
Yes
paReq
String
PaReq
eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...
Yes
md
String
MD
KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuq...
Yes
termUrl
String
URL to which the user will return from ACS
https://example.com
Yes

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.

POSThttp://localhost:8085/api/complete

Parameters

Name
Type
Description
Example
Required
paRes
String
PaRes
eJzVWNmuo0qy%2FZWj6kerDqMxPnJtKRm...
Yes
md
String
MD
KktK3gTaXYBRFbWKUu5bLB5ooP7pEyfuq...
Yes

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
payment
Yes
date
String
Transaction creation date
2023-10-12 08:58:21
Yes

Example response

{
    "transactionId": 234134,
    "type": "payment",
    "date": "2023-10-12 08:58:21"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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.

POSThttp://localhost:8085/api/payment/p2p

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
product
Integer
Product identifier
2
Yes
money.amount
Integer
Payment amount (in minor units)
10000
Yes
money.currency
String
Currency
EUR
Yes
payer.email
String
Buyer's email address
john@doe.com
Yes
payer.phone
String
Buyer's mobile phone
447899226230
No
payer.ip
String
Buyer's IP address
136.226.191.72
Yes
payer.userAgent
String
Buyer's browser UserAgent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
No
payer.country
String
Buyer's country
BR
No
customData
Map<String, String>
Any client data in "key: value" format
{"orderId": "72346", "userId": "8164"}
No
merchant
String
Unique merchant identifier if the client is a PSP and serves other merchants. For PSP, the parameter is mandatory, others can ignore it
52137
No

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
init
Yes
date
String
Transaction creation date
2023-11-23 19:42:33
Yes

Example response

{
    "transactionId": 348524,
    "type": "init",
    "date": "2023-11-23 19:42:33"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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.

POSThttp://localhost:8085/api/payment/p2p/requisite

Parameters

Name
Type
Description
Example
Required
sign
string
Request signature
934002f5c8ce49c788c1a8d74a4a5e18
Yes
transaction
Integer
Payment identifier
348524
Yes
requisiteType
String
Selected type of payment details. Possible options: card, sbp
sbp
Yes

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
init
Yes
date
String
Transaction creation date
2023-11-23 19:42:33
Yes
requisite
Object
Payment details for P2P transfer
{...}
Yes
requisite.amount
Integer
Transfer amount (in minor units). May differ from the original payment amount
80010
Yes
requisite.type
String
Payment detail type
sbp
Yes
requisite.value
String
Card number, phone number, or wallet number (depending on the type) for funds transfer
sbp
Yes
requisite.description
String
Additional information
Зубайру Ш.
No
requisite.bank
String
Bank name
alfabank
No

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

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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.

POSThttp://localhost:8085/api/payment/p2p/confirm

Parameters

Name
Type
Description
Example
Required
sign
string
Request signature
934002f5c8ce49c788c1a8d74a4a5e18
Yes
transaction
Integer
Payment identifier
348524
Yes

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
pending
Yes
date
String
Transaction creation date
2023-11-23 19:42:33
Yes

Example response

{
    "transactionId": 348524,
    "type": "pending",
    "date": "2023-11-23 19:42:33"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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

POSThttp://localhost:8085/api/payment/p2p/receipt

Parameters

Name
Type
Description
Example
Required
sign
string
Request signature
934002f5c8ce49c788c1a8d74a4a5e18
Yes
transaction
Integer
Payment identifier
348524
Yes
receipt
String
Payment receipt in base64
JVBERi0xLjUKJeLjz9MKNCAwIG9iago8PC9Db2xvclNwYWNlL0Rldml...
Yes

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
pending
Yes
date
String
Transaction creation date
2023-11-23 19:42:33
Yes

Example response

{
    "transactionId": 348524,
    "type": "pending",
    "date": "2023-11-23 19:42:33"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

Example response

{
    "code": "00",
    "message": "Internal Server Error"
}

PIX Payment

Accepting payments through the Brazilian instant transfer system PIX using QR codes.

POSThttp://localhost:8085/api/payment/pix

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
product
Integer
Product identifier
2
Yes
money.amount
Integer
Payment amount (in minor units)
10000
Yes
money.currency
String
Currency
BRL
Yes
pix.cpf
String
Individual taxpayer number in Brazil
12345678909
Yes
pix.name
String
Payer's name
Francisco da Silva
Yes
payer.email
String
Buyer's email address
john@doe.com
Yes
payer.phone
String
Buyer's mobile phone
447899226230
Yes
payer.ip
String
Buyer's IP address
136.226.191.72
Yes
payer.userAgent
String
Buyer's browser UserAgent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
No
payer.country
String
Buyer's country
BR
No
payer.state
String
Buyer's region
MG
No
payer.city
String
Buyer's city
Ouro Preto
No
payer.district
String
Buyer's district
Bauxita
No
payer.street
String
Buyer's street
Av JK
No
payer.building
String
Buyer's house number
909
No
payer.zipcode
String
Buyer's postal code
35400000
No
payer.birth
String
Buyer's date of birth
1990-01-15
No
payer.cpf
String
Individual taxpayer number in Brazil
94271564656
No
customData
Map<String, String>
Any client data in "key: value" format
{"orderId": "72346", "userId": "8164"}
No
merchant
String
Unique merchant identifier if the client is a PSP and serves other merchants. For PSP, the parameter is mandatory, others can ignore it
52137
No

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
init
Yes
date
String
Transaction creation date
2023-10-15 17:03:42
Yes
pixCopiaECola
String
PIX Copia e Cola - string for copying and pasting in the banking app
00020101021243650016COM.MERCADOLIBRE020130636e657d620c72c47ffaa3a8ce629656d2b5204000053039865802BR5925EFIPAY INSTITUICAO DE PAGAM6009SAO PAULO61080540900062070503***6304E2D7
Yes
image
String
QR code image for making a payment, encoded in base64
iVBORw0KGgoAAAANSUhEUgAABLAAAASwAQAAAABzbtprAAABJ0lEQVR42u3dS3KEMAyE4X7Oc3C+c5zj7Oc4...
Yes
link
String
Link to the page with payment description and QR code for making a payment
https://pix.sejaefi.com.br/cob/pagar/e657d620c72c47ffaa3a8ce629656d2b
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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

Name
Type
Description
Example
Required
sign
String
Notification signature
2e323fe1571752af70f59e72a59a84bd
Yes
transaction
Object
Transaction object
{}
Yes
transaction.id
Integer
Transaction identifier
234134
Yes
transaction.parentId
Integer
Parent transaction identifier
1500
No
transaction.type
String
Transaction type. Possible options:chargeback, decline, duplicate, init, payment, pending, refund, refund_init, refund_decline
payment
Yes
transaction.paymentMethod.pan
String
Card number (masked)
546960******7736
Yes
transaction.paymentMethod.name
String
Card holder's name (or something instead of it)
VIKTORIIA SPASOVA
Yes
transaction.paymentMethod.paymentSystem
String
Payment system. Possible options:amex, cabal, cirrus, dinacard, diners, discover, visa, electron, maestro, mastercard, mir, jcb, interpayment, ourocard, uatp, unionpay, unknown
mastercard
Yes
transaction.currency
Object
Currency in which calculations with the client are made (balance deposits, payouts, statistics)
{}
Yes
transaction.currency.code
String
Currency code according to ISO 4217 standard
EUR
Yes
transaction.currency.decimal
Integer
Number of decimal places
2
Yes
transaction.currency.name
String
Currency name
Euro
Yes
transaction.commission
Float
Commission charged by the service. Specified as a fraction of a unit, i.e., 1 is 100%, and 0.08 is 8%
0.11
Yes
transaction.commissionFixed
Float
Fixed commission charged by the service (in minor units). Added to the commission described above
0
Yes
transaction.amountCredited
Integer
Amount credited to the client's balance (in minor units)
1095
Yes
transaction.amountCommission
Integer
Amount of commission charged (in minor units)
405
Yes
transaction.amountTotal
Integer
Total transaction amount (in minor units)
1500
Yes
transaction.amountSource
Integer
Amount transferred by the client to the payment gateway (in minor units). The currency itself is specified in the transaction.currencySource field
1500
Yes
transaction.currencySource.code
String
Currency code according to ISO 4217 standard
EUR
Yes
transaction.currencySource.decimal
Integer
Number of decimal places
2
Yes
transaction.currencySource.name
String
Currency name
Euro
Yes
transaction.amountRolling
Integer
Rolling amount (in minor units)
0
Yes
transaction.rollingPeriod
Integer
Rolling period (in days)
180
Yes
transaction.customData
Map<String, String>
Any client data in "key: value" format
{"orderId": "72346", "userId": "8164"}
No
transaction.dateCreate
String
Transaction creation date (ISO 8601)
2023-10-17T13:47:53+00:00
Yes
transaction.dateComplete
String
Transaction completion date (ISO 8601). For incomplete transactions will have null value
2023-10-17T13:52:16+00:00
No

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.

POSThttp://localhost:8085/api/refund

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
a985127c12ced236eaf06c2e5932ed73
Yes
transaction
Integer
ID of the returned payment
1573
Yes

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
4187
Yes
type
String
Transaction status
refund
Yes
date
String
Date
2023-10-29 13:32:19
Yes

Example response

{
    "transactionId": 4187,
    "type": "refund",
    "date": "2023-10-29 13:32:19"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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.

POSThttp://localhost:8085/api/rebill

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
a985127c12ced236eaf06c2e5932ed73
Yes
transaction
Integer
ID of the parent payment
1573
Yes
money.amount
Integer
Payment amount (in minor units). If not specified, the parent payment amount will be used
20000
No
money.currency
String
Currency. If not specified, the parent payment currency will be used
EUR
No
customData
Map<String, String>
Any client data in "key: value" format
{"orderId": "72346", "userId": "8164"}
No

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

Name
Type
Description
Example
Required
transactionId
Integer
Transaction identifier
234134
Yes
type
String
Transaction status
payment
Yes
date
String
Date
2023-11-05 12:03:29
Yes

Example response

{
    "transactionId": 234134,
    "type": "payment",
    "date": "2023-11-05 12:03:29"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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

POSThttp://localhost:8085/api/transaction-list

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
7ade5b8d547549c6bc9893a441cca355
Yes
product
Integer
Product identifier
2
Yes
filter.id
Integer
Transaction identifier for exact match search
123
No
filter.idFrom
Integer
Transaction identifier from which the search will begin
10
No
filter.idTo
Integer
Transaction identifier at which the search will end
100
No
filter.parent
Integer
Parent transaction identifier
25
No
filter.type
String
Transaction type. Possible options:chargeback, decline, duplicate, init, payment, pending, refund, refund_init, refund_decline
payment
No
filter.pan
String
Card number. Partial match search is possible
411111
No
filter.paymentSystem
String
Payment system. Possible options:amex, cabal, cirrus, dinacard, diners, discover, visa, electron, maestro, mastercard, mir, jcb, interpayment, ourocard, uatp, unionpay, unknown
visa
No
filter.country
String
Country to which the card is issued, in ISO 3166-1 alpha-2 format
EN
No
filter.commissionFrom
Float
Commission charged by the service (as a fraction of a unit)
0.10
No
filter.commissionTo
Float
Commission charged by the service (as a fraction of a unit)
0.25
No
filter.amountCreditedFrom
Integer
Amount credited to the client's balance (in minor units)
15000
No
filter.amountCreditedTo
Integer
Amount credited to the client's balance (in minor units)
150000
No
filter.amountCommissionFrom
Integer
Minimum amount of commission charged (in minor units)
5000
No
filter.amountCommissionTo
Integer
Maximum amount of commission charged (in minor units)
50000
No
filter.amountTotalFrom
Integer
Total transaction amount (in minor units)
20000
No
filter.amountTotalTo
Integer
Total transaction amount (in minor units)
200000
No
filter.customData
Map<String, String>
Any client data in "key: value" format
{"orderId": "72346", "userId": "8164"}
No
filter.dateCreateFrom
String
Transaction creation date from which the search begins (ISO 8601)
2023-10-07
No
filter.dateTo
String
Transaction creation date that ends the search (ISO 8601)
2023-11-29 17:59:45
No
limit
Integer
Limit on the number of returned transactions
10
Yes
offset
Integer
Offset
0
Yes

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

Name
Type
Description
Example
Required
count
Integer
Общее количество транзакций, соответствующих указанным параметрам
27238
Yes
items
List<Object>
List of transactions, their number will be equal to the limit specified in the request (or less)
[{...}, {...}]
Yes
items[i].id
Integer
Transaction identifier
5
Yes
items[i].parentId
Integer
Parent transaction identifier
1500
No
items[i].type
String
Transaction type. Possible options:chargeback, decline, duplicate, init, payment, pending, refund, refund_init, refund_decline
payment
Yes
items[i].paymentMethod.pan
String
Card number (masked)
546960******7736
Yes
items[i].paymentMethod.name
String
Card holder's name (or something instead of it)
VIKTORIIA SPASOVA
Yes
items[i].paymentMethod.paymentSystem
String
Payment system. Possible options:amex, cabal, cirrus, dinacard, diners, discover, visa, electron, maestro, mastercard, mir, jcb, interpayment, ourocard, uatp, unionpay, unknown
visa
Yes
items[i].currency
Object
Currency in which calculations with the client are made (balance deposits, payouts, statistics)
{}
Yes
items[i].currency.numCode
String
Numeric currency code according to ISO 4217 standard
978
Yes
items[i].currency.charCode
String
Currency code according to ISO 4217 standard
EUR
Yes
items[i].currency.name
String
Currency name
Euro
Yes
items[i].commission
Float
Commission charged by the service
0.27
Yes
items[i].commissionFixed
Float
Fixed commission charged by the service (in minor units)
0
Yes
items[i].amountCredited
Integer
Amount credited to the client's balance (in minor units)
1095
Yes
items[i].amountCommission
Integer
Amount of commission charged (in minor units)
405
Yes
items[i].amountTotal
Integer
Total transaction amount (in minor units)
1500
Yes
items[i].amountSource
Integer
Amount transferred by the client to the payment gateway (in minor units). The currency is specified in the items[i].currencySource field
1500
Yes
items[i].currencySource.code
String
Currency code according to ISO 4217 standard
EUR
Yes
items[i].currencySource.decimal
Integer
Number of decimal places
2
Yes
items[i].currencySource.name
String
Currency name
Euro
Yes
items[i].amountRolling
Integer
Rolling amount (in minor units)
0
Yes
items[i].rollingPeriod
Integer
Rolling period (in days)
180
Yes
items[i].customData
Map<String, String>
Any client data in "key: value" format
{"orderId": "72346", "userId": "8164"}
Yes
items[i].dateCreate
String
Transaction creation date (ISO 8601)
2023-10-08T12:54:14+00:00
Yes
items[i].dateComplete
String
Transaction completion date (ISO 8601). For incomplete transactions will have null value
2023-10-08T12:59:01+00:00
No

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

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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.

POSThttp://localhost:8085/api/balance

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
client
Integer
Client identifier
1
Yes

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

Name
Type
Description
Example
Required
currency
Object
Extended information about the balance currency
{"code":"USD","decimal": 2,"name":"Dollar USA"}
Yes
currency.code
String
Currency code of the balance. Both national currencies and cryptocurrencies are possible
USD
Yes
currency.decimal
Integer
Number of decimal places allowed for this currency
USD
Yes
currency.name
String
Currency name
Dollar USA
Yes
total
Integer
Total balance (in minor units)
25747893
Yes
rolling
Integer
Rolling amount frozen for a long period (for example, half a year). Not included in the total balance. When unfrozen, funds are subtracted from the rolling balance and added to the total
0
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

Example response

{
    "code": "00",
    "message": "Internal Server Error"
}

Setting up payment details for payouts

Adding recipient details to the system for making payouts.

POSThttp://localhost:8085/api/payout-requisite

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
client
Integer
Client identifier
1
Yes
requisite.type
String
Payment detail type. Available options:card, sbp, pix, bitcoin, tether-erc20, tether-trc20
card
Yes
currency
String
Currency of the payment details. Some types of payment details allow accepting different currencies, so it's necessary to specify a specific one
EUR
Yes
requisite.value
String
Payment detail value. Card number, phone, wallet, etc.
4111111111111111
Yes
requisite.description
String
Payment detail description. Any additional information in free format
Иванов сбербанк
No

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

Name
Type
Description
Example
Required
id
Integer
Payout detail identifier
9
Yes
type
String
Payment detail type. Available options:card, sbp, pix, bitcoin, tether-erc20, tether-trc20
sbp
Yes
currency
String
Currency of the payment details. Some types of payment details allow accepting different currencies, so it's necessary to specify a specific one
EUR
Yes
value
String
Payment detail value. Card number, phone, wallet, etc.
7201234567
Yes
description
String
Payment detail description. Any additional information in free format
Иванов мегафон
Yes

Example response

{
    "id": 9,
    "value": "7201234567",
    "type": "sbp",
    "currency": "EUR",
    "description": "Иванов мегафон"
}

Input data is not valid

Response parameters

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

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

POSThttp://localhost:8085/api/payout-requisite-list

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
client
Integer
Client identifier
1
Yes
filter.id
Integer
Payout detail identifier
123
No
filter.type
String
Payment detail type. Available options:card, sbp, pix, bitcoin, tether-erc20, tether-trc20
card
No
filter.value
String
Payment detail value. Card number, phone, wallet, etc. Can be filtered by partial match
411111
No
filter.description
String
Payment detail description. Can be filtered by partial match
Иванов сбербанк
No
limit
Integer
Limit on the number of returned payout details
10
Yes
offset
Integer
Offset
0
Yes

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

Name
Type
Description
Example
Required
count
Integer
Total number of payout details matching the specified parameters
2
Yes
items
List<Object>
List of payout details, their number will be equal to the limit specified in the request (or less)
[{...}, {...}]
Yes
items[i].id
Integer
Payout detail identifier
8
Yes
items[i].type
String
Payment detail type. Available options:card, sbp, pix, bitcoin, tether-erc20, tether-trc20
card
Yes
items[i].currency
String
Currency of the payment details. Some types of payment details allow accepting different currencies, so it's necessary to specify a specific one
EUR
Yes
items[i].value
String
Payment detail value. Card number, phone, wallet, etc.
4111111111111111
Yes
items[i].description
String
Payment detail description. Any additional information in free format
Иванов сбербанк
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

Example response

{
    "code": "00",
    "message": "Internal Server Error"
}

Payout request

Creating a request to pay funds to the recipient using the specified payment details

POSThttp://localhost:8085/api/payout

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
client
Integer
Client identifier
1
Yes
requisite
Integer
Payment detail identifier
8
Yes
money.amount
Integer
Payout amount (in minor units)
100000
Yes
money.currency
String
Currency of the balance from which money will be debited
EUR
Yes

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

Name
Type
Description
Example
Required
payoutId
Integer
Payout identifier
6
Yes
status
String
Payout status
pending
Yes
amount
Integer
Amount debited from the balance (in minor units)
800000
Yes
amountCommission
Integer
Amount of commission taken (in minor units)
800000
Yes
amountSent
Float
Amount actually sent to the specified payment details. In the currency specified in the payment details. Not in minor units, as currencies are assumed, the number of decimal places may differ from two. Before the actual sending, it will have a value of 0.
0
Yes
amountSentCommission
Float
Commission amount taken by the payment provider. Not in minor units, as currencies are assumed, the number of decimal places may differ from two. Before the actual sending, it will have a value of 0.
0
Yes
date
String
Payout request date
2023-10-09T21:02:10+00:00
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

Example response

{
    "code": "00",
    "message": "Internal Server Error"
}

Getting a list of payouts

Getting a list of payouts with filtering by specified parameters

POSThttp://localhost:8085/api/payout-list

Parameters

Name
Type
Description
Example
Required
sign
String
Request signature
d135691a9cecc77b8921ad440d3967ed
Yes
client
Integer
Client identifier
1
Yes
filter.id
Integer
Payout identifier
123
No
filter.status
String
Payout status. Available options:cancel, done, error, init, pending
done
No
filter.type
String
Type of payment detail to which the payout was made
card
No
filter.requisite
Integer
Identifier of the payment detail to which the payout was made
256
No
filter.amountFrom
Integer
Payout amount debited from the balance (in minor units)
100000
No
filter.amountTo
Integer
Payout amount debited from the balance (in minor units)
1000000
No
filter.amountSentFrom
Integer
Payout amount sent to the payment details (in the currency of the payment details)
20000
No
filter.amountSentTo
Integer
Payout amount sent to the payment details (in the currency of the payment details)
200000
No
filter.dateFrom
String
Payout date from which the search begins (ISO 8601)
2023-10-07
No
filter.dateTo
String
Payout date that ends the search (ISO 8601)
2023-11-22T08:43:00
No
limit
Integer
Limit on the number of returned payouts
10
Yes
offset
Integer
Offset
0
Yes

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

Name
Type
Description
Example
Required
count
Integer
Total number of payouts matching the specified parameters
2
Yes
items
List<Object>
List of payouts, their number will be equal to the limit specified in the request (or less)
[{...}, {...}]
Yes
items[i].id
Integer
Payout identifier
5
Yes
items[i].amount
Integer
Payout amount (in minor units)
400000
Yes
items[i].amountCommission
Integer
Amount of commission taken (in minor units)
20000
Yes
items[i].amountSent
Integer
Amount sent to the specified payment details. In the currency specified in the payment details. Not in minor units, as currencies are assumed, the number of decimal places may differ from two.
3900.00
Yes
items[i].amountSentCommission
Integer
Commission amount taken by the payment provider. Not in minor units, as currencies are assumed, the number of decimal places may differ from two.
100.00
Yes
items[i].status
String
Payout status. Available options:cancel, done, error, init, pending
done
Yes
items[i].date
String
Payout order date (ISO 8601)
2023-10-30T15:21:52+00:00
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
10
Yes
message
String
Error description
Invalid request
Yes
fields
Map<String, {message: String}>
If the error is related to validation of specific request fields - more detailed information for each field will be provided here
{sign: {message: "Signature calculated incorrectly."}}
Yes

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

Name
Type
Description
Example
Required
code
Integer
Error code
00
Yes
message
String
Error message
Internal Server Error
Yes

Example response

{
    "code": "00",
    "message": "Internal Server Error"
}