cashfree_pg 0.0.3+3 copy "cashfree_pg: ^0.0.3+3" to clipboard
cashfree_pg: ^0.0.3+3 copied to clipboard

discontinuedreplaced by: flutter_cashfree_pg_sdk
outdated

A Flutter plugin for Cashfree PG integration. It opens the payment page in a flutter_webview.

example/lib/main.dart

import 'dart:async';
import 'dart:convert';
import 'dart:math';

import 'package:cashfree_pg/cashfree_pg.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

void main() => runApp(MaterialApp(home: MyApp()));

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('CFSDK Sample'),
        ),
        body: Center(
          child: RaisedButton(
            child: Text('DO PAYMENT'),
            onPressed: () {
              makePayment();
            },
          ),
        ),
      ),
    );
  }

  makePayment() {
    //Replace with actual values
    String stage = "TEST";
    String orderId = "Order Id";
    String orderAmount = "ORDER AMOUNT";
    String tokenData = "TOKEN_DATA";
    String customerName = "Customer Name";
    String orderNote = "Order Note";
    String orderCurrency = "INR";
    String appId = "APP_ID";
    String customerPhone = "9094395340";
    String customerEmail = "sample@gmail.com";
    String notifyUrl = "https://test.gocashfree.com/notify";

    Map<String, dynamic> inputParams = {
      "orderId": orderId,
      "orderAmount": orderAmount,
      "customerName": customerName,
      "orderNote": orderNote,
      "orderCurrency": orderCurrency,
      "appId": appId,
      "customerPhone": customerPhone,
      "customerEmail": customerEmail,
      "stage": stage,
      "notifyUrl": notifyUrl
    };

    CashfreePGSDK.doPayment(inputParams)
        .then((value) => value?.forEach((key, value) {
              print("$key : $value");
              //Do something with the result
            }));
  }
}
40
likes
0
pub points
90%
popularity

Publisher

unverified uploader

A Flutter plugin for Cashfree PG integration. It opens the payment page in a flutter_webview.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on cashfree_pg