Banklar və fintech şirkətləri üçün 2Pay: B2B USDT API2Pay for banks and fintechs: the B2B USDT API
Manatla USDT almaq və USDT-ni manata satmaq üçün imzalı REST API: 5 dəqiqəlik təkliflər, idempotent sifarişlər, HMAC ilə imzalanmış sorğular, webhook-lar və tərəfdaş üzrə limitlər. Hər ödənişi 2Pay operatoru yoxlayır. Yazıda API-nin necə işlədiyini və girişi necə almağı izah edirik.A signed REST API for buying USDT with AZN and selling it for AZN: five-minute quotes, idempotent orders, HMAC-signed requests, webhooks and per-partner limits, with every payment checked by a 2Pay operator. How it works and how to request access.
2Pay-in B2B API-si USDT-yə ehtiyacı olan banklar, fintech şirkətləri, cüzdanlar və ödəniş provayderləri üçün hazırlanıb: məsələn, USDT istəyən müştərilərə xidmət göstərmək, tərəfdaşlarla hesablaşmaq və ya daxil olan USDT-ni manata çevirmək üçün. Bütün bunlar https://api.2pay.az/v1 ünvanındakı vahid imzalı REST API ilə edilir. 2Pay-in digər kanallarında olduğu kimi burada da eyni prinsip qüvvədədir: USDT və ya AZN göndərilməzdən əvvəl hər ödənişi operator yoxlayır.
API nə edir
API-nin iki istiqaməti var:
- Alış: şirkətiniz bank köçürməsi ilə AZN ödəyir və USDT-ni öz cüzdanına alır.
- Satış: şirkətiniz USDT-ni 2Pay-in depozit ünvanına göndərir və AZN-i 2Pay-də qeydə alınmış bank hesabına alır.
USDT səkkiz şəbəkədə əlçatandır: TRON (TRC20), BNB Chain (BEP20), Solana, Arbitrum One, Avalanche C-Chain, TON, Ethereum (ERC20) və Mantle. GET /v1/rates cari məzənnələri və komissiyaları, həmçinin hazırda alış və satış üçün açıq olan şəbəkələri qaytarır.
Sifariş necə işləyir
- Təklif. İstiqamət, məbləğ və şəbəkə göstərilməklə
POST /v1/quotessorğusu. Təklif məzənnəni və komissiyaları 5 dəqiqəlik sabitləyir və yalnız bir sifariş üçün istifadə oluna bilər. - Sifariş. Təklif və öz
clientOrderIddəyəriniz göstərilməkləPOST /v1/orderssorğusu. Alışda cüzdan ünvanını da göstərirsiniz; ünvan sifariş yaradılmazdan əvvəl həmin şəbəkə üzrə yoxlanılır. - Ödəniş. 2 saat ərzində sifarişin ödəniş təlimatına uyğun ödəyin: təyinatında sifariş nömrəsi göstərilmiş AZN bank köçürməsi (alış) və ya həmin şəbəkədəki depozit ünvanına USDT (satış).
- Bildiriş. Bank köçürməsinin referansı (alış) və ya tranzaksiya heşi (satış) ilə
POST /v1/orders/{id}/paymentsorğusu. - Hesablaşma. 2Pay operatoru ödənişi yoxlayır və sifarişi tamamlayır, yaxud səbəbini göstərərək rədd edir.
Sifariş pending_payment statusundan payment_submitted statusuna, sonra isə completed və ya rejected statusuna keçir. Ödənilməmiş sifarişi ləğv etmək olar; ödəniş müddəti bitdikdə isə sifarişin vaxtı keçir.
Təhlükəsiz inteqrasiya üçün
- İmzalı sorğular. Hər sorğu vaxt nişanı, metod, sorğu sətri (query) ilə birlikdə yol və gövdənin heşi üzərində hesablanmış HMAC-SHA256 imzası daşıyır.
- Təkrar sorğulardan qorunma. Vaxt nişanı 2Pay serverinin vaxtından ən çoxu 5 dəqiqə fərqlənə bilər, hər imza isə yalnız bir dəfə qəbul edilir.
- İcazəli IP siyahıları. Hər API açarını serverlərinizin IP ünvanları ilə məhdudlaşdırmaq olar.
- İdempotent sifarişlər. Eyni
clientOrderIdvə eyni təkliflə təkrarlanan sorğu ikinci sifariş yaratmır, mövcud sifarişi qaytarır; həmin identifikator başqa təkliflə göndərildikdə isə sorğu rədd edilir. - Aydın format. UTF-8 kodlaşdırmasında JSON, 64 KB-a qədər gövdə, sətir (string) kimi verilən onluq məbləğlər və ISO 8601 UTC formatında vaxt.
- Şifrələnmiş gizli açarlar. API və webhook gizli açarları şifrələnmiş şəkildə saxlanılır, hər tərəfdaş isə yalnız öz təkliflərini və sifarişlərini görür.
Webhook-lar
Webhook ünvanı təyin olunubsa, 2Pay sifariş yaradılanda və statusu hər dəfə dəyişəndə imzalı hadisə göndərir. İmza X-2Pay-Signature başlığında göndərilir və vaxt nişanı ilə sorğunun xam gövdəsi üzərində hesablanır. Webhook-a 10 saniyə ərzində 2xx statusu ilə cavab verin; yönləndirmələrə əməl olunmur. Çatdırılmayan bildiriş təxminən 28 saat ərzində 10 dəfə yenidən göndərilir. Hadisələr təkrarlana və ya fərqli ardıcıllıqla gələ bilər, ona görə hər birində təkrarları ayırmaq üçün hadisə identifikatoru var. POST /v1/webhooks/test istənilən vaxt sınaq hadisəsi göndərir.
Limitlər
- Hər sifariş ən azı 10 AZN.
- Sifariş üzrə: standart olaraq 100 000 AZN.
- UTC günü üzrə: standart olaraq 500 000 AZN.
- API açarı üzrə dəqiqədə 120, IP ünvanı üzrə dəqiqədə 300 sorğu.
Sifariş limitləri hər tərəfdaş üçün müqavilədə müəyyən edilir.
Girişi necə almaq olar
Özünüz qeydiyyatdan keçə bilməzsiniz: giriş hər şirkətə ayrıca verilir.
- Müraciət. Biznes üçün səhifəsindəki formanı doldurun: şirkət, əlaqə məlumatları, gözlənilən aylıq həcm və API-dən necə istifadə etməyi planlaşdırdığınız.
- Yoxlama və müqavilə. 2Pay komandası sizinlə əlaqə saxlayır, şirkətinizi yoxlayır (KYB) və şərtləri sizinlə razılaşdırır.
- Açarlar və parametrlər. API açarlarınızı və webhook gizli açarını alırsınız; onlar yalnız bir dəfə göstərilir. 2Pay icazəli IP siyahınızı, webhook ünvanınızı və limitlərinizi təyin edir.
- İnteqrasiya. Nümunələr və imzalama kodları olan, ingilis və Azərbaycan dillərindəki API sənədlərinə və ya OpenAPI 3.1 spesifikasiyasına əsasən inteqrasiya edin. Hər şeyin düzgün qurulduğunu
GET /v1/accountsorğusu və sınaq webhook-u ilə yoxlayın. - İşə başlama. Yalnız bir mühit var, canlı mühit; sandbox yoxdur. Kiçik sifarişlərlə, 10 AZN-dən başlayın və hər şeyin gözlənildiyi kimi işlədiyinə əmin olduqdan sonra həcmi artırın.
Məsuliyyət barədə qeyd
USDT kripto aktivdir, blokçeyn köçürmələri isə geri qaytarılmır. Ona görə sistemlərinizdən göndərdiyiniz ünvanlar və şəbəkələr bizdə olduğu kimi sizdə də diqqətli yoxlama tələb edir. USDT məhsulunuzun bir hissəsidirsə, bu riskləri öz proseslərinizdə də nəzərə alın.
Bu xidmət biznesinizə uyğundursa, Biznes üçün səhifəsindəki müraciətlə başlayın.
2Pay's B2B API is built for banks, fintech companies, wallets and payment providers that need USDT, for example to serve clients who ask for it, to settle with partners or to convert incoming USDT into manat. It is one signed REST API at https://api.2pay.az/v1, and the principle is the same as on every other 2Pay channel: an operator checks each payment before USDT or AZN is sent.
What the API does
The API works in two directions:
- Buy: your company pays AZN by bank transfer and receives USDT in its own wallet.
- Sell: your company sends USDT to 2Pay's deposit address and receives AZN in the bank account registered with 2Pay.
USDT is available on eight networks: TRON (TRC20), BNB Chain (BEP20), Solana, Arbitrum One, Avalanche C-Chain, TON, Ethereum (ERC20) and Mantle. GET /v1/rates returns the current rates and fees and the networks open for buying and for selling at the moment.
How an order works
- Quote.
POST /v1/quoteswith the side, the amount and the network. The quote locks the rate and fees for 5 minutes and can be used for one order. - Order.
POST /v1/orderswith the quote and your ownclientOrderId. For a buy you also give the wallet address, which is checked for that network before the order is placed. - Payment. Pay within 2 hours as the order's payment instructions say: a bank transfer in AZN with the order's reference in the description (buy), or USDT to the deposit address for that network (sell).
- Report.
POST /v1/orders/{id}/paymentwith your bank's transfer reference (buy) or the transaction hash (sell). - Settlement. A 2Pay operator checks the payment and completes the order, or rejects it with a reason.
An order moves from pending_payment to payment_submitted and then to completed or rejected. An unpaid order can be cancelled; otherwise it expires when the payment window ends.
Built for safe integration
- Signed requests. Every request carries an HMAC-SHA256 signature over the timestamp, the method, the path with its query string and the hash of the body.
- Replay protection. The timestamp must be within 5 minutes of 2Pay's clock, and each signature is accepted only once.
- IP allowlists. Each API key can be limited to your servers' IP addresses.
- Idempotent orders. Repeating a request with the same
clientOrderIdand quote returns the existing order instead of creating a second one; the same id with another quote is refused. - Predictable formats. JSON in UTF-8, bodies of up to 64 KB, amounts as decimal strings and times in ISO 8601 UTC.
- Encrypted secrets. API and webhook secrets are encrypted at rest, and a partner only ever sees its own quotes and orders.
Webhooks
When a webhook URL is set, 2Pay sends a signed event when an order is created and on every status change. The signature comes in the X-2Pay-Signature header and is calculated over the timestamp and the raw body. Answer with a 2xx status within 10 seconds; redirects are not followed. A failed delivery is retried 10 times over about 28 hours. Events can repeat or arrive out of order, so each one carries an event id for deduplication, and POST /v1/webhooks/test sends a test event whenever you need one.
Limits
- At least 10 AZN per order.
- Per order: 100,000 AZN by default.
- Per UTC day: 500,000 AZN by default.
- 120 requests a minute per API key and 300 a minute per IP address.
The order limits are set for each partner in its agreement.
How to get access
There is no self-service sign-up: access is granted company by company.
- Apply with the form on the For business page: your company, contact details, expected monthly volume and how you plan to use the API.
- Review and agreement. The 2Pay team contacts you, carries out due diligence on your company (KYB) and agrees the terms with you.
- Keys and settings. You receive your API keys and webhook secret, each shown once. 2Pay sets your IP allowlist, webhook URL and limits.
- Integration. Build against the API documentation, in English and Azerbaijani with examples and signing samples, or the OpenAPI 3.1 specification. Check your setup with
GET /v1/accountand a test webhook. - Going live. There is one environment, production, and no sandbox. Start with small orders, from 10 AZN, and increase volumes once everything works as expected.
A note on responsibility
USDT is a crypto asset, and blockchain transfers cannot be reversed. The addresses and networks your systems submit therefore deserve the same care on your side as they get on ours. If USDT is part of your product, plan for these risks in your own processes as well.
If this fits your business, start with the application on the For business page.