Payment gateway guide
Razorpay API integration for travel booking websites
Razorpay is a payment gateway for India that takes cards, UPI, netbanking and wallets in rupees. This guide explains how a Razorpay payment works for a flight, hotel or tour booking, and the honest status in PHPTRAVELS: Razorpay is not a ready connector today, but it can be added as a custom integration on the source code you own.
- Cards, UPI, netbanking, wallets
- Order, Checkout, capture
- Signature and webhook checks
- Full and partial refunds
Razorpay at a glance
What Razorpay is, and where it stands in PHPTRAVELS
Razorpay is an Indian payment gateway. A travel business that sells to Indian customers uses it to accept the payment methods those customers expect at checkout: debit and credit cards, UPI, netbanking and popular wallets, all charged and settled in Indian rupees to the merchant's own Razorpay account.
PHPTRAVELS is a self-hosted travel booking platform with the full source code included. Its ready payment gateways come from a live list that you switch on with your own merchant credentials. Razorpay is not in that list today, so there is no switch for it in the admin yet.
That does not mean you cannot use it. Because you own the code, Razorpay can be added as a Custom API integration, and for India a ready gateway is already available: Cashfree. The Payment gateway integration page lists every gateway you can switch on now.

Razorpay fact sheet
- What it is
- A payment gateway for businesses in India
- Payment methods
- Cards, UPI, netbanking and wallets
- Currency
- Charges and settles in INR; amounts are sent in paise
- API keys
- Key ID and Key Secret, separate for test mode and live mode
- PHPTRAVELS status
- Not a ready connector. Available as a custom integration on the included source code
- Ready in India today
- Cashfree, switched on in the admin with your own Cashfree account
Payment flow
One Razorpay payment for a travel booking, step by step
A Razorpay integration splits the work between the traveller's browser and your server. The browser shows Checkout; the server creates the order, checks the result and decides when the booking is confirmed.
- 01
Your server
Create an order
When the traveller presses Pay, your server calls the Orders API with the amount in paise, the currency and a receipt set to the booking reference. Razorpay returns an order_id.
- 02
Browser
Open Razorpay Checkout
The booking page opens Checkout with your Key ID and that order_id, so the traveller pays exactly the amount your server fixed.
- 03
Browser
Traveller pays
The traveller chooses a card, UPI, netbanking or a wallet and completes any step their bank asks for. The payment is now authorised.
- 04
Browser
Checkout returns three values
On success Checkout hands back razorpay_payment_id, razorpay_order_id and razorpay_signature, and the page posts them to your server.
- 05
Your server
Verify the signature
Your server recomputes the signature from the order_id and payment_id with the Key Secret. Only a matching signature is treated as a real payment.
- 06
Your server
Capture the payment
With automatic capture Razorpay captures for you. With manual capture your server captures once the airline, hotel or tour supplier has confirmed, so nobody is charged for a booking that failed.
- 07
Your server
Confirm the booking
The booking moves to paid, the ticket or voucher is issued and the Razorpay payment_id is stored against the booking reference.
- 08
Your serverServer to server
Receive the webhook
Razorpay also posts events such as payment.captured to your webhook URL. This covers the traveller who closes the tab before the page could report back.
Signatures and webhooks
Two checks that keep a Razorpay integration honest
Anything that arrives from the browser or over the internet can be faked. A Razorpay integration trusts a payment only after it has checked a signature made with a secret that never leaves your server.
1// 1. After Checkout: verify the payment signature 2$orderId = $booking["razorpay_order_id"]; // from your own record 3$paymentId = $_POST["razorpay_payment_id"]; 4$signature = $_POST["razorpay_signature"]; 5$expected = hash_hmac("sha256", $orderId . "|" . $paymentId, $keySecret); 6if (!hash_equals($expected, $signature)) { rejectPayment(); } 7markPaid($booking["ref"], $paymentId); 8 9// 2. Webhook: verify X-Razorpay-Signature over the raw body10$body = file_get_contents("php://input");11$header = $_SERVER["HTTP_X_RAZORPAY_SIGNATURE"] ?? "";12$expect = hash_hmac("sha256", $body, $webhookSecret);13if (!hash_equals($expect, $header)) { http_response_code(400); exit; }14$event = json_decode($body, true);15if (alreadyHandled($event)) exit; // repeat delivery16switch ($event["event"]) {17 case "payment.captured": confirmBooking($event); break;18 case "refund.processed": markRefunded($event); break;19}
Illustrative pseudo-code to show the logic, not a drop-in file. Follow Razorpay's own documentation and SDKs for the exact calls.
Payment signature
HMAC SHA256 of order_id, a pipe and payment_id, keyed with your Key Secret, must equal razorpay_signature. Compare with a constant-time function.
Webhook signature
Each webhook carries an X-Razorpay-Signature header: an HMAC SHA256 of the raw request body, keyed with the webhook secret you set in the Razorpay dashboard.
Repeat deliveries
Webhooks can arrive more than once or out of order. Record the event and payment ids and ignore an event you have already applied to the booking.
Secrets stay server side
Only the Key ID goes to the browser. The Key Secret and the webhook secret live in server configuration, never in page source or a mobile app.
Refunds and cancellations
Travel refunds are rarely the full amount
Cancellation fees, no-show rules and part-cancelled itineraries mean a travel refund is often partial. Razorpay's Refunds API handles both, and the integration decides the amount from your booking rules.
Full refund
A free cancellation returns the whole captured amount to the method the traveller used to pay.
Partial refund
After a cancellation fee, the server refunds only the balance. The amount is sent in paise, like the original order.
Part of an itinerary
Cancel one hotel night or one passenger and refund that part; more partial refunds can follow up to the captured total.
refund.processed
The refund webhook tells your server when the refund has gone through, so the booking and the traveller see the right status.
Stored against the booking
Each refund id is kept with the booking reference and the original payment_id for your accounts team.
Example: cancellation with a fee
- Captured
- ₹12,500.00 amount: 1250000
- Cancellation fee
- ₹1,500.00 amount: 150000
- Refund amount
- ₹11,000.00 amount: 1100000
Example figures only. Razorpay takes amounts in the smallest currency unit, so 100 paise is one rupee.
How to connect Razorpay
Three ways to take payments with Razorpay or without it
Pick the route that fits your team and your launch date. All three keep the money in your own merchant account; PHPTRAVELS never sits in the settlement.
Option 1
Your developers add it
PHPTRAVELS comes with the full source code, so your own developers can add Razorpay as a new gateway next to the existing ones: order creation, Checkout on the payment step, signature check, capture, webhooks and refunds.
- Build and test with Razorpay test-mode keys
- Reuse the booking reference as the order receipt
- Switch to live keys once test bookings pass
Option 2
PHPTRAVELS builds it
Our developers can build the Razorpay connector for you as a Custom API integration. You send the requirements, receive the cost and timeline before work starts, and get the tested source code at the end.
- Quoted before work starts
- Built against Razorpay test mode
- Delivered as source code you own
Option 3
Use a ready gateway now
If you need to launch first, switch on a gateway that is already in the platform. For India that is Cashfree. Ready gateways today include:
- CashfreeCashfree setup guide
- Stripe
- PayPal
- xMoney
- Fawaterk
- Paystack
Ready gateways
Payment gateways you can switch on today
This list comes live from the PHPTRAVELS gateway directory. Each one is enabled in the admin with your own account and keys.
Cashfree
StripeIntegration guidePayPalIntegration guide
xMoney
Fawaterk
Paystack
Flutterwave
Adyen
MyFatoorah
SSLcommerz
Razorpay- All integrations
Want to understand the calls behind any of them? Read the Payment gateway API guide, compare the Stripe payments and PayPal payments guides, or see how agents pay from a B2B agent wallet on the B2B portal.
Not as a ready connector. Razorpay is not in the PHPTRAVELS gateway list today, so you cannot switch it on in the admin. Because the full source code is included, it can be added as a custom payment gateway integration, by your developers or by ours.
Cashfree is a ready gateway in PHPTRAVELS and has a setup guide at docs.phptravels.com/payments/cashfree. You enable it in the admin with your own Cashfree account. Other ready gateways such as Stripe and PayPal are listed on the payment gateways page.
Razorpay accepts cards, UPI, netbanking and wallets for payments in Indian rupees. Which methods appear at checkout depends on what is enabled on your own Razorpay account.
Razorpay takes amounts in the smallest currency unit, so a booking total in rupees is multiplied by 100 before the order is created. A refund amount is sent the same way.
Checkout returns a payment id, the order id and a signature. Your server computes an HMAC SHA256 of the order id and payment id with your Key Secret and accepts the payment only if the result matches the signature.
Automatic capture is simpler. Manual capture lets you capture only after the airline, hotel or tour supplier confirms the booking, so a failed booking can be released instead of refunded. The choice depends on your products and suppliers.
Yes. Razorpay's Refunds API supports full and partial refunds, so a cancellation fee can be kept and the balance returned. The refund.processed webhook tells your server when the refund is complete.
Yes. The merchant account, its Key ID and Key Secret and its settlement are yours. PHPTRAVELS never provides gateway credentials and never handles your funds. Build with test-mode keys and switch to live keys when you go live.
It depends on the scope you need, such as checkout, manual capture, refunds and agent payments. PHPTRAVELS quotes custom work before it starts. The platform itself is a one-time licence.
Keep exploring
More from the platform
- Payment gateway integrationCheckout, 3D Secure, refunds and webhooks
- Payment gateway APIHow card payments, 3-D Secure, captures and refunds work over an API
- Custom API integrationConnect any supplier or partner API to PHPTRAVELS
- Stripe paymentsCard and wallet checkout with refunds and payouts
- PayPal paymentsPayPal checkout for flights, hotels and tours
- B2B agent walletAgent deposits, credit limits and a ledger per agent
