A flutter union pay plugin.
云闪付支付插件。
可能需要关闭R8代码压缩或Proguard
android/app/build.gradle
/**Other Config**/
buildTypes {
release {
/**Other Config**/
minifyEnabled false
shrinkResources false
}
debug {
/**Other Config**/
minifyEnabled false
shrinkResources false
}
}
/**Other Config**/
- Android
- iOS
see exmaple folder
bool checkUnionPayInstalled()async{
return await FlutterUnionPay.installed;
}
String getUnionVersion()async{
return await FlutterUnionPay.version;
}
注意,该值 暂不支持iOS
startPay()async{
await FlutterUnionPay.pay(
tn: "YOUR TN CODE",
mode: PaymentEnv.PRODUCT,
scheme: "YOUR iOS SCHEME",
)
}
属性名 | 属性描述 | 数据类型 | 备注 |
---|---|---|---|
tn | 订单号 | String | |
mode | 开发环境 | PaymentEnv | |
scheme | iOS Scheme | String | 仅iOS需要设置 |
FlutterUnionPay.listenMessage((PaymentResult result) {
//place your code here.
});
class PaymentResult {
int code = 0;
PaymentStatus get status => PaymentStatus.values[code];
PaymentResult.fromJson(String e) {
dynamic json = jsonDecode(e);
this.code = json['code'];
}
}
enum PaymentStatus {
///支付取消
CANCEL,
///支付成功
SUCCESS,
///支付失败
FAIL,
}
enum PaymentEnv {
///生产环境
PRODUCT,
///测试环境
///
/// 测试环境测试需要卸载设备中的App
DEVELOPMENT,
}