# h5pay-flutter **Repository Path**: cc/h5pay-flutter ## Basic Information - **Project Name**: h5pay-flutter - **Description**: No description available - **Primary Language**: Dart - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-03-28 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # h5pay [![build status](https://api.travis-ci.com/nekocode/h5pay-flutter.svg)](https://travis-ci.com/nekocode/h5pay-flutter) [![pub package](https://img.shields.io/pub/v/h5pay.svg)](https://pub.dev/packages/h5pay) A H5 payment (such as Alipay, WeChat Pay) plugin for flutter. ## Usage You can use the `showH5PayDialog` method to show a loading dialog and jump to payment app. When user switches from payment app to your app, the dialog will auto check the payment result. ```dart import 'package:h5pay/h5pay.dart'; final PaymentStatus status = await showH5PayDialog( context: context, paymentSchemes: const ['alipay', 'alipays', 'weixin', 'wechat'], getPaymentUrlTimeout: const Duration(seconds: 5), jumpTimeout: const Duration(seconds: 3), getPaymentUrl: () async => 'xxx', // get the app scheme (or http) payment url from your server verifyResult: () async => true, // check order result from your server ); if (status == PaymentStatus.success) { // Do something } ``` Values of `PaymentStatus`: ```dart enum PaymentStatus { idle, gettingPaymentUrl, getPaymentUrlTimeout, jumping, cantJump, // Maybe target payment app is not installed jumpTimeout, verifying, success, fail, } ``` ### Notes * In iOS, to jump to the payment app, you must add target schemes into the `Info.plist` file. Just like: ```xml LSApplicationQueriesSchemes wechat weixin alipay alipays ``` ### Advanced If you have more complex requirements, you can use the `H5PayWidget`. Check the [example](example) for more detail.