droplopay / droplopay-php
Official PHP SDK for DroploPay payment gateway (bKash, Nagad, Rocket, bank).
v1.0.0
2026-11-28 05:39 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Accept bKash, Nagad, Rocket, Upay, bank transfer and more in any PHP website with DroploPay. Payments are verified automatically by SMS.
Installation
With Composer
composer require droplopay/droplopay-php
Without Composer: download src/DroploPay.php and include it:
require 'DroploPay.php';
1. Create a payment
use DroploPay\DroploPay; use DroploPay\DroploPayException; $dp = new DroploPay('https://yourname.droplo.online', 'YOUR_API_KEY'); try { $res = $dp->createCharge([ 'full_name' => 'John Doe', 'email' => 'john@example.com', 'amount' => 500, 'metadata' => ['order_id' => 1001], 'redirect_url' => 'https://yoursite.com/success.php', 'cancel_url' => 'https://yoursite.com/cancel.php', 'webhook_url' => 'https://yoursite.com/webhook.php', 'return_type' => 'GET', ]); header('Location: ' . $res['payment_url']); exit; } catch (DroploPayException $e) { echo 'Error: ' . $e->getMessage(); }
2. Verify the payment (success page & webhook)
$invoiceId = DroploPay::invoiceIdFromRequest(); if ($invoiceId) { $payment = $dp->verifyPayment($invoiceId); if ($payment['status'] === 'COMPLETED') { $orderId = $payment['metadata']['order_id']; // ✅ Check the amount matches your order, then mark it as paid } }
⚠️ Always call
verifyPayment(). Never mark an order as paid just because someone opened your success URL.
Methods
| Method | Description |
|---|---|
createCharge(array $data) |
Creates a payment, returns payment_url |
verifyPayment(string $invoiceId) |
Returns status, amount, method, transaction ID, metadata |
isPaid(string $invoiceId) |
true only if COMPLETED |
DroploPay::invoiceIdFromRequest() |
Reads invoice_id from a webhook or redirect |
Get your API key
Panel → Developers → API Keys (needs payment:checkout and payment:verify).
Ready-made plugins
Support
- 💬 Discord: https://discord.gg/kB5eECvszk
- 🌐 Website: https://droplopay.com
License
MIT