icash 0.1.1 copy "icash: ^0.1.1" to clipboard
icash: ^0.1.1 copied to clipboard

icash.io is flutter plugin that let's developer to integrate native icash payment method into their flutter application.

icash #

icash_sdk is flutter plugin that let's developer to integrate native iCash payment method into their flutter application with just few lines of code.

Getting Started #

How to install

Depend on it

```Language

dependencies:
  icash: 0.0.1

  ```

Usage

1. Implement `IcashInterface` to your widget and overwrite `onIcashSuccess` and `onIcashError` error methods.

    Example 
    ```Language
        import 'package:icash/icash.dart';
        //..your code 
        class _IcashTestState extends State<MyApp> implements IcashInterface {
            //..your code 

              @override
                void onIcashSuccess(Map<String, String> _res) {
                    //_res consist of response with 
                    //{"process_id":"5857603639157688230722287658","customer":"Test User","merchant":"Test Company","amount":"100","transaction_id":"abc12356","status":"Complete"}
                }
            //..your code 
              @override
                void onIcashError(String _action) {
                    //_action consist of error type which is one of 
                    APP_CLOSED
                    NETWORK_ERROR
                    DUPLICATE
                    TRANSACTION_ERROR
                }

            //..your code 

    ```
2. To initiate payment process declear iCashPayment class and call doPayment method as below
        ```Language
                //pass you current widget build context
              void initatePayment(BuildContext _ctx) {
                iCashPayment _ipayment = iCashPayment(this);
                _ipayment.doPayment(_ctx,
                    vendor_key: "your vendor key",
                    amount: "1000",
                    title: "Icash Test",
                    description: "This is only for test",
                    transaction_id: "abc123456");
                }

        ```    

Complete Example

    import 'package:flutter/material.dart';
    import 'package:icash/icash.dart';

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

class IcashTestState extends StatefulWidget {
  const IcashTestState({Key? key}) : super(key: key);

  @override
  State<IcashTestState> createState() => _IcashTestState();
}

class _IcashTestState extends State<IcashTestState> implements IcashInterface {

  @override
  void initState() {
    super.initState();
  }

  @override
  void onIcashSuccess(Map<String, String> _res) {
    //_res consist of response with 
    //{"process_id":"5857603639157688230722287658","customer":"Test User","merchant":"Test Company","amount":"100","transaction_id":"abc12356","status":"Complete"}
    }

  @override
  void onIcashError(String _action) {
    //_action consist of error type which is one of 
        APP_CLOSED
        NETWORK_ERROR
        DUPLICATE
        TRANSACTION_ERROR
  }

  void initatePayment(BuildContext _ctx) {
      iCashPayment _ipayment = iCashPayment(this);
      _ipayment.doPayment(_ctx,
          vendor_key: "your vendor key",
          amount: "1000",
          title: "Icash Test",
          description: "This is only for test",
          transaction_id: textFieldController.text);
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('iCash Payment Test App'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Builder(
                builder: (context) => RaisedButton(
                  onPressed: () {
                    initatePayment(context);
                  },
                  child: Text('Pay 100'),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}

2
likes
50
pub points
0%
popularity

Publisher

unverified uploader

icash.io is flutter plugin that let's developer to integrate native icash payment method into their flutter application.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter, http, webview_flutter

More

Packages that depend on icash