DS PAY ← Back to Workspace
DEVELOPER INTEGRATION GUIDE

Connect your website to DS PAY

Step-by-step guide for website owners and developers: register your site in Website API, create a hosted checkout session or drop-in modal, verify Transaction IDs automatically via Android APK or iPhone Shortcuts, and fulfill orders with signed webhooks.

API Documentation Transaction Verification API Webhook API Examples & SDKs Live Demo Store ↗

1. API Documentation

Create checkout sessions and send customers to hosted payment or drop-in modal.

2. Verification API

Check invoice status or verify a submitted Transaction ID programmatically.

3. Webhook API

Receive HMAC-SHA256 signed payment events directly on your server.

4. Phone Auto-Sync

Pair Android APK (All 3 MFS) or iPhone Shortcuts for 24/7 SMS matching.

How the pieces fit together

Use the Website API to create an invoice and hosted payment link. Use the webhook (or status lookup) to confirm payment when the phone SMS matches.

Customer ➔ Your server ➔ DS PAY POST /v1/payments ➔ Hosted Checkout ➔ Android/iPhone SMS Match ➔ Signed Webhook ➔ Order Marked Paid

1. Create Payment Session POST /v1/payments

Call this endpoint from your backend or frontend with your X-API-KEY and X-API-SECRET headers:

Loading...

2. Check Status & Verify TrxID GET /v1/payments/:id

You can poll payment status or submit a TrxID directly from your own custom checkout UI:

Loading...

3. Webhook API · Signed Payment Event (HMAC-SHA256)

Every confirmed payment sends an HTTP POST JSON request to your configured webhook URL. Retries are normal—make processing idempotent using X-AutoPay-Event-ID and return 2xx once recorded.

// Event Body Shape (payment.success) { "event": "payment.success", "event_id": "evt_...", "timestamp": 1794000000, "created_at": "2026-...", "data": { "invoice_id": "pay_...", "order_id": "ORDER-1042", "payment_status": "COMPLETED" }, "invoice_id": "pay_...", "order_id": "ORDER-1042", "status": "true", "amount": 850.0, "currency": "BDT", "payment_method": "bkash", "transaction_id": "..." } // Node.js Express Webhook Handler (verify raw body BEFORE JSON.parse) const crypto = require('crypto'); app.post('/api/autopay/webhook', express.raw({ type: 'application/json' }), (req, res) => { const received = req.headers['x-autopay-signature'] || ''; const expected = 'sha256=' + crypto .createHmac('sha256', process.env.AUTOPAY_WEBHOOK_SECRET) .update(req.body) .digest('hex'); const a = Buffer.from(expected, 'utf8'); const b = Buffer.from(received, 'utf8'); if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) { return res.status(401).json({ error: 'Invalid signature' }); } const event = JSON.parse(req.body.toString('utf8')); if (event.event !== 'payment.success') { return res.status(200).json({ received: true }); // e.g. payment.test } // Idempotently mark order event.order_id / event.invoice_id as PAID! res.status(200).json({ received: true }); });

4. Drop-in Website Modal (HTML / JS) & PHP

Embed the exact DS PAY checkout popup over any website in 5 lines of HTML, or call from PHP:

Loading...