Client libraries
WordPress / WooCommerce
Plans for a ShadhinPay WooCommerce plugin, and how to integrate WordPress today.
Official plugin — Planned
A ShadhinPay WooCommerce payment gateway plugin — installable from your WordPress admin, with checkout integration and automatic webhook handling — is on the roadmap.
What the plugin will do
When it ships, the plugin will let a store owner:
- Install and configure ShadhinPay from WooCommerce → Settings → Payments
- Enter their
Client-Id,Business-Id, and API key (with a sandbox toggle) - Offer bKash / Nagad at checkout with no code
- Mark orders paid automatically from verified webhooks
Integrating today
Until the plugin is available, you can integrate from a theme or custom plugin using WordPress's HTTP API and your server-side API key.
<?php
// In your plugin/theme — runs on the server, keep the key out of client code.
$response = wp_remote_post('https://api.shadhinpay.pay/api/v1/payments', [
'headers' => [
'Client-Id' => SHADHINPAY_CLIENT_ID,
'Business-Id' => SHADHINPAY_BUSINESS_ID,
'X-Api-Key' => SHADHINPAY_API_KEY,
'X-Idempotency-Key' => wp_generate_uuid4(),
'Content-Type' => 'application/json',
],
'body' => wp_json_encode([
'amount' => '500.00',
'currency' => 'BDT',
'merchantTxnId' => 'wc-order-' . $order_id,
'callbackUrl' => home_url('/shadhinpay/return'),
]),
'timeout' => 15,
]);
$body = json_decode(wp_remote_retrieve_body($response), true);
// redirect the buyer to $body['data']['paymentUrl']Register a webhook receiver with the REST API (register_rest_route) and verify
the signature exactly as in the PHP guide.
Mark the WooCommerce order complete only after a verified payment.completed (or
invoice.paid) webhook.