Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

h5pay plugin for wechat and alipay

Flutter H5Pay

A Flutter plugin for h5pay(Support WeChat and Alipay)

Usage

Add flutter_h5pay as a dependency in your pubspec.yaml file.

dependencies:
    flutter_h5pay: ^0.1.0
import 'package:flutter_h5pay/h5pay.dart';


//wrap you widget with H5PayWidget
//call the pay method to invoke the payment app

H5PayWidget(
          refererScheme: "www.xx.com://",
          builder: (ctx, controller) {
            return FlatButton(
                onPressed: () {
                  controller.pay(getPayUrl(), jumpPayResultCallback: (p) {
                    print("jump pay app result ->$p");
                  });
                },
                child: Text("pay"));
          },
        )


iOS

Opt-in to the embedded views preview by adding a boolean property to the app’s Info.plist file with the key io.flutter.embedded_views_preview and the value YES.

Notice

When payment completed or cancelled,on IOS, if need to return to the App,you must add target URL Types into the Info.plist file。

For Exmalpe. If you referer(申请H5支付时的授权域名) is http://www.xx.com In Android you can set this referer. In iOS you should set like this www.xx.com:\\,and add a URL Schemes of www.xx.com into the Info.plist file.Please refer to this article for more details.

Download Flutter H5Pay app source code on GitHub

https://github.com/shingohu/flutter_h5pay

Exit mobile version