jio_payment_sdk 0.0.13 copy "jio_payment_sdk: ^0.0.13" to clipboard
jio_payment_sdk: ^0.0.13 copied to clipboard

A Flutter package to integrate Jio Payment Gateway.

Jio Payment SDK for Flutter #

pub package License Flutter Version


Table of Contents #

  1. Overview
  2. Features
  3. Requirements
  4. Installation
  5. Android Setup
  6. iOS Setup
  7. Usage
  8. Handling Payment JSON Response
  9. Security
  10. Obfuscation
  11. Changelog

Overview #

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


Features #

  • Secure Jio Payments integration
  • Supports UPI QR, UPI Intent, UPI VPA, NetBanking, and Cards
  • Built-in UPI app discovery (Google Pay, PhonePe, Paytm, BHIM, CRED, and 50+ more)
  • Customizable merchant branding and theming
  • Payment timeout configuration
  • Order summary support
  • Example app included

Requirements #

Requirement Version
Flutter >= 3.3.0
Dart SDK >= 2.18.0 < 4.0.0
Android minSdk 24 (Android 7.0)
Android compileSdk 35
AGP (Android Gradle Plugin) 7.4+ (compatible up to 8.7+)
Kotlin 1.9.0+
Java 1.8+
iOS 12.0+

Installation #

Add the dependency to your pubspec.yaml:

dependencies:
  jio_payment_sdk: ^0.0.13

Then run:

flutter pub get

Android Setup #

Ensure your android/app/build.gradle has minSdk 24 or higher:

android {
    defaultConfig {
        minSdk 24
    }
}

The plugin is backward compatible with AGP 7.4+ through AGP 8.7+. No special Gradle configuration is required -- it adapts to your project's AGP version automatically.


iOS Setup #

Add the following UPI app schemes to your ios/Runner/Info.plist to enable UPI app discovery on iOS:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>upi</string>
    <string>gpay</string>
    <string>phonepe</string>
    <string>paytm</string>
    <string>paytmmp</string>
    <string>bhim</string>
    <string>cred</string>
</array>

Usage #

1. Import the SDK #

import 'package:jio_payment_sdk/jio_payment_sdk.dart';

2. Implement PaymentCallback #

Your widget's State class must implement PaymentCallback:

class _HomepageState extends State<Homepage> implements PaymentCallback {

  @override
  void onPaymentCompletedResponse(PaymentResult result) {
    if (result.success) {
      print("Transaction Successful: ${result.transactionId}");
    } else {
      print("Payment Failed: ${result.jsonData}");
    }
  }
}

This callback is the only way to receive payment results from the SDK.

3. Initialize Payments #

JioPaymentSdk.initializeJioPayments(
  /// Required Params
  context,
  callback: this,
  amount: 100.00,
  env: JioPaymentEnv.uat, // Change to JioPaymentEnv.prod for production
  merchantId: 'your_merchant_id',
  aggId: 'your_aggregator_id',
  secretKey: 'your_secret_key',
  email: 'customer@example.com',
  userName: 'Customer Name',
  merchantName: 'Your Brand',
  merchantImage: 'asset/logo.png',
  merchantTrId: 'UNIQUE_TXN_ID',
  isAssetMerchantImage: true,

  /// Optional Params
  orderSummary: OrderSummary(title: "Order Summary", items: orderDetailList),
  addlParam1: "",
  addlParam2: "",
  theme: CustomTheme(
    primaryColor: const Color.fromRGBO(227, 155, 43, 1),
    secondaryColor: Colors.black87,
  ),
  allowedPaymentTypes: ["CARD", "NB", "UPI_QR", "UPI_INTENT", "UPI_VPA"],
  mccCode: "your_mcc_code", // Optional — required on Android for UPI VPA
  timeOut: 1000,
);

Parameters #

Parameter Type Required Description
amount double Yes Transaction amount
env JioPaymentEnv Yes .uat for testing, .prod for production
merchantId String Yes Unique merchant identifier
aggId String Yes Aggregator ID
secretKey String Yes Secret key for authentication
email String Yes Customer email
userName String Yes Customer name
merchantName String Yes Brand name displayed in the SDK UI
merchantImage String Yes Logo displayed in the SDK UI
merchantTrId String Yes Unique transaction ID per payment request
isAssetMerchantImage bool Yes true if logo is a local asset, false for network URL
callback PaymentCallback Yes Callback to receive payment result
orderSummary OrderSummary No Order details to display
addlParam1 String No Additional parameter
addlParam2 String No Additional parameter
theme CustomTheme No Customize primary and secondary colors
allowedPaymentTypes List<String> No Payment modes: CARD, NB, UPI_QR, UPI_INTENT, UPI_VPA
mccCode String No MCC code — required on Android for UPI_VPA to be available. On iOS, UPI_VPA works without this parameter.
timeOut int No Transaction timeout in seconds (default: 1000)

Handling Payment JSON Response #

The SDK returns a PaymentResult object through the PaymentCallback:

class PaymentResult {
  final bool success;
  final String? transactionId;
  final dynamic jsonData;
}
Field Type Description
success bool Whether the transaction succeeded
transactionId String? Unique transaction ID from JioPay
jsonData dynamic Full transaction details (status, reference ID, payment mode, message)

Example:

@override
void onPaymentCompletedResponse(PaymentResult result) {
  if (result.success) {
    print("Transaction ID: ${result.transactionId}");
    print("Details: ${result.jsonData}");
  } else {
    print("Failed: ${result.jsonData}");
  }
}

Security #

  • Do not hardcode sensitive keys (secretKey, merchantId) in your source code.
  • Use environment variables or a secure backend to provide credentials at runtime.
  • Always enable obfuscation in production builds.

Obfuscation #

Android:

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

iOS:

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

Changelog #

0.0.13 #

  • Updated example app: replaced MCC Code dropdown with a free-text TextField for easier input
  • Improved documentation and code comments across SDK configuration and base classes

0.0.12 #

  • Added optional mccCode parameter for Android UPI VPA support
  • On Android, UPI_VPA payment type now requires a valid mccCode to be displayed
  • On iOS, UPI_VPA continues to work without any additional configuration

0.0.11 #

  • Merged UPI plugin (flutter_upi_india) directly into the SDK -- no more external dependency
  • Built-in UPI app discovery for 50+ Indian UPI apps (Google Pay, PhonePe, Paytm, CRED, BHIM, and more)
  • Native Android (Kotlin) and iOS (Swift/ObjC) plugin support included
  • Backward compatible with AGP 7.4+ through 8.7+ (Java 1.8, Kotlin 1.9.0+)
  • Supports Android compileSdk 35
  • Removed path dependency for pub.dev compatibility