API রেফারেন্স
পেমেন্ট তৈরি, দেখা ও বাতিল; মাধ্যম, ইনভয়েস আর লিংক। Bearer key সহ HTTPS-এ JSON।
Base URL: https://your-server/api/v1/ · Auth হেডার: Authorization: Bearer pk_live_… (X-API-Key-ও চলে)। Body JSON। প্রতিটা উত্তরে ok থাকে; ভুল হলে {"ok":false,"error":"invalid_amount","message":"…"}, সাথে মানানসই HTTP স্ট্যাটাস (400, 401, 403, 404, 409, 422, 429, 503)।
পেমেন্ট তৈরি
POST /api/v1/payments
{"amount":"500.00","currency":"BDT","reference":"ORDER-1001",
"customer":{"name":"Rahim","email":"r@example.com","phone":"01712345678"},
"success_url":"https://shop.example.com/thanks","cancel_url":"https://shop.example.com/cart",
"webhook_url":"https://shop.example.com/ipn","methods":["bkash","nagad"],
"metadata":{"order_id":1001},"expires_in":3600}উত্তর 201:
{"ok":true,"payment":{"id":"PAY-7Q2M9XKD","status":"pending","amount":"500.00","currency":"BDT",
"checkout_url":"https://pay.example.com/checkout/PAY7Q2M9XKD","expires_at":"2026-11-16T11:15:00+06:00"}}কাস্টমারকে checkout_url-এ পাঠান। আগের পেমেন্ট খোলা থাকা অবস্থায় একই reference আবার পাঠালে সেই পেমেন্টটাই ফেরত আসে; নতুন চাইলে "new":true দিন।
পেমেন্ট দেখা
GET /api/v1/payments/{id} অথবা GET /api/v1/payments?reference=ORDER-1001
| status | অর্থ |
|---|---|
pending | তৈরি হয়েছে, টাকা আসেনি |
processing | কাস্টমার TrxID দিয়েছে; SMS-এর অপেক্ষা |
completed | পেইড — সাথে paid_amount, paid_currency, method, trx_id, sender, paid_at |
failed, expired, cancelled, refunded | শেষ অবস্থা |
অন্য কল
| কল | কাজ |
|---|---|
GET /api/v1/methods?amount=500¤cy=BDT | ওই পরিমাণে এই ওয়েবসাইট কোন মাধ্যম নিতে পারে |
POST /api/v1/payments/{id}/cancel | খোলা পেমেন্ট বাতিল |
POST /api/v1/payments/{id}/verify | নিজের পেজে TrxID নিলে: method, trx_id, sender |
POST /api/v1/invoices | customer, items[{name,qty,price}], currency, due_date, note → url সহ ইনভয়েস |
POST /api/v1/links | title, amount (কাস্টমার লিখবে হলে null), currency → বারবার ব্যবহারযোগ্য লিংক url |
curl দিয়ে উদাহরণ
curl -X POST https://pay.example.com/api/v1/payments \
-H "Authorization: Bearer pk_test_xxx" -H "Content-Type: application/json" \
-d '{"amount":"250.00","currency":"BDT","reference":"TEST-1"}'