upi_uri

Pub Version Dart Version License

A Flutter/Dart package to encode and decode UPI URIs for payment integration in your app.


Features

  • Generate UPI payment URLs easily.
  • Parse UPI URLs to extract payment details.
  • Simple and lightweight.
  • Works on Flutter and pure Dart projects.

Installation

Add this to your package’s pubspec.yaml file:

dependencies:
  upi_uri: ^0.0.1

Then RUN

flutter pub get

Usage

Displaying a UPI QR Code

You can use the UpiQrCode widget to generate and display a UPI payment QR code in your Flutter app.

import 'package:flutter/material.dart';
import 'package:upi_uri/upi_uri.dart'; // Import the package
import 'package:upi_uri/qr_widget.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'UPI QR Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: Scaffold(
        body: Column(
          children: [
            UpiQrCode(
              payeeVpa: 'vp110064@okaxis',   // Payee UPI ID
              payeeName: 'Demo User',         // Payee Name
              amount: '100000',               // Amount
              txnRef: 'TXN123456',            // Transaction Reference
              size: 250,                      // QR code size
            ),
          ],
        ),
      ),
    );
  }
}