32 lines
827 B
Dart
32 lines
827 B
Dart
|
|
import 'package:circle_app/util/util.dart';
|
|
|
|
import '../common/Widgets/open_vip_tip/logic.dart';
|
|
import 'package:fluwx/fluwx.dart' as fluwx;
|
|
//微信支付
|
|
Future<void> openWxPay(PaymentData data) async {
|
|
//是否安装微信
|
|
bool isInstalled = await fluwx.isWeChatInstalled;
|
|
if (!isInstalled) {
|
|
showToast("请先安装微信");
|
|
return;
|
|
}
|
|
//调起支付
|
|
fluwx.payWithWeChat(
|
|
appId: data.appId,
|
|
partnerId: data.mchId,
|
|
prepayId: data.prepayId,
|
|
packageValue: data.packageX,
|
|
nonceStr: data.nonceStr,
|
|
timeStamp: int.parse(data.timestamp),
|
|
sign: data.sign,
|
|
);
|
|
//监听微信回调
|
|
fluwx.weChatResponseEventHandler.listen((event) {
|
|
if(event.isSuccessful) {
|
|
showToast("微信支付成功");
|
|
} else {
|
|
showToast(event.errStr??"微信支付成功");
|
|
}
|
|
});
|
|
} |