In the ever-moving digital space of 2025, it is a necessary step for businesses and developers to integrate a user-friendly payment gateway for their product and website that offers a seamless checkout experience. They have a great name in Indian payment gateways, and they are still ruling the arena of payments – that’s BillDesk.
In this guide, I will cover how to integrate the BillDesk payment gateway in PHP with new updated steps for 2025.
What is BillDesk?
BillDesk is the leading payment gateway in India and offers major methods like credit/debit cards, UPI, net banking, and wallets. It offers high security, high-speed transactions, and compliance with regulations, making it suitable for e-commerce, utility, service, and product-oriented websites.

Prerequisites
Prerequisites Before you start, you need the following:
- A BillDesk merchant verified account (with merchant ID and encryption keys).
- A web server with PHP version 7.4 or greater.
- SSL certificate installed (recommended for sending your data securely).
- Composer installed (to handle PHP dependencies).
How BillDesk Works
BillDesk is making use of form post. The BillDesk payment page receives the transaction information in an encrypted format, over an HTML FORM, and the Merchant Page/ Backend about the transaction status. After the payment is made by the customer, BillDesk returns to a callback URL.
Read also:-
- Cashfree Payment Gateway Integration in PHP – Step-by-Step Guide
- Digital Marketing for Online Tuition Classes: The Ultimate Guide 2025
Step-by-Step Integration

Obtain Integration Details from BillDesk
Once you register at BillDesk, they will offer you:
- Merchant ID
- Secret Key / Encryption Key
- Payment Gateway URL
- Return URL (to receive response)
2. Prepare Transaction Data
You need to create a string with the required parameters and encrypt it using SHA256 or AES algorithm (as per BillDesk’s documentation).
php:
<?php
$merchant_id = “YOUR_MERCHANT_ID”;
$txn_id = uniqid(“BDTXN”);
$amount = “100.00”;
$currency = “INR”;
$return_url = “https://yourdomain.com/billdesk-response.php”;
// Concatenate data
$data = “$merchant_id|$txn_id|NA|$amount|$currency|NA|NA|F|NA|NA|NA|NA|NA|NA|NA|NA|$return_url”;
// Encrypt the data (example with SHA256 hash, BillDesk may use different encryption)
$checksum = hash(‘sha256’, $data);
// Final request string
$request_data = “$data|$checksum”;
?>
3. Create a Payment Form
<formmethod=”post”action=”https://www.billdesk.com/pgidsk/PGIRequest”>
<inputtype=”hidden”name=”msg”value=”<?php echo $request_data; ?>”>
<inputtype=”submit”value=”Pay Now”>
</form>
4. Handle the Payment Response
<?php
$response = $_POST[‘msg’]; // Entire response string
$response_parts = explode(‘|’, $response);
// Check the response status
$status = $response_parts[14]; // Typically “Success”, “Failure”, or “Cancelled”
if ($status === “Success”) {
echo”Payment Successful. Transaction ID: ” . $response_parts[1];
// Update order in your database
} else {
echo”Payment Failed or Cancelled.”;
}
?>
Test Mode and Production
BillDesk provides a UAT (User Acceptance Testing) environment. Always test the flow thoroughly before going live.
To switch to production, update the payment URL and use live merchant credentials.
Final Words:-
It is very easy to integrate BillDesk with PHP if you follow the documentation and other security instructions provided by them. As online payments in India grow in 2025, having a reliable and secure method of payment such as BillDesk can help increase the trust of your site and conversion rates.
If you like this type of tutorial, get grab new ones weekly by subscribing to our Papayacoders blog.