flutter_union_pay

Pub Version

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**/

Dependencies

Android

union_paySDK flutter_plugin V2

iOS

union_paySDK

Supported Platforms

  • Android
  • iOS

Exmaple

see exmaple folder

Guide

判断是否安装云闪付App

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
schemeiOS SchemeString仅iOS需要设置

监听支付结果

FlutterUnionPay.listenMessage((PaymentResult result) {
   //place your code here.
});

常量和模型

PaymentResult

class PaymentResult {
  int code = 0;
  PaymentStatus get status => PaymentStatus.values[code];
  PaymentResult.fromJson(String e) {
    dynamic json = jsonDecode(e);
    this.code = json['code'];
  }
}

PaymentStatus

enum PaymentStatus {
  ///支付取消
  CANCEL,

  ///支付成功
  SUCCESS,

  ///支付失败
  FAIL,
}

PaymentEnv

enum PaymentEnv {
  ///生产环境
  PRODUCT,

  ///测试环境
  ///
  /// 测试环境测试需要卸载设备中的App
  DEVELOPMENT,
}

Author

github@laiiihz

Libraries

flutter_union_pay
payment_result_model
union_pay_enum