API · v1

API docs

One request creates an invoice; a signed webhook tells you it is paid. You can build and test the integration with a test key before the project is approved. The whole docs in one file for an AI assistant — docs.md.

Contents
  1. Quick start
  2. Basics
  3. API keys and authorization
  4. Methods
    1. Project
    2. Create an invoice
    3. Invoice currencies
    4. Get an invoice
    5. Address for a crypto payment
    6. SBP QR without the payment form
    7. List invoices
    8. Balance
    9. Simulate a payment
    10. Refund the buyer
  5. The invoice
    1. Statuses
    2. The fee and the amount to pay
    3. The invoice payment
    4. Accounting in USDT
    5. Idempotency
    6. Project limits
  6. Payment form appearance
    1. Get appearance
    2. Update appearance
    3. Upload the logo
    4. Remove the logo
  7. Project bot
    1. Get the project bot
    2. Link the bot
    3. Unlink the bot
  8. The form in the shop’s Telegram bot
  9. Payment method buttons
  10. Test mode
  11. Webhooks
    1. The event
    2. Headers
    3. Endpoint requirements
    4. Where webhooks come from
    5. Delivery and retries
    6. Test events
    7. The queue
  12. Signature check
  13. Errors
  14. Request limits
  15. Support

Quick start#

Code is optional: an invoice can be issued right in the bot — the “New invoice” button in the project card. The API is for building payments into a website or a bot.

See the payment as a buyer does right away: a test invoice in the bot opens the form with “pay” and “decline” buttons, no money is charged.

  1. Get a test key

    Create a project — with a request on the site or right in @ExPay_Agent — and issue a test key in the bot: it starts with eo_test_. The key is shown once, so save it right away. A test key works even before the project is approved.

    Shell
    export EO_TEST_TOKEN="eo_test_…"
  2. Create an invoice

    Request
    curl https://oplata.express/v1/invoices \
      -H "Authorization: Bearer $EO_TEST_TOKEN" -H "Content-Type: application/json" \
      -d '{
        "amount": "1425.00",
        "order_id": "A-17",
        "description": "Order #17"
      }'
    Response
    {
      "id": "EO-TEST1234",
      "order_id": "A-17",
      "status": "open",
      "amount": "1425.00",
      "pay_url": "https://oplata.express/pay/?order=Zk3…",
      "test": true,
      "…": "…"
    }

    Give the pay_url link to the buyer: it opens the payment form.

  3. Receive the webhook

    Set the webhook address in the bot — https only. Do it before the payment: if there is no address at the moment of payment, no event is created.

    Complete the test invoice: call simulate, or open pay_url and press the “payment succeeded” button.

    Request
    curl https://oplata.express/v1/invoices/EO-TEST1234/simulate \
      -H "Authorization: Bearer $EO_TEST_TOKEN" -H "Content-Type: application/json" \
      -d '{"result":"success"}'

    Your address receives invoice.paid with "test": true. In the handler:

    1. take the raw request body — before parsing JSON;
    2. verify the signature with the key derived from the test key;
    3. deduplicate by the ExpressOplata-Event-Id header;
    4. respond with any 2xx within 10 seconds.
  4. Switch to the live key

    Once the project is approved, issue a live key eo_live_… in the bot and use it instead of the test one. Addresses, requests and the webhook format stay the same; live events are signed with a key derived from the live key.

    Never deliver goods on an event with "test": true.

Basics#

Base URL
https://oplata.express/v1/…
Authorization
The Authorization: Bearer <project token> header.
Format
JSON in UTF-8. A request body is at most 16 KB.
Amounts
Strings in roubles with two decimals: "1425.00". On input "1425", "1425.5" and "1425,50" are accepted; the number 1425.5 is not.
Time
Unix epoch seconds (UTC).
Request ID
Every response carries the X-Request-Id header; in an error the same value is in request_id.

API keys and authorization#

eo_live_…live
Real invoices and real money. Works only for a project in the active status.
eo_test_…test
Test invoices with no bank and no money. Works in the draft, moderation and active statuses — you can build the integration before approval.
  • A key is shown once, when issued: only its hash is stored.
  • Reissuing the live key disables the previous one at once.
  • The live and the test key each see their own invoices.
  • The webhook signing key is SHA-256(token), 32 bytes. There is no separate secret.

Methods#

GET/v1/me Project#

Request
curl https://oplata.express/v1/me -H "Authorization: Bearer $EO_TOKEN"
Response
{
  "id": "prj_3f9a1c0b7d2e4a55",
  "name": "Shop",
  "status": "active",
  "sbp_status": "approved",
  "test": false,
  "fee_bps": 300,
  "fee_bps_by_method": { "sbp": 300, "cryptobot": 300, "xrocket": 300, "crypto": 0 },
  "fee_payer": "merchant",
  "fee_buyer_share": 0,
  "hold_hours": 24,
  "limits": { "min_usdt": "5.00", "max_usdt": "500.00", "daily_usdt": "5000.00" },
  "webhook_url": "https://shop.example/hooks/expressoplata",
  "webhook_enabled": true,
  "return_url": null
}
test
The request was made with a test key.
sbp_status
The project’s access to SBP payments: none — not requested, requested — under review, approved — approved, rejected — declined. Until SBP is approved, the project’s live invoices cannot be paid by SBP: the method is missing from the form and from pay_urls, the other methods work. Test invoices are not affected.
fee_bps_by_method
The platform fee per payment method, in basis points (300 = 3%): sbp, cryptobot, xrocket, crypto (an on-chain transfer). A new project has 3% on SBP and the wallets and 0% on crypto; the rates are changed by the platform’s support.
fee_bps
The same as fee_bps_by_method.sbp; kept for compatibility.
fee_buyer_share
The part of the fee, in percent (0–100), the buyer pays on top of the invoice amount; one for all methods, the rest is withheld from the payment — see the fee.
fee_payer
The same in a word: merchant — share 0 (the default), buyer — 100, split — 1 to 99 (50, for example, is half and half). Set in the bot with the “Fee is paid by” button.
hold_hours
How many hours after an SBP payment the money becomes available for payout: 24 by default, less (down to 0) if the platform’s support shortened it on your request. Payments in crypto, with the CryptoBot and xRocket wallets and by your own methods (byo:<provider>) are available at once.
limits
The smallest and the largest invoice amount and the daily turnover, in USDT (a string with two decimals); null means no limit.
webhook_enabled
false if no address is set or the webhook is switched off.
surcharge_bps
Deprecated, kept for compatibility: always 0 for cryptobot, xrocket, crypto. The method rates are in fee_bps_by_method.

The values in the sample are illustrative: your project’s fee, hold and limits are shown in the bot and in this response.

The project’s terms cannot be changed through the API: who pays the fee and the webhook and return addresses are changed in the bot, a shorter SBP hold is on request through support.

POST/v1/invoices Create an invoice#

amountrequired
The amount as a string in roubles, from "1.00" to "2000000.00". With currency: "USDT" — the amount in USDT as a string ("19.99") or a number, at most two decimals. In another currency — a string or a number with no more decimals than the currency’s exponent in GET /v1/currencies: two for EUR, none for JPY ("1500").
currencyoptional
What the price is named in: "RUB" (the default), "USDT" or a currency code from GET /v1/currencies ("EUR", "KZT", …), in any letter case — see accounting in USDT.
order_idoptional
Your order number, up to 64 characters. Must not start with test: in any letter case. It is the idempotency key.
descriptionoptional
The line under the project name on the payment form, up to 160 characters. A wallet address in it is 400 bad_description.
return_urloptional
Where to send the buyer after payment: https only, up to 500 characters. If omitted, the project’s return address is used.
ttl_minutesoptional
The invoice lifetime: a whole number of minutes from 5 to 43,200 (30 days). The default is 24 hours.
metadataoptional
Any JSON object up to 2000 characters. It comes back in the invoice and in the webhook; the buyer never sees it.
Request
curl https://oplata.express/v1/invoices \
  -H "Authorization: Bearer $EO_TOKEN" -H "Content-Type: application/json" \
  -d '{
    "amount": "1425.00",
    "order_id": "A-17",
    "description": "Order #17",
    "metadata": {"user": "u1"}
  }'
Node.js
// Creates an invoice and prints the payment link. Node 18+, create.mjs
const res = await fetch("https://oplata.express/v1/invoices", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.EO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    amount: "1425.00",
    order_id: "A-17",
    description: "Order #17",
    metadata: { user: "u1" },
  }),
});
const invoice = await res.json().catch(() => ({}));
if (!res.ok) {
  console.error(res.status, invoice.error?.code);
  process.exit(1);
}
console.log(invoice.pay_url);
Python
"""Creates an invoice and prints the payment link."""
import json
import os
import sys
import urllib.error
import urllib.request

body = {"amount": "1425.00", "order_id": "A-17", "description": "Order #17", "metadata": {"user": "u1"}}
request = urllib.request.Request(
    "https://oplata.express/v1/invoices",
    data=json.dumps(body, ensure_ascii=False).encode(),
    headers={"Authorization": "Bearer " + os.environ["EO_TOKEN"], "Content-Type": "application/json"},
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=30) as response:
        invoice = json.load(response)
except urllib.error.HTTPError as error:
    try:
        code = json.load(error)["error"]["code"]
    except (ValueError, KeyError, TypeError):
        code = None
    sys.exit(f"{error.code} {code}")
print(invoice["pay_url"])
PHP
<?php

// Creates an invoice and prints the payment link.
$ch = curl_init('https://oplata.express/v1/invoices');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode([
        'amount' => '1425.00',
        'order_id' => 'A-17',
        'description' => 'Order #17',
        'metadata' => ['user' => 'u1'],
    ], JSON_UNESCAPED_UNICODE),
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('EO_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
]);
$raw = curl_exec($ch);
if ($raw === false) {
    fwrite(STDERR, curl_error($ch) . PHP_EOL);
    exit(1);
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$invoice = json_decode($raw, true);
if ($status < 200 || $status >= 300) {
    fwrite(STDERR, $status . ' ' . ($invoice['error']['code'] ?? '') . PHP_EOL);
    exit(1);
}
echo $invoice['pay_url'], PHP_EOL;
Go
// Creates an invoice and prints the payment link.
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"time"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"amount":      "1425.00",
		"order_id":    "A-17",
		"description": "Order #17",
		"metadata":    map[string]string{"user": "u1"},
	})
	req, _ := http.NewRequest(http.MethodPost, "https://oplata.express/v1/invoices", bytes.NewReader(body))
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EO_TOKEN"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := (&http.Client{Timeout: 30 * time.Second}).Do(req)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	defer resp.Body.Close()
	var invoice struct {
		PayURL string `json:"pay_url"`
		Error  struct {
			Code string `json:"code"`
		} `json:"error"`
	}
	err = json.NewDecoder(resp.Body).Decode(&invoice)
	if resp.StatusCode/100 != 2 {
		fmt.Fprintln(os.Stderr, resp.StatusCode, invoice.Error.Code)
		os.Exit(1)
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	fmt.Println(invoice.PayURL)
}

201 means the invoice was created; 200 means an invoice with this order_id already existed and is returned.

Response
{
  "id": "EO-7K2M9QXA",
  "order_id": "A-17",
  "status": "open",
  "amount": "1425.00",
  "amount_to_pay": "1425.00",
  "currency": "RUB",
  "amount_usdt": "17.26",
  "rate": "82.5486",
  "price": "1425.00",
  "price_currency": "RUB",
  "price_rate": null,
  "description": "Order #17",
  "metadata": { "user": "u1" },
  "pay_url": "https://oplata.express/pay/?order=Zk3…",
  "mini_app_url": "https://t.me/…?startapp=Zk3…",
  "telegram_app_url": "https://t.me/ExPay_Agent/pay?startapp=Zk3…",
  "pay_urls": {
    "sbp": "https://oplata.express/pay/?order=Zk3…&method=sbp",
    "cryptobot": "https://oplata.express/pay/?order=Zk3…&method=cryptobot",
    "…": "…"
  },
  "telegram_pay_urls": { "sbp": "https://t.me/ExPay_Agent/pay?startapp=Zk3…_sbp", "…": "…" },
  "return_url": null,
  "test": false,
  "created_at": 1800000000,
  "expires_at": 1800086400,
  "paid_at": null,
  "refund": null
}
pay_url
The link to the payment form — this is what you give the buyer.
mini_app_url
The same form as a Telegram mini app; null if the form’s bot is not set up.
telegram_app_url
The same form as a mini app of our bot @ExPay_Agent — exactly like the “Pay” button under an invoice issued in a chat via @ExPay_Agent. You can give the link to the buyer in any Telegram chat: the form opens inside Telegram, and we know which Telegram account opened it (see the form in the shop’s Telegram bot). null until the mini app is enabled.
pay_urls, telegram_pay_urls
Links to the form opened right on a payment method, keyed sbp | cryptobot | xrocket | crypto; only the methods the invoice can be paid with now. telegram_pay_urls is null until the mini app is enabled. See payment method buttons.
status
open, paid or expired — see statuses.
payment_method, payment
Only on a paid invoice: how it was paid and how much the buyer paid — see the invoice payment.
amount
The amount you asked for.
amount_to_pay
What the buyer pays — see the fee.
amount_usdt, rate
The invoice amount in USDT and the Rapira rate (roubles per 1 USDT) it was counted at when the invoice was created — see accounting in USDT.
price, price_currency, price_rate
The price as you named it. For a rouble invoice price = amount and price_currency = "RUB", for a USDT invoice — the USDT amount and "USDT". For an invoice in another currency — the price in it ("25.00", "1500" for the yen), currency equals price_currency, and price_rate is the currency’s rate to USDT (units per 1 USDT, up to eight decimals) that amount_usdt was worked out at; for other invoices price_rate is null.
refund
The refund to the buyer for this invoice — an object as in the POST /v1/invoices/{id}/refund response; null means there was no refund.

GET/v1/currencies Invoice currencies#

Request
curl https://oplata.express/v1/currencies -H "Authorization: Bearer $EO_TOKEN"
Response
{
  "items": [
    { "code": "RUB", "exponent": 2, "rate": "82.5486", "updated_at": 1800000000 },
    { "code": "USDT", "exponent": 2, "rate": "1", "updated_at": 1800000000 },
    { "code": "EUR", "exponent": 2, "rate": "0.9128", "updated_at": 1799999820 },
    { "code": "JPY", "exponent": 0, "rate": "168.1", "updated_at": 1799999820 }
  ]
}

The currencies an invoice can be issued in right now. The list changes with the rates — do not store it on your side.

code
The code for the currency field.
exponent
How many decimals are allowed in amount.
rate
The rate to USDT: units of the currency per 1 USDT; for roubles — the Rapira rate.
updated_at
When the rate was obtained.
  • RUB is always listed; without the Rapira rate its rate and updated_at are null.
  • USDT and the others — only with a fresh Rapira rate, the others also need a fresh P2P market rate; USD (rate 1) always comes with USDT.
  • The rate is for reference: an invoice takes a fresh one at the moment of creation.

Besides RUB and USDT, these are supported: USD, EUR, GBP, CHF, PLN, CZK, HUF, RON, BGN, RSD, SEK, NOK, DKK, TRY, KZT, UZS, KGS, TJS, AMD, GEL, AZN, BYN, UAH, MDL, CNY, HKD, TWD, JPY, KRW, INR, PKR, BDT, LKR, NPR, IDR, VND, THB, MYR, PHP, SGD, MNT, AED, SAR, QAR, KWD, BHD, OMR, JOD, ILS, EGP, MAD, NGN, KES, GHS, UGX, TZS, ZAR, XOF, XAF, BRL, ARS, MXN, COP, CLP, PEN, BOB, PYG, UYU, VES, CAD, AUD, NZD. Only those with a fresh rate right now appear in the response.

GET/v1/invoices/{id} Get an invoice#

Request
curl https://oplata.express/v1/invoices/EO-7K2M9QXA -H "Authorization: Bearer $EO_TOKEN"

The response is the same invoice object. An invoice of another project or of the other mode is 404 not_found.

POST/v1/invoices/{id}/crypto Address for a crypto payment#

  • Available only while the platform accepts crypto; otherwise 404 not_found. Live key only, and only for your own unpaid invoice.
  • The body is {"network": "TRON", "asset": "USDT"}. If only one network and coin are available now, the body may be empty ({}), otherwise without a choice it is 400 network_required.
  • Issues an address the buyer sends exactly the stated amount to: in USDT — amount_usdt plus the buyer’s part of the fee at the crypto rate (fee_bps_by_method.crypto, 0% by default; at the invoice rate, rounded up to a cent); in another coin — at the quote of the moment the address is issued. The balance gets amount_usdt minus your part of the fee; an overpayment is credited on top. Addresses issued before 16.11.2026 are settled by the old rule: amount_usdt, no fee.
  • While the address is alive, a repeat returns the same address and no SBP invoice is issued for this invoice; while an SBP invoice is alive — 409 invoice_active.
Request
curl -X POST https://oplata.express/v1/invoices/EO-7K2M9QXA/crypto -H "Authorization: Bearer $EO_TOKEN" \
  -H "Content-Type: application/json" -d '{"network":"TRON","asset":"USDT"}'

The response is the invoice object with the crypto block:

Response
{
  "id": "EO-7K2M9QXA",
  "status": "open",
  "amount_usdt": "12.50",
  "…": "…",
  "payment_method": null,
  "crypto": {
    "network": "TRON",
    "asset": "USDT",
    "address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
    "amount": "12.50",
    "status": "pending",
    "expires_at": 1800001800,
    "credited_usdt": null,
    "memo": null
  }
}
network
TRON, ETH, BSC, POLYGON, ARBITRUM, BASE, OPTIMISM, BTC, BCH, LTC, DOGE, TON, SOLANA. Letter case does not matter.
asset
USDT, USDC or the network’s own coin (TRX, ETH, BNB, POL, BTC, BCH, LTC, DOGE, GRAM, SOL). Which networks and coins are accepted now is switched on by the platform: an unavailable pair is 400 crypto_unavailable.
crypto.memo
TON (the GRAM and USDT coins): one address for everyone — address of the UQ… form, and the invoice is recognised by the transfer comment memo (the invoice number, EO-…). Without the comment the transfer is not credited — show it to the buyer next to the address. Other networks, Solana (SOL, USDT, USDC) included, give each invoice its own address, memo is null.
crypto.status
pending — waiting for the transfer; paid; expired — the address lifetime ran out, a new address is a repeated call while the invoice is alive and more than 10 minutes remain; cancelled — the buyer dropped the address on the form before the first transfer, a new address is a repeated call; failed — the address is withdrawn: the transfers failed on the rate or there are over 20 of them without the amount, support sorts them out, a new address is a repeated call.
crypto.credited_usdt
How much was credited, with paid; otherwise null. The invoice’s amount_usdt stays the invoice amount.
  • Only the named coin in the named network is accepted: another coin or network is not credited.
  • Crediting happens after the transfer is checked in the network itself by several independent sources and the required number of confirmations.
  • Several transfers to the address within its lifetime add up; once at least the amount is reached, the invoice is paid, and an overpayment is credited to you in full.
  • Short by the deadline, a transfer after the deadline or to a cancelled address, a repeated one, one in another coin — not credited automatically: the platform’s support sorts it out, the invoice stays open.
  • The payment comes as the usual invoice.paid webhook with "payment_method": "crypto"; the invoice carries the crypto block only while crypto is accepted and an address was issued.
network_required400
No network and coin chosen while several are available.
crypto_unavailable400
This network or coin is unavailable now.
crypto_unavailable409
A test invoice, an invoice without a USDT amount.
crypto_min409
The amount is below the network’s minimum — each network has its own, message says which.
order_expiring409
Less than 10 minutes left before the invoice expires.
order_paid409
The invoice is already paid.
invoice_active409
An SBP invoice is issued for this invoice and is still alive.
order_expired410
The invoice has expired.
too_many429
Too many requests.
provider502
A provider failure — try again later.
network_unavailable, rate_unavailable503
The network or the rate cannot be checked now — repeat.

POST/v1/invoices/{id}/sbp SBP QR without the payment form#

Enabled on request — write to support; without it, 403 sbp_direct_off. Use it when you show the buyer the QR code yourself in your bot or on your site instead of sending them to the payment form. The bank checks every payment, so you pass the buyer’s data — the same our payment form collects when the buyer opens it:

  • customer_ip — the buyer’s IP address (IPv4 or IPv6) they opened your site from. Without it, or with a private or reserved address — 400 customer_ip_required.
  • fingerprint — the buyer’s device fingerprint collected in their browser. Without it or without the required fields — 400 fingerprint_required (message says which fields are missing).

Pass the buyer’s real data collected on their device. The bank rejects made-up data or data that is the same for every buyer, and the project risks being switched off.

user_agentrequired
navigator.userAgent
screen_resolutionrequired
screen.width + "x" + screen.height, e.g. "390x844"
timezonerequired
Intl.DateTimeFormat().resolvedOptions().timeZone, e.g. "Europe/Moscow"
platformrequired
navigator.platform
languagesrequired
navigator.languages, a list, e.g. ["ru-RU", "ru"]
available_screen_resolution
screen.availWidth + "x" + screen.availHeight
timezone_offset
new Date().getTimezoneOffset(), minutes
color_depth
screen.colorDepth
touch_support
whether there is a touch screen, true/false
hardware_concurrency
navigator.hardwareConcurrency
device_memory
navigator.deviceMemory
cookie_enabled, do_not_track, java_enabled, plugins_support, battery
true/false
product, product_sub, vendor
navigator.product, navigator.productSub, navigator.vendor
video_card_vendor, video_card_render
the graphics card vendor and model from WebGL

Leave out what the browser did not give: the same default as the form’s is used.

Request
curl -X POST https://oplata.express/v1/invoices/EO-7K2M9QXA/sbp -H "Authorization: Bearer $EO_TOKEN" \
  -H "Content-Type: application/json" -d '{"customer_ip":"203.0.113.7",
  "fingerprint":{"user_agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) …","screen_resolution":"390x844",
  "timezone":"Europe/Moscow","timezone_offset":-180,"platform":"iPhone","languages":["ru-RU","ru"],"color_depth":24,
  "touch_support":true}}'

The response is the invoice object with the sbp block:

Response
{ "id": "EO-7K2M9QXA", "status": "open", "amount": "1250.00", "…": "…",
  "sbp": { "qr_url": "https://qr.nspk.ru/AD10…", "status": "pending", "expires_at": 1800003600 } }
  • qr_url — the NSPK QR link. Draw a QR code from it for a computer screen; on a phone the same link opens the buyer’s bank app — give it as a button.
  • status — pending (waiting for payment), expired, failed. expires_at — when the QR stops accepting payment, seconds.
  • While the QR is alive, a repeat returns the same QR. Expired or failed — a repeated call issues a new one.
  • The payment comes as the usual invoice.paid webhook with "payment_method": "sbp". A paid invoice has no sbp block (null).
  • The rules are those of SBP payment on the form: SBP must be approved for the project; while a crypto address is alive — 409 invoice_active; frequent attempts on one invoice — 429 too_many; the bank issued no QR — 502 provider (try again in a minute).
  • With a test key — a test QR: pay it with POST /v1/invoices/{id}/simulate.

GET/v1/invoices List invoices#

status
open, paid or expired.
from, to
Creation time in epoch seconds: from is inclusive, to is not.
limit
From 1 to 100, 20 by default.
offset
From 0 to 100,000.

Invoices come newest first.

Request
curl "https://oplata.express/v1/invoices?status=paid&from=1800000000&limit=50" -H "Authorization: Bearer $EO_TOKEN"
Response
{
  "items": [
    { "id": "EO-7K2M9QXA", "status": "paid", "…": "…" }
  ],
  "has_more": false
}

has_more: true — repeat the request with offset increased by limit.

GET/v1/balance Balance#

Request
curl https://oplata.express/v1/balance -H "Authorization: Bearer $EO_TOKEN"
Response
{ "currency": "USDT", "total_usdt": "11.75", "available_usdt": "11.75", "hold_usdt": "0.00" }
total_usdt
Everything on the project’s account.
available_usdt
Can be paid out now.
hold_usdt
SBP payments that become available after the hold.

The balance is in USDT only: the total of payments (each in USDT at the rate of the moment its invoice was created) less the fee and payouts; the bot shows the same balance. Test payments do not change it, and a test key sees the same balance.

POST/v1/invoices/{id}/simulate Simulate a payment#

Test key only, and only for a test invoice of your own project. The body is {"result":"success"} or {"result":"fail"}.

Request
curl https://oplata.express/v1/invoices/EO-TEST1234/simulate \
  -H "Authorization: Bearer $EO_TEST_TOKEN" -H "Content-Type: application/json" \
  -d '{"result":"success"}'

The response is the invoice object.

success
The invoice becomes paid and the invoice.paid webhook is sent with "test": true. Repeating it for a paid invoice changes nothing.
fail
A simulated bank decline: the invoice stays open and the buyer may try again. No webhook is sent.

An expired invoice is 409 invoice_expired. A live key is 403 test_only.

POST/v1/invoices/{id}/refund Refund the buyer#

Refunds through the API are off until you switch them on in the bot: “API key” → “Enable refunds via API”. Until then the call is 403 scope_required. The permission belongs to the project, not to a single key: once on, it covers all live keys of the project, including ones issued later. If you issue a new key to replace a leaked one, decide again whether refunds through the API are needed. The refund button in the bot works without this.

Request
curl -X POST https://oplata.express/v1/invoices/EO-7K2M9QXA/refund -H "Authorization: Bearer $EO_TOKEN"

The body is empty or {}, anything else is 400 bad_request. The whole payment is returned, there are no partial refunds; the bank returns the money to the buyer.

Response
{
  "id": "rfd_5b0c1f3e9a7d2c41",
  "invoice_id": "EO-7K2M9QXA",
  "status": "sent",
  "amount_usdt": "16.74",
  "initiator": "api",
  "failure_reason": null,
  "created_at": 1800003600,
  "updated_at": 1800003601
}
amount_usdt
What is debited from the balance: what was credited to you for this invoice — the payment minus the platform fee, in USDT at the invoice rate.
status
requested — requested, the bank has not given a real answer yet (a failure, a rate limit): we repeat the request with the same idempotency key — the bank will not open a second refund — and find out the outcome from the bank ourselves. sent — the bank accepted the refund. succeeded — the money is back with the buyer. failed — the bank declined, the debited amount is back on the balance.
failure_reason
With failed — "bank_declined", otherwise null.
  • The platform fee is non-refundable. The debit happens at once, on request. Not enough available balance — 409 insufficient_balance: a refund never puts the balance in debt. Money on hold does not count as available: while a payment is on hold, it cannot be refunded.
  • Only a live invoice paid by SBP through the main bank can be refunded, within the refund period after payment — 30 days by default.
  • One refund per invoice. A repeated request returns the refund already opened (200, the same id) and does not go to the bank again — the request is safe to repeat.
  • The outcome arrives as the refund.succeeded or refund.failed webhook. failed → succeeded also happens: the bank returned the payment later after all — then the amount is debited from the balance again and refund.succeeded arrives.
  • A refund the bank declined (failed) cannot be requested through the API again — from there, only through support.
  • The refund is also shown in the invoice: the refund field of GET /v1/invoices/{id}.
  • At most 30 refund requests per minute per project, beyond that — 429 rate_limited.
scope_required403
Refunds through the API are not enabled for the project in the bot.
invoice_not_paid409
The invoice is not paid.
refund_unsupported409
A test invoice or a test key, a payment through the backup bank, a payment in crypto, with the CryptoBot or xRocket wallet or by a method on your own keys, a payment older than our records — such a refund goes through support.
fx_pending409
The payment’s exchange rate is not recorded yet — try again later.
refund_expired409
The refund period after payment is over.
dispute_open409
A bank dispute is open on the payment — refund after the dispute is settled.
already_refunded409
The payment has already been charged back in a dispute.
insufficient_balance409
Not enough available balance.
refund_unavailable409
Refunds are not enabled on the service yet.

The invoice#

Statuses#

open
Waiting for payment.
paid
Paid.
expired
The lifetime ran out and the invoice was not paid.

The fee and the amount to pay#

amount is what you asked for; amount_to_pay is what the buyer pays. The difference is the part of the fee the buyer pays: it is set by the project’s fee_buyer_share and fee_payer fields (GET /v1/me).

merchant
amount_to_pay = amount. The balance receives amount_usdt minus the fee: a 1000.00 invoice at 3% puts the USDT of 970.00 on the balance.
buyer
amount_to_pay = amount + fee, the fee is rounded up to a kopeck. The balance receives exactly amount_usdt: for a 1000.00 invoice at 3% the buyer pays 1030.00, and the balance gets the USDT of 1000.00.
split
The fee is shared. The buyer’s part is fee_buyer_share% of the fee, rounded up to a kopeck; amount_to_pay = amount + the buyer’s part, the balance gets amount minus the rest: for a 1000.00 invoice at 3% with a share of 50 the buyer pays 1015.00, and the balance gets the USDT of 985.00.
  • The rate belongs to the payment method (fee_bps_by_method), the buyer’s share is one for all methods.
  • The rates of all methods and the share are fixed in the invoice when it is created, whatever the fee_payer: a change of rate or share does not affect existing invoices.
  • A new invoice’s amount_to_pay is worked out at the SBP rate. When the buyer picks a wallet or crypto, the amount to pay is recalculated at that method’s rate: the CryptoBot or xRocket invoice and the crypto address are issued in USDT — amount_usdt plus the buyer’s part at the invoice rate, rounded up to a cent. On a paid invoice amount_to_pay is what was issued to the payment method.
  • The bank’s amount limit (up to 2,000,000 ₽) is checked against amount_to_pay, that is, including the buyer’s part of the fee.

Example: a 1000.00 ₽ invoice (≈ 10.00 USDT), rates SBP 3%, CryptoBot 5%, crypto 0%, buyer’s share 50.

SBP
The buyer pays 1015.00 ₽, the balance gets 9.85 USDT.
CryptoBot
The buyer pays 10.25 USDT, the balance gets 9.75 USDT.
Crypto
The buyer pays 10.00 USDT, the balance gets 10.00 USDT.

The invoice payment#

A paid invoice — in responses and in the webhook — always has payment_method and the payment block; an unpaid one has neither.

payment
{
  "method": "crypto",
  "paid_cents": 1025,
  "paid_currency": "USDT",
  "network": "TRON",
  "asset": "USDT",
  "tx_hash": "a3f1…"
}
payment_method
sbp, crypto, cryptobot or xrocket (paid in the CryptoBot or xRocket Telegram wallet on the payment form). byo:<provider>, byo:binance for example, — paid by a method on your own keys: the money is with you at once, it is not part of the project’s balance and turnover, and the payment block fields are null (except the deprecated ones, see below).
paid_cents, paid_currency
How much the buyer paid in the method’s currency, including their part of the fee: USD (CryptoBot), USDT (xRocket, crypto: what was credited, overpayment included), RUB (SBP: what was paid in roubles, in kopecks).
network, asset, tx_hash
Only for crypto: the network, the coin and the transaction hash; null for the rest.
surcharge_bps, surcharge_cents
Deprecated: 0 on new payments, the buyer’s part of the fee is not written there — it shows in amount_to_pay and paid_cents. Non-zero values occur only on payments issued before 16.11.2026.

Accounting in USDT#

The project’s balance and turnover are in USDT only, while the buyer always pays in roubles (amount, amount_to_pay). Each payment is counted in USDT at the USDT/RUB exchange rate (Rapira) at the moment the invoice is created: amount_usdt is the invoice amount in USDT (a string, two decimals), rate is the rate, roubles per 1 USDT (a string, four decimals). Both are recorded when the invoice is created and never change: a payment the next day, at another rate, does not change the USDT amount.

  • A rouble invoice — amount_usdt = roubles / rate, to the cent.
  • A USDT invoice (currency: "USDT") — you name the price in USDT, amount_usdt equals it, and amount in the response is roubles: the USDT amount × the Rapira rate at the moment of creation, rounded up to a kopeck. Example: 25 USDT at 82.5486 gives "amount": "2063.72". The balance receives exactly the named USDT minus the withheld part of the fee (with fee_payer = buyer — exactly the named USDT).
  • An invoice in another currency ({"amount":"25","currency":"EUR"}) — the price is in euros (tenge, zloty, …), the buyer pays in roubles. The price is converted to USDT at the currency’s rate to USDT on the exchanges’ P2P markets (Binance, Bybit, OKX): a market’s rate is the midpoint between buying and selling USDT in its order book, the currency’s rate is the median of the markets that agree with each other (at least two). The USDT amount is rounded up to a cent — you never get less than the named price. From there it works like a USDT invoice: roubles at the Rapira rate, the USDT amount goes to the accounts. Example: 25 EUR at 0.92 EUR per 1 USDT gives "amount_usdt": "27.18", and at the Rapira rate of 82.5486 — "amount": "2243.68".
  • The currency’s rate is taken fresh at the moment of creation (at most 15 minutes old) and is written into the invoice for good together with the price. No fresh rate (the markets do not answer or disagree) — 503 rate_unavailable, retryable: true; a currency outside the supported list — 400 bad_currency. Project limits and the bank’s amount range are checked as for a USDT invoice. The US dollar is pegged to USDT 1:1: a USD invoice always has the rate 1 ("price_rate": "1"), 25 USD = "amount_usdt": "25.00".
  • Compatibility: an invoice’s currency equals the price currency only for invoices created in that currency. An integration that issues invoices in RUB and USDT never sees "EUR" or other new codes in responses or webhooks.
  • If the rate was unavailable when a rouble invoice was created, it is recorded later — the one the exchange had at that moment; until then the response holds an estimate at the last known rate, and the payment reaches the balance once the rate is recorded. Both fields are null only if there is no rate at all.
Request
curl https://oplata.express/v1/invoices -H "Authorization: Bearer $EO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount": "25", "currency": "USDT", "order_id": "A-18"}'

The bank’s overall amount range ("1.00"–"2000000.00" roubles) is checked against the resulting roubles, the project limits against the USDT amount. If the rate is stale (the exchange has not answered for over 10 minutes), a USDT invoice is not created: 503 rate_unavailable with retryable: true — try again later.

Idempotency#

  • A repeat with the same order_id and the same amount returns the same invoice (200); the other fields of the repeated request are ignored.
  • The same order_id with a different amount or in another currency is 409 conflict. A USDT invoice is compared by its USDT amount, an invoice in another currency by its price in it: a repeat later, at another rate, returns the same invoice with the same amounts.
  • Without order_id every request creates a new invoice.
  • Order numbers of the live and the test mode never clash.

Project limits#

Limits are in USDT and are checked when an invoice is created, against its USDT amount. A violation is 422 limit_exceeded; message says which limit was hit and its value.

  • The amount is below min_usdt or above max_usdt.
  • The daily turnover would exceed daily_usdt. The turnover is the total amount_usdt of the project’s live invoices created since 00:00 UTC today and not expired: the paid ones and those that can still be paid (an invoice created without a rate counts at the rate of its creation moment).
  • An expired unpaid invoice frees the limit.
  • Test invoices do not count towards the turnover; the amount limits do apply to them.

A project sees its own limits in the GET /v1/me response.

Payment form appearance#

The logo, the name and the tagline in the receipt header, the “Seller support” link, the project colour, the theme and the return button label. Any key can read them, only the live key can change them (403 live_only): the appearance is shared by live and test invoices.

  • The appearance is shown only for an active project (active).
  • The “Payment via ExpressOplata” line is always on the form.
  • All /v1/brand* methods — at most 30 requests per hour per project, logo upload — 10 per hour; beyond that — 429 rate_limited.

GET/v1/brand Get appearance#

Request
curl https://oplata.express/v1/brand -H "Authorization: Bearer $EO_TOKEN"

Any key can read it. The response holds the current settings and the draft under review (pending), as in the PATCH /v1/brand response.

PATCH/v1/brand Update appearance#

Live key only, otherwise 403 live_only.

Request
curl -X PATCH https://oplata.express/v1/brand \
  -H "Authorization: Bearer $EO_TOKEN" -H "Content-Type: application/json" \
  -d '{
    "color": "#1d4ed8",
    "name": "Keys 24/7",
    "tagline": "Game keys delivered instantly",
    "support": "@keys_help",
    "return_text": "Back to shop"
  }'
colorat once
#RRGGBB — the strip along the top of the receipt, the logo plate and the dot by the name. The form buttons are always graphite.
return_textat once
The label of the return button after payment, up to 24 characters.
themeat once
The form theme: check (the standard “Receipt”, the default), poster, terminal, chat, ticket, letter, arcade, quiet. See each one in the form gallery.
nameafter review
The name in the receipt header, up to 60 characters; without it — the project name.
taglineafter review
The line under the name, up to 80 characters.
supportafter review
The “Seller support” link: https://…, t.me/… or @name (like the link in the request); without it — the contact from the request, if that is a link.
  • Only the fields you name change; null or "" restores the default at once.
  • A value that a moderator reviews goes into pending and reaches the form once approved; until then buyers see the previous one.
  • Texts must have no HTML markup, no invisible characters and no wallet addresses: otherwise 400 bad_name, bad_tagline, bad_return_text. The buyer pays only by the details on the form.
  • A wrong colour, theme or support link is 400 bad_color, bad_theme, bad_support; an unknown field or a value that is not a string is 400 bad_request.
Response
{
  "logo_url": null,
  "color": "#1D4ED8",
  "name": null,
  "tagline": null,
  "support": null,
  "return_text": "Back to shop",
  "theme": "check",
  "pending": {
    "logo_url": null,
    "name": "Keys 24/7",
    "tagline": "Game keys delivered instantly",
    "support": "https://t.me/keys_help",
    "submitted_at": 1800000060
  },
  "updated_at": 1800000060
}

PUT/v1/brand/logo Upload the logo#

Live key only. The body is the image itself; any Content-Type, the format is detected from the content. PNG, JPEG or WebP up to 1 MB, sides from 128 to 4096 pixels and at most 16 megapixels.

Request
curl -X PUT https://oplata.express/v1/brand/logo -H "Authorization: Bearer $EO_TOKEN" --data-binary @logo.png

The image is redrawn into a transparent square up to 256 × 256 and saved as PNG without metadata. The logo goes into the draft (pending.logo_url) and waits for a moderator. The response is the appearance settings.

bad_logo400
A broken file.
bad_logo_size400
The image sides are out of range.
logo_too_large413
Over 1 MB.
bad_logo_format415
SVG and GIF are not accepted.
busy503
The image processing queue has been busy for over 10 seconds — try again later.

DELETE/v1/brand/logo Remove the logo#

Request
curl -X DELETE https://oplata.express/v1/brand/logo -H "Authorization: Bearer $EO_TOKEN"

Removes the logo — both the approved one and the one in the draft. The response is the appearance settings.

Project bot#

The number of the shop’s Telegram bot in which buyers open the form with a web_app button — see the form in the shop’s Telegram bot. Any key can read it, only the live key can change it (403 live_only).

  • PUT and DELETE — at most 20 per hour per project, beyond that — 429 rate_limited: a bot is linked once.

GET/v1/telegram-bot Get the project bot#

Request
curl https://oplata.express/v1/telegram-bot -H "Authorization: Bearer $EO_TOKEN"

Any key can read it.

Response
{
  "project_id": "prj_99169e8bfe06d7c0",
  "bot_id": "7700123456",
  "bot_username": "shop_bot",
  "updated_at": 1800000060
}

bot_id: null means no bot is linked.

PUT/v1/telegram-bot Link the bot#

Live key only, otherwise 403 live_only.

Request
curl -X PUT https://oplata.express/v1/telegram-bot \
  -H "Authorization: Bearer $EO_TOKEN" -H "Content-Type: application/json" \
  -d '{"bot_id": "7700123456", "bot_username": "shop_bot"}'
bot_idrequired
The bot number only: the digits before the colon in its token (7700123456:AAH… → 7700123456). As a string or a number. Never send the whole token or publish it anywhere — we do not need it.
bot_usernameoptional
The bot username without @, for support.
Response
{
  "project_id": "prj_99169e8bfe06d7c0",
  "bot_id": "7700123456",
  "bot_username": "shop_bot",
  "updated_at": 1800000060
}
bad_bot_id400
Not a bot number — for example, the whole token was sent.
bad_bot_username400
The name does not look like a bot username.
live_only403
The request was made with a test key.
rate_limited429
Over 20 changes per hour per project.

DELETE/v1/telegram-bot Unlink the bot#

Request
curl -X DELETE https://oplata.express/v1/telegram-bot -H "Authorization: Bearer $EO_TOKEN"

The form in the bot keeps opening, but we stop knowing who opened it. Live key only (403 live_only). The response is as for GET, with bot_id: null.

The form in the shop’s Telegram bot#

If you have your own Telegram bot, the payment form can open right in it — with a web_app button. The buyer never leaves the bot, and when contacted, our support sees which Telegram user opened and paid the invoice.

  1. Link the bot to the project

    Once: PUT /v1/telegram-bot with the bot number.

  2. Show the pay button

    For each invoice, show the buyer a button with the pay_url address:

    reply_markup
    {"inline_keyboard": [[{"text": "Pay 1 425 ₽",
      "web_app": {"url": "https://oplata.express/pay/?order=Zk3…"}}]]}
    Bot API example (sendMessage)
    POST https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage
    Content-Type: application/json
    
    {"chat_id": 424242, "text": "Invoice EO-2Z82DNA0 for 1 425 ₽",
     "reply_markup": {"inline_keyboard": [[{"text": "Pay", "web_app": {"url": "https://oplata.express/pay/?order=Zk3…"}}]]}}
  • We accept the launch data from your bot within an hour after the form is opened: later the form still works, but the buyer is not linked to the invoice. Support sees such a buyer marked “bot declared by the shop”.
  • A web_app button in a message works only in a private chat with the bot; in groups and channels, use a plain url button with telegram_app_url or pay_url.

How we know the buyer: Telegram signs the form’s launch data with its own key together with the bot number, and we check that signature for the number linked to the project. Your bot’s token is not needed for this. Another bot’s signature is not accepted for your project; without a linked bot the form still opens and the payment goes through, but the buyer stays unknown — as in a browser.

Payment method buttons#

A shop can draw its own “SBP”, “CryptoBot”, “xRocket”, “Crypto” buttons for one invoice: each leads to a link from pay_urls (or telegram_pay_urls), and the form opens right on that method — CryptoBot and xRocket issue the wallet invoice at once, “Crypto” opens the choice of network and coin, SBP is the usual form. The buyer can go back to the methods and pay another way — the invoice is the same.

In a browser
https://oplata.express/pay/?order=<token>&method=<method>
Mini app
startapp=<token>_<method> — the method is appended to the value with _. Links without the suffix work as before.
Invoice fragment
{
  "pay_urls": {
    "sbp": "https://oplata.express/pay/?order=Zk3…&method=sbp",
    "cryptobot": "https://oplata.express/pay/?order=Zk3…&method=cryptobot",
    "xrocket": "https://oplata.express/pay/?order=Zk3…&method=xrocket",
    "crypto": "https://oplata.express/pay/?order=Zk3…&method=crypto"
  },
  "telegram_pay_urls": {
    "sbp": "https://t.me/ExPay_Agent/pay?startapp=Zk3…_sbp",
    "cryptobot": "https://t.me/ExPay_Agent/pay?startapp=Zk3…_cryptobot",
    "…": "…"
  }
}
  • pay_urls holds only the methods the invoice can be paid with now: empty for a paid or expired invoice; sbp on a live invoice only once SBP is approved for the project (sbp_status in GET /v1/me).
  • If the method is no longer available when the link is opened, the form opens as usual, with no error. If a wallet invoice or an address is already issued, or the invoice is paid, the link changes nothing.
  • On any method the form shows “To pay” — the amount with the buyer’s part of the fee at that method’s rate — and, if there is such a part, a line “including an N% fee”; the wallet or crypto button shows the percentage of that method’s fee the buyer pays. The server does the sums, the form never recalculates them — see the fee.

Test mode#

  1. Issue a test key (eo_test_…) in the bot.
  2. Create invoices with the same POST /v1/invoices — the response carries "test": true.
  3. Complete the invoice: call simulate or open pay_url — the form shows a placeholder QR code and two simulation buttons, “payment succeeded” and “declined”.
  4. Receive the invoice.paid webhook with "test": true, signed with a key derived from the test key.
  • A test invoice never reaches the bank: no money, no ledger entries, the balance does not change.
  • simulate with a live key is 403 test_only; a live invoice does not exist for a test key (404).
  • A refund with a test key is 409 refund_unsupported. A test key can only read the appearance: changing it is 403 live_only.
  • The payment form shows a “test, no money is charged” banner and hides description. Until the project is approved, a “test project” label stands in for its name.

Never deliver goods on an event with "test": true.

Webhooks#

When an invoice is paid or a refund has an outcome, a POST with JSON goes to the project’s webhook address. The address is set in the bot.

The event#

POST
{
  "id": "evt_5b1f0c9a7e3d2a4466c0f1e2",
  "type": "invoice.paid",
  "created": 1800000123,
  "test": false,
  "data": {
    "id": "EO-7K2M9QXA",
    "order_id": "A-17",
    "status": "paid",
    "amount": "1425.00",
    "amount_to_pay": "1425.00",
    "currency": "RUB",
    "amount_usdt": "17.26",
    "rate": "82.5486",
    "paid_at": 1800000123,
    "payment_method": "sbp",
    "…": "…"
  }
}

For invoice.paid, data is the invoice object, as in GET /v1/invoices/{id}: it also holds amount_usdt and rate — how much USDT this payment added to the project’s turnover and at what rate.

invoice.paid
The invoice is paid.
refund.succeeded, refund.failed
The outcome of a refund to the buyer: data is the refund object, as in the POST /v1/invoices/{id}/refund response.
webhook.test
A check event sent from the bot, no money involved: data is {"project_id": "…", "message": "…"}, test is true.

Headers#

ExpressOplata-Signature
t=<unix>,v1=<hex>; there may be several v1 values — see signature check.
ExpressOplata-Event-Id
Equals id in the body. One per event across all retries — use it to deduplicate.
ExpressOplata-Delivery-Attempt
The attempt number, starting from 1.
Content-Type
application/json
User-Agent
ExpressOplata-Webhook/1

Endpoint requirements#

  • https only, port 443 or 8443.
  • No login or password in the address.
  • A public address: not localhost and not a private network.
  • Redirects are not followed: a 3xx response is a failure.
  • You have 10 seconds to respond.

Where webhooks come from#

The list of addresses webhooks are sent from is not published and may change without notice. Do not filter incoming requests by address — only the signature proves an event is genuine.

Delivery and retries#

Any 2xx response means the event is accepted. Otherwise delivery is retried:

  1. 1 minute
  2. 5 minutes
  3. 30 minutes
  4. 2 hours
  5. 12 hours
  6. then every 12 hours

Retries go on until three days have passed since the event was created; the last attempt is made at the end of the third day. The body stays the same, t and the signature are new.

  • Not accepted within three days — the event becomes failed and the project’s webhook is switched off. New events are recorded but not sent until the webhook is switched on again in the bot or the address is changed — then the waiting events go out.
  • The bot keeps a history of recent deliveries and has a “send again” button.
  • The handler must be idempotent: the same event may arrive more than once — tell them apart by ExpressOplata-Event-Id.
  • If no address is set at the moment of payment, no event is created — get the invoice status with GET /v1/invoices/{id}.

Test events#

  • One attempt and one retry a minute later, then failed.
  • They never switch the project’s webhook off.
  • At most 50 test events may wait to be sent; beyond that an event is recorded in the history as not sent.

The queue#

  • The queue is shared: one project gets at most two events at a time.
  • If the address fails to respond within 10 seconds three times in a row, the remaining events are put off for a minute; each further timeout doubles the delay, up to an hour.
  • Any response, even an error, resets that count.

Signature check#

  1. The key is SHA-256(token): 32 bytes, not a hex string. For an event with "test": true use the test key, for the rest — the live one. webhook.test is signed with both keys.
  2. Take t and every v1 from the ExpressOplata-Signature header.
  3. Compute HMAC-SHA256(key, t + "." + raw request body) — over the body bytes, before parsing JSON.
  4. The signature is valid if the result equals any of the v1 values. Compare in constant time.
  5. Reject the event if t differs from the current time by more than 5 minutes.

Several v1 values arrive after the live key is reissued: for 24 hours an event is signed with both the new key (the first v1) and the previous one (the second), so you have time to switch the key on your side. If the key was revoked by a platform administrator (it leaked), there is no such day: events are signed with the new key only.

Python
import hashlib
import hmac
import time


def verify(token: str, header: str, body: bytes) -> bool:
    """Checks the ExpressOplata-Signature header against the raw request body."""
    timestamp, signatures = "", []
    for part in header.split(","):
        name, _, value = part.strip().partition("=")
        if name == "t":
            timestamp = value
        elif name == "v1":
            signatures.append(value)
    if not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300:
        return False
    key = hashlib.sha256(token.encode()).digest()
    want = hmac.new(key, timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
    return any(hmac.compare_digest(want, signature) for signature in signatures)
Node.js
import { createHash, createHmac, timingSafeEqual } from "node:crypto";

// Checks the ExpressOplata-Signature header against the raw request body. body — Buffer.
export function verify(token, header, body) {
  let timestamp = "";
  const signatures = [];
  for (const part of header.split(",")) {
    const [name, value = ""] = part.trim().split("=");
    if (name === "t") timestamp = value;
    else if (name === "v1") signatures.push(value);
  }
  if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) {
    return false;
  }
  const key = createHash("sha256").update(token).digest();
  const want = createHmac("sha256", key).update(timestamp + ".").update(body).digest();
  return signatures.some((signature) => {
    const got = Buffer.from(signature, "hex");
    return got.length === want.length && timingSafeEqual(got, want);
  });
}
PHP
<?php

// Checks the ExpressOplata-Signature header against the raw request body.
function verify(string $token, string $header, string $body): bool
{
    $timestamp = '';
    $signatures = [];
    foreach (explode(',', $header) as $part) {
        [$name, $value] = array_pad(explode('=', trim($part), 2), 2, '');
        if ($name === 't') {
            $timestamp = $value;
        } elseif ($name === 'v1') {
            $signatures[] = $value;
        }
    }
    if (!ctype_digit($timestamp) || abs(time() - (int) $timestamp) > 300) {
        return false;
    }
    $key = hash('sha256', $token, true);
    $want = hash_hmac('sha256', $timestamp . '.' . $body, $key);
    foreach ($signatures as $signature) {
        if (hash_equals($want, $signature)) {
            return true;
        }
    }
    return false;
}
Go
package webhook

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"math"
	"strconv"
	"strings"
	"time"
)

// Verify checks the ExpressOplata-Signature header against the raw request body.
func Verify(token, header string, body []byte) bool {
	var timestamp string
	var signatures []string
	for _, part := range strings.Split(header, ",") {
		name, value, _ := strings.Cut(strings.TrimSpace(part), "=")
		switch name {
		case "t":
			timestamp = value
		case "v1":
			signatures = append(signatures, value)
		}
	}
	at, err := strconv.ParseInt(timestamp, 10, 64)
	if err != nil || math.Abs(float64(time.Now().Unix()-at)) > 300 {
		return false
	}
	key := sha256.Sum256([]byte(token))
	mac := hmac.New(sha256.New, key[:])
	mac.Write([]byte(timestamp + "."))
	mac.Write(body)
	want := mac.Sum(nil)
	valid := false
	for _, signature := range signatures {
		got, err := hex.DecodeString(signature)
		if err == nil && hmac.Equal(got, want) {
			valid = true
		}
	}
	return valid
}

All four samples are checked against the same test vectors.

Check a signature here. Paste the key, the header and the body from your server log — it is all computed in the browser, the key goes nowhere.

Errors#

Error response
{
  "error": {
    "code": "limit_exceeded",
    "message": "Сумма счёта больше наибольшей для проекта: 500.00 USDT",
    "request_id": "req_9f2c41d07ab35e68",
    "retryable": false
  }
}
  • Give request_id to support — it helps us find the request in our logs.
  • retryable: true — the request may be repeated later: this marks 429 and 5xx responses.

The amount in the sample is illustrative: see your project’s limits in GET /v1/me. The message text comes in Russian.

bad_json400
The request body is not a JSON object.
bad_currency400
currency is not "RUB", not "USDT" and not a supported currency code (GET /v1/currencies).
bad_amount400
amount is not an amount string or is outside 1 … 2,000,000 ₽ (including the buyer’s fee).
bad_order_id, bad_description, bad_ttl, bad_return_url, bad_metadata400
An invalid invoice field; bad_description — a wallet address in the description.
bad_request400
An invalid list parameter or result in simulate.
unauthorized401
No Authorization: Bearer header, or the key is wrong, was reissued or was revoked by an administrator (the bot sends a message about the revocation — issue a new key in the bot).
project_inactive403
A live key before the project is approved; any key of a rejected or suspended project.
test_only403
simulate with a live key.
live_only403
Changing the payment form appearance with a non-live key.
scope_required403
Refunds through the API are not enabled for the project in the bot.
live_unavailable403
A live invoice in a test environment with a simulated bank: invoices there are created with a test key only. The live service never returns this error.
not_found404
No such invoice for this project in this mode; no such address.
method405
Method not allowed for this endpoint.
conflict409
order_id is already used for an invoice with a different amount or in another currency.
invoice_expired409
simulate for an expired invoice.
invoice_not_paid, refund_unsupported, refund_expired, dispute_open, already_refunded, insufficient_balance, refund_unavailable, fx_pending409
The refund cannot be requested — see refund.
too_large413
The request body is over 16 KB.
limit_exceeded422
A project limit: the invoice amount or the daily turnover.
rate_limited429
The request limit is exceeded.
internal500
A failure on our side.
rate_unavailable503
An invoice in USDT or another currency (or a rouble invoice of a project with limits) while the Rapira rate or the currency’s P2P rate is unavailable — try again later.

Request limits#

600 per minute
Per project in each mode — live and test.
1200 per minute
Per IP address.
30 per minute
Refund requests per project.
30 per hour
All payment form appearance methods /v1/brand* per project.
10 per hour
Logo uploads per project.

Over the limit you get 429 rate_limited with retryable: true: repeat the request later.

A request body over 16 KB is 413 too_large.

Support#

Integration questions go to @ExpressOplata_SupportBot. Quote the request_id from the error response: it helps us find the request in our logs.