Member-only story
Razorpay Integration In Flutter Web
Hey folks, do you want to integrate Razorpay in your flutter app but came to know that official Razorpay package razorpay_flutter doesn’t support web platform! This article will help you then :-)
Find the updated article here.
Step 1: Get Razorpay credentials.
Signup for the Razorpay account if you’ve not done it yet and generate API keys in test mode. After successful key generation, you’ll get your Key ID and Key Secret. Save them somewhere for later reference.
Step 2: Load Razorpay library for flutter web.
To use Razorpay in your flutter web, you’ve to load Razorpay’s web library first.
Go to the index.html file inside the web folder of your flutter project and add the below script before closing the body.
<body>
...
<script src="https://checkout.razorpay.com/v1/checkout.js"></script></body>
Step 3: Write custom checkout logic for the web.
If you were using Razorpay in android or ios, checkout would’ve been managed by the package itself. Since razorpay_flutter doesn’t support web, we have to write this logic ourselves.