h5pay-flutter
所属分类:支付接口
开发工具:Dart
文件大小:0KB
下载次数:0
上传日期:2021-09-25 11:16:28
上 传 者:
sh-1993
说明: 一个用于flutter的H5 HTML5支付(如支付宝、微信支付)插件。,
(A H5 HTML5 payment (such as Alipay, WeChat-Pay) plugin for flutter.,)
文件列表:
.metadata (305, 2023-12-02)
.travis.yml (573, 2023-12-02)
CHANGELOG.md (519, 2023-12-02)
LICENSE (10141, 2023-12-02)
android/ (0, 2023-12-02)
android/build.gradle (866, 2023-12-02)
android/gradle.properties (82, 2023-12-02)
android/gradle/ (0, 2023-12-02)
android/gradle/wrapper/ (0, 2023-12-02)
android/gradle/wrapper/gradle-wrapper.properties (202, 2023-12-02)
android/settings.gradle (27, 2023-12-02)
android/src/ (0, 2023-12-02)
android/src/main/ (0, 2023-12-02)
android/src/main/AndroidManifest.xml (112, 2023-12-02)
android/src/main/kotlin/ (0, 2023-12-02)
android/src/main/kotlin/cn/ (0, 2023-12-02)
android/src/main/kotlin/cn/nekocode/ (0, 2023-12-02)
android/src/main/kotlin/cn/nekocode/h5pay/ (0, 2023-12-02)
android/src/main/kotlin/cn/nekocode/h5pay/H5payPlugin.kt (6294, 2023-12-02)
example/ (0, 2023-12-02)
example/.metadata (302, 2023-12-02)
example/android/ (0, 2023-12-02)
example/android/app/ (0, 2023-12-02)
example/android/app/build.gradle (1874, 2023-12-02)
example/android/app/src/ (0, 2023-12-02)
example/android/app/src/debug/ (0, 2023-12-02)
example/android/app/src/debug/AndroidManifest.xml (333, 2023-12-02)
example/android/app/src/main/ (0, 2023-12-02)
example/android/app/src/main/AndroidManifest.xml (1725, 2023-12-02)
example/android/app/src/main/kotlin/ (0, 2023-12-02)
example/android/app/src/main/kotlin/cn/ (0, 2023-12-02)
example/android/app/src/main/kotlin/cn/nekocode/ (0, 2023-12-02)
example/android/app/src/main/kotlin/cn/nekocode/h5pay_example/ (0, 2023-12-02)
example/android/app/src/main/kotlin/cn/nekocode/h5pay_example/MainActivity.kt (131, 2023-12-02)
... ...
# 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
Use the `showH5PayDialog` method to show a loading dialog and jump to payment app. When user switches from payment app back to your app, you can check payment result with your server in the `verifyResult` callback (Optional).
```dart
import 'package:h5pay/h5pay.dart';
final PaymentStatus status = await showH5PayDialog(
context: context,
// You can get payment url (normally is http or payment app scheme) from server in the getPaymentArguments callback
getPaymentArguments: () async => PaymentArguments(
url: 'https://is.gd/4cLE6j',
redirectSchemes: ['alipay', 'alipays', 'weixin', 'wechat'],
httpHeaders: {
'referer': 'https://xxx',
},
),
verifyResult: () async => true, // check order result with your server
);
if (status == PaymentStatus.success) {
// Do something
}
```
Values of `PaymentStatus`:
```dart
enum PaymentStatus {
idle,
gettingArguments,
getArgumentsFail,
launchingUrl,
cantLaunchUrl, // Maybe target payment app is not installed
launchUrlTimeout, // Maybe redirecting url is fail
jumping,
jumpTimeout,
verifying,
success,
fail,
}
```
### Notes
* In iOS, for allowing to jump to the payment app from your app, you must add schemes of the payment apps 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.
近期下载者:
相关文件:
收藏者: