payfort_plugin 0.3.1 copy "payfort_plugin: ^0.3.1" to clipboard
payfort_plugin: ^0.3.1 copied to clipboard

PAYFORT integration became easy with flutter ,this plugin allows you to use payfort for both android and ios.

example/lib/main.dart

import 'dart:async';

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

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

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

class _MyAppState extends State<MyApp> {
  Map? result;

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {}

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: RaisedButton(
            child: Text('pay'),
            onPressed: () {
              PayfortPlugin.getID.then((value) => {
                    //use this call to get device id and send it to server
                    PayfortPlugin.performPaymentRequest(
                            'YOR_MERCHANT_REF',
                            'YOUR_SDK_TOKEN',
                            'ahmed',
                            'en',
                            'user@mail.com',
                            '100',
                            'PURCHASE',
                            'EGP',
                            '0' //zero for test mode and one for production
                            )
                        .then((value) => {
                              debugPrint(
                                  'card number is ${value!['card_number']}')
                            })
                  });
            },
          ),
        ),
      ),
    );
  }
}
12
likes
140
pub points
28%
popularity

Publisher

unverified uploader

PAYFORT integration became easy with flutter ,this plugin allows you to use payfort for both android and ios.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on payfort_plugin