Urgent.News

What's breaking now, across thousands of outlets.

Tech

UPI Payment Gateway in Flutter (Razorpay) — The Complete 2026 Guide

So, in this article, I will be showing you how you can integrate UPI payments in your Flutter app using Razorpay. By the end, you will have a working payment flow — UPI, cards, and net banking — with the app talking to your own backend for order creation and verification, exactly the way you should be building it in production. Razorpay is the most-used payment gateway for UPI in India for a…

This guide demonstrates how to integrate UPI payments into a Flutter app using Razorpay. By following the steps outlined below, you can create a secure and seamless payment flow that includes UPI, cards, and net banking. Your app will communicate with your own backend for order creation and verification, ensuring a robust production-ready solution.

To get started, add the Razorpay Flutter SDK to your Flutter project's `pubspec.yaml` file:

```

dependencies:

flutter: sdk: flutter

razorpay_flutter: ^1.3.7

```

Run `flutter pub get` to fetch the dependency. It's crucial to use the official Razorpay Flutter SDK version to avoid issues with outdated or unmaintained packages.

Remember, your app should never store secrets or decide the payment amount. All sensitive information and payment amounts should originate from your secure backend to prevent unauthorized access and maintain user trust.

The recommended flow involves sending orders to your backend, which creates an order on Razorpay's platform and returns an `orderId` to your app. The app then initiates the Razorpay checkout process using this `orderId`.

On your backend, create an order with Razorpay's API. The `amount` should be provided in paise (e.g., 14900 paise for 149 rupees), and the `payment_capture` parameter should be set to `1` for automatic capture or `0` for manual capture.

Initialize the Razorpay SDK in your Flutter app and register event handlers for successful payments, errors, and external wallet payments. Open the checkout using the `startCheckout` method, passing the amount in paise. Handle the success and error callbacks appropriately, sending both the `paymentId` and `orderId` to your backend for verification.

By adhering to this guide, you'll be able to build a reliable and secure UPI payment system in your Flutter app, leveraging Razorpay's powerful and user-friendly SDK.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Wednesday 12 August →