JioPay Flutter

Flutter plugin for JioPay SDK.

Getting Started

This flutter plugin is a wrapper around our Android and iOS SDKs.

Installation

Add this to dependencies in your app's pubspec.yaml

flutter_jiopay_pg_uat: ^0.0.1

Note for Android: Make sure that the minimum API level for your app is 19 or higher.

Usage

Sample code to integrate can be found in example/lib/main.dart.

Import package

import 'package:flutter_jiopay_pg_uat/flutter_jiopay_pg.dart';

Create Jiopay instance

JiopayPg jiopayFlutterPlugin= JiopayPg();

Attach event listeners

The plugin uses event-based communication, and emits events when payment fails or succeeds.

The event names are exposed via the constants EVENT_PAYMENT_SUCCESS, EVENT_PAYMENT_ERROR from the JiopayPg class.

Use the on(String event, Function handler) method on the JiopayPg instance to attach event listeners.


jiopayFlutterPlugin.on(JiopayPg.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
jiopayFlutterPlugin.on(JiopayPg.EVENT_PAYMENT_ERROR, _handlePaymentError);

The handlers would be defined somewhere as


  void _handlePaymentSuccess(PaymentSuccessResponse response) {
    debugPrint(msg: "SUCCESS: " + response.tnxId!);
  }

  void _handlePaymentError(PaymentFailureResponse response) {
    debugPrint('_handlePaymentError: $response');
  }

Setup options

var options={
      'appaccesstoken': "APP_ACCESS_TOKEN",
      'appidtoken':"APP_ID_TOKEN",
      'intentid': "INTENT_ID",
      'theme': {
        'brandColor': "BRAND_COLOR_HEX",
        'bodyBgColor': "BODY_BG_COLOR_HEX",
        'bodyTextColor': "BODY_TEXT_COLOR",
        'headingText': "HEADING_TEXT_COLOR",
      },
    }

Open Checkout

jiopayFlutterPlugin.open(options);

Libraries

flutter_jiopay_pg