Integrate RazorPay in Flutter using SDK

Updated 27 April 2023


In this blog, we will learn how to integrate payment method using SDK in flutter i.e., “Integrate RazorPay in Flutter using SDK”.

In E-commercial Applications, we need to integrate online payment methods as per the user’s requirements.

there are two methods to integrate payment methods in your flutter application:-
a)Using Web view
b)Using SDK

Here, we will integrate RazorPay using SDK.So without wasting time, Let’s start the stepwise implementation of integrating RazorPay in flutter using SDK.

Check out more about our Flutter app development.

1.Add the Dependency

First of all, you need to add the following flutter Razorpay SDK dependency in your flutter project. I am also adding the flutter toast dependency because I will show the toast message on the success or failure of payment.

you can do whatever you want on success or failure of payment.

2.Import the package

Add the following code for importing the packages.

3.Code Implementation

I am creating a dummy project in which I am adding a button. With the click of a button, I am navigating on Razorpay SDK and after success or failure of payment, I am showing the toast message.

Add the following code to your project. In the block of code, I am calling 3 methods in my initState.
these methods will handle the success/failure of payments.

Now let’s creating the above called methods.

Now let’s create the last method open the checkout method and call it at the click of button.

I am using all the dummy data in the openCheckout method.

4.Check the Output

Now the code implementation has been completed and it’s time to check the implementation.

Refer to the attached video for the output.

Output when the payment is can see message is coming after successful payment.

Output when the payment is fail.

Congratulations!!!! you have learned how to integrate razorpay payment method in flutter using SDK.

For more details and methods you can refer to the official doc of flutter here.

For more interesting blogs check out here –

Hope this blog helped you with a better understanding that integrate razorpay payment method in flutter using SDK.

Thanks for reading.😇

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home