WordPress · Shortcode Plugin · No WooCommerce
Overview
The SabPaisa Dynamic Status Plugin is a lightweight WordPress plugin that drops a SabPaisa pay button onto any page via a shortcode and renders a branded payment success / failure screen — without requiring WooCommerce. It signs the request server-side (via WordPress AJAX), creates a hosted-checkout session, and redirects the customer to SabPaisa.
No WooCommerce
Works on any WordPress site — pages, posts, or a custom template
Shortcode Pay Button
[sabpaisa_payment] renders a Proceed-to-Checkout button
Branded Status Page
[sabpaisa_payment_response] shows success / failure
Server-Side Checksum
HMAC-SHA256 generated in admin-ajax, never in the browser
Admin Settings
Credentials + environment from Settings → SabPaisa
Hosted Checkout
Redirects to SabPaisa for UPI, cards, net banking, wallets
Prerequisites
| Requirement | Notes |
|---|---|
| WordPress | A standard WordPress site (WooCommerce not required) |
| PHP | 7.4+ with curl + json |
| SabPaisa Merchant Account | API Key, Secret Key, Merchant ID from dashboard.sabpaisa.in |
| HTTPS site URL | Required — SabPaisa rejects non-HTTPS return URLs |
Step 1 — Install the Plugin
Go to WordPress Admin → Plugins → Add New → Upload Plugin.
Upload the sabpaisa-wordpress-plugin.zip and click Install Now.
Click Activate. On activation, the plugin auto-creates a Payment Response page (slug /payment-response) containing the response shortcode.
Step 2 — Enter Your Credentials
Go to Settings → SabPaisa in the WordPress admin and fill in:
| Field | What it is |
|---|---|
| Merchant ID | Your SabPaisa merchant / client code |
| API Key | Sent as the X-Api-Key header (sp_…) |
| Secret Key | HMAC-SHA256 signing key (sec_…) |
| Environment | Staging for testing, Production for live |
sec_… Secret Key — not the legacy 64-char hex hmac_api_key, which produces INVALID_SIGNATURE. Keep the Secret Key confidential and use different credentials for staging and production.Step 4 — Payment Response Page
After checkout, SabPaisa redirects the customer to /payment-response (auto-created on activation). That page renders the result via:
1[sabpaisa_payment_response]It reads status, transaction_id, and merchant_txn_id from the return URL and shows a branded success or failure card.
Payment Flow
Clicks “Proceed to Checkout” on the [sabpaisa_payment] button
Signs the request and calls POST /api/v2/payments server-side
Redirected to SabPaisa hosted checkout; pays via UPI / card / net banking / wallet
Redirects back to /payment-response with status query params
Confirms the authoritative status via webhook / enquiry before fulfilling
Security & Production
- •Confirm payment server-side before fulfilling — use a webhook receiver or the Transaction Enquiry API. The redirect status is a hint, not proof.
- •Keep TLS verification enabled on outbound API calls in production — never disable SSL verification.
- •Use the sec_… Secret Key; never expose it in the page or in client-side code.
- •Use HTTPS for your site URL — SabPaisa rejects non-HTTPS return URLs.
- •Use a unique merchantTxnId per attempt, and keep staging and production credentials separate.
- •For real, variable-amount carts, prefer the WooCommerce plugin or a PHP SDK integration.
Troubleshooting
“Payment initialization failed” after clicking the button
Check that Merchant ID, API Key, and Secret Key are filled in Settings → SabPaisa, and that the environment matches your credential set. The response from SabPaisa must contain checkoutUrl and clientSecret.
INVALID_SIGNATURE error
The legacy 64-char hex hmac_api_key was entered in the Secret Key field. Replace it with the sec_… value.
Redirect fails / payment won't start on a localhost or http:// site
SabPaisa rejects non-HTTPS return URLs. Use an HTTPS site URL (or an HTTPS tunnel) — the return URL is built from your WordPress home URL.
The Payment Response page is missing
It is created automatically on activation. If you deleted it, re-create a page with slug payment-response containing the [sabpaisa_payment_response] shortcode, or deactivate and reactivate the plugin.
For more common issues, see the Troubleshooting guide.
Need Help?
For installation or configuration help, contact SabPaisa support with your Merchant ID, the SabPaisa traceId from the error, and the order / merchant_txn_id involved.
Was this page helpful?