jio_payment_sdk 0.0.7

SDKflutter
Platformandroidios

A Flutter package to integrate Jio Payment Gateway.

Jio Payment SDK for Flutter

pub package


📑 Table of Contents

  1. Overview
  2. Features
  3. Installation
  4. Usage
  5. Security
  6. ProGuard / Obfuscation

📖 Overview

The Jio Payment SDK provides a seamless way to integrate Jio Payments (UPI, NetBanking, Cards, QR, VPA) into your Flutter applications.
It’s secure, fast, and customizable, built for production-grade payment flows.


✨ Features

  • 🔒 Secure Jio Payments integration
  • 💳 Supports UPI, NetBanking, QR, VPA, Cards
  • 📦 Easy to add and configure
  • 🎨 Customizable merchant branding
  • 📱 Example app included

📦 Installation

Add the dependency to your pubspec.yaml:

dependencies:
  jio_payment_sdk: ^0.0.6

Then run:

flutter pub get

⚡ Usage

Import the SDK:

import 'package:jio_payment_sdk/jio_payment_sdk.dart';

Initialize payments:

To initialize the Jio Payment SDK, you need to call JioPaymentSdk.initializeJioPayments() with the required configuration.

JioPaymentSdk.initializeJioPayments(
    /// Required Params.............................
    context,
    callback: this,
    amount: am,
    env: JioPaymentEnv.uat, // Change to JioPaymentEnv.prod in production
    merchantId: 'JP2000000000031',
    aggId: "",
    secretKey: "abc",
    email: 'test@gmail.in',
    userName: 'Test User',
    merchantName: 'Reliance',
    merchantImage: "asset/Ajio logo.png",
    merchantTrId:merchantTxnNo() ,
    isAssetMerchantImage: true,


    /// Optional Params.............................
    orderSummary: OrderSummary(title: "Order Summary", items: orderDetailList),
    theme: CustomTheme(primaryColor: const Color.fromRGBO(227, 155, 43, 1), secondaryColor: Colors.black87),
    paymentMethod: PaymentMethod.netBanking,
    allowedPaymentTypes: ["CARD", "NB", "UPI_QR","UPI_INTENT","UPI_VPA"],
    timeOut: 1000,

);

Callback Handling

Your widget’s state should implement the PaymentCallback interface to handle payment results.

@override
void onPaymentCompletedResponse(PaymentResult result) {
  setState(() => _isPaying = false);

  if (result.success) {
    ScaffoldMessenger.of(context).showSnackBar(
      const SnackBar(
        content: Text("Payment Successful 🎉"),
        backgroundColor: Colors.green,
      ),
    );
    Future.delayed(const Duration(seconds: 2), () {
      Navigator.pop(context);
    });
  } else {
    ScaffoldMessenger.of(context).showSnackBar(
      const SnackBar(
        content: Text("Payment Failed ❌"),
        backgroundColor: Colors.red,
      ),
    );
    _showFailureDialog();
  }
}

Parameters

ParameterDescription
amountAmount to be charged (double)
envEnvironment (JioPaymentEnv.uat or JioPaymentEnv.prod)
merchantIdProvided by JioPay
secretKeySecret key for authentication
merchantTrIdUnique transaction ID
orderSummaryDetails of products in the order
themeCustomize payment UI colors
allowedPaymentTypesList of allowed payment modes (CREDIT_CARD, DEBIT_CARD, NB, UPI_QR, UPI_INTENT, UPI_VPA)
timeOutTimeout in seconds for transaction

Open Checkout

In this example, the checkout is triggered in initState() so the payment flow starts as soon as the screen opens.

@override
void initState() {
  super.initState();
  WidgetsBinding.instance.addPostFrameCallback((_) {
    _startPayment();
  });
}

🔒 Security

  • ❌ Do not hardcode sensitive keys in your app.
  • ✅ Always keep your secretKey secure.
  • 🔄 Rotate keys regularly.
  • 🛡️ Enable obfuscation in production builds.

🛡️ ProGuard / Obfuscation

For Android builds:

flutter build apk --release --obfuscate --split-debug-info=build/debug-info

If you are using ProGuard, add these rules:

-keepattributes *Annotation*
-dontwarn com.yourcompany.jio_payment_sdk.**
-keep class com.yourcompany.jio_payment_sdk.** {*;}