Razorpay – India’s First Converged Payment Solution. Payment gateway solution for India with robust, developer friendly API and simple economic pricing. In this post describes how to integrate razorpay payment gateway in php. First of all, You have to create an account in RazorPay. Then create a auth keys from your account. Once payment done you have to capture that transaction with txn id. otherwise that amount should not credited to your bank account. Here we explains see the implementations steps for razorpay payment gateway.
See our demo video on Youtube:
Razorpay Integration Steps:
Create a account in razorpay and click here.
Get your API keys to access test account in razorpay.
Integrate this checkout form in your payment.php file.
Add following line to your
<head> tag, if not already there:
<meta name="viewport" content="width=device-width">
<form action="charge.php" method="POST"> <!-- Note that the amount is in paise = 50 INR --> <script src="https://checkout.razorpay.com/v1/checkout.js" data-key="<YOUR_KEY_ID>" data-amount="10000" data-buttontext="Pay with Razorpay" data-name="PHPExpertise.com" data-description="Test Txn with RazorPay" data-image="https://your-awesome-site.com/your_logo.jpg" data-prefill.name="Harshil Mathur" data-prefill.email="[email protected]" data-theme.color="#F37254" ></script> <input type="hidden" value="Hidden Element" name="hidden"> </form>
After the payment is done, a form will be submitted to the url specified in previous step with
razorpay_payment_id. This means, the payment is
authorized and you can capture it now. Final step you got the transaction id so you store that id in your transaction_history table.
Thanks for reading this article. Please share this article and subscribe our youtube channel: SUBSCRIBE