A complete guide for integrating and using the custom bKash payment gateway.
This guide provides a step-by-step process for a merchant to integrate their website with the payment gateway.
Before you can use the gateway, you must be registered as a merchant. From the gateway's admin panel, you will receive two critical pieces of information:
MERCH-B1500AE1A6E4
).To start a payment, you need to redirect your customer from your website to the gateway's pay.php
page with several parameters in the URL.
The target URL for payment initiation is: https://hmea.top/pay.php
You must construct a URL with the following query parameters:
Parameter | Type | Description |
---|---|---|
merchant_id | String | Required. Your unique Merchant ID. |
amount | Float | Required. The payment amount (e.g., 150.50). |
invoice_id | String | Required. A unique ID for this transaction from your system. |
success_url | String | Required. The URL to redirect the user to after a successful payment. |
fail_url | String | Required. The URL to redirect the user to after a failed or cancelled payment. |
payer_name | String | Optional. The full name of the customer. |
payer_email | String | Optional. The email address of the customer. |
payer_mobile | String | Optional. The mobile number of the customer. |
After the customer completes the payment process on the bKash site, they will be redirected back to the success_url
or fail_url
you provided. The gateway will append several query parameters to this URL.
status
: Will be 'success'.amount
: The transaction amount.invoice_id
: Your original invoice ID.trx_id
: The final bKash Transaction ID.signature
: A security hash to verify the integrity of the data.To ensure the data has not been tampered with, you **must** verify the signature on your server.
The gateway provides a server-to-server API endpoint for verifying transactions at any time.
This endpoint allows you to check the status of a payment using either your invoice_id
or the final bkash_trx_id
.
The target URL for API verification is: https://hmea.top/api/v1/verify_payment.php
Parameter | Type | Description |
---|---|---|
merchant_id | String | Required. Your unique Merchant ID. |
api_secret_key | String | Required. Your private API Secret Key. |
invoice_id | String | Conditional. Required if bkash_trx_id is not provided. |
bkash_trx_id | String | Conditional. Required if invoice_id is not provided. |
Security is paramount in a payment system. This gateway employs several measures to ensure data integrity and prevent fraud.
callback.php
script performs its own server-to-server verification with the bKash API before marking a transaction as 'completed', ensuring that a client-side failure doesn't result in an incorrect status.