Razorpay payment gateway integration in PHP
Steps to integrate Razorpay payment gateway in php
How to integrate
Razor Payment Gateway in website ?
After all process have completed by Razorpay.
"Congratulations! Your Razorpay account has been activated." has been received
Your will received sandbox payment gateway kit. Which have Key ID and Key secret . these are testing credentails
$keyId = 'rzp_test_ZBXX7X5mcPzHGT';
$keySecret = 'yVKkje2aIBCALubM98dLuxv9';
Automatic Checkout
<meta name="viewport" content="width=device-width">
<form action="/purchase" 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="50000"
data-buttontext="Pay with TechHawa"
data-name="Merchant Name"
data-description="Purchase Description"
data-image="https://your-awesome-site.com/your_logo.jpg"
data-prefill.name="TechHawa"
data-prefill.email="contact@techhawa.com"
data-theme.color="#F37254"
></script>
<input type="hidden" value="Hidden Element" name="hidden">
</form>
Step 2 Create order from server
$order = $client->order->create([ 'receipt' => 'order_rcptid_11', 'amount' => 500, // amount in the smallest currency unit 'currency' => 'INR',// <a href="/docs/payment-gateway/payments/international-payments/#supported-currencies" target="_blank">See the list of supported currencies</a>.) 'payment_capture' => '0']);
Manual order
<button id="rzp-button1">Pay</button><script src="https://checkout.razorpay.com/v1/checkout.js"></script><script>var options = { "key": "YOUR_KEY_ID", </script>
Testing Card
Card Network | Domestic / International | Card Number |
---|
Mastercard | Domestic | 5104 0155 5555 5558 5104 0600 0000 0008 |
Visa | Domestic | 4111 1111 1111 1111 |
Mastercard | International | 5555 5555 5555 4444 5105 1051 0510 5100 |
Visa | International | 4012 8888 8888 1881 4000 1841 8621 8826
|
Step
Generate Signature of your website server
generated_signature = hmac_sha256(razorpay_order_id + "|" +
razorpay_payment_id, secret);
if (generated_signature == razorpay_signature) {
payment is successful
}
use Razorpay\Api\Api;$api = new Api($api_key, $api_secret);
$attrbutes = array(‘razorpay_signature’ => ‘23233’,
‘razorpay_payment_id’ => ‘332’ , ‘razorpay_order_id’ => ‘12122’);
$order = $api->utility->verifyPaymentSignature($attributes)
Conclusion:As we have seen above razorpay payment gateway integration in php is quite simple
This proccess is also compatible with Laravel, Codeigniter and Cakephp
We have also provide integration in Android Mobile App(Java)
Please let me know if you have any query
Mahendra K Mishra
8795292855
Also Provide
GST billing software
Stock Management software
Mobile application development
Payment Gateway Integration(core PHP, Laravel and Python)
Prime Programmer
8795202855
No comments:
Post a Comment