我正在应用程序中集成条纹支付网关以实现订阅流程。
包装信息: flutter_stripe:^9.6.0
paymentIntent = await createPaymentIntent('10000', 'GBP');
var gpay = const PaymentSheetGooglePay(merchantCountryCode: "GB",
currencyCode: "GBP",
testEnv: true);
print(paymentIntent);
//STEP 2: Initialize Payment Sheet
await Stripe.instance
.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
allowsDelayedPaymentMethods: true,
setupIntentClientSecret: paymentIntent![
'client_secret'], //Gotten from payment intent
style: ThemeMode.light,
merchantDisplayName: 'Abhi',
googlePay: gpay))
// paymentIntentClientSecret: paymentIntent![
// 'client_secret'], //Gotten from payment intent
// style: ThemeMode.light,
// merchantDisplayName: 'Abhi',
// googlePay: gpay))
.then((value) {
print(value);
});
//STEP 3: Display Payment sheet
await Stripe.instance.confirmSetupIntent(
paymentIntentClientSecret: paymentIntent!['client_secret'],
params: const PaymentMethodParams.card(paymentMethodData: PaymentMethodData()),
).then((value) {
if(kDebugMode) print("Payment Successfully");
if(kDebugMode) print(value);
});
在第三步中,PaymentMethodParams 参数是必需的。在传递上述值时:卡详细信息不完整,消息:卡详细信息不完整,stripeErrorCode:null,decayCode:null,type:null))我收到上述错误。
我想设置订阅卡。 PaymentMethodParams需要银行卡详细信息,我不明白为什么confirmSetupIntent设置在打开表单之前需要银行卡详细信息。
Stripe.instance.presentPaymentSheet()
方法用于显示付款单。您正在使用 confirmSetupIntent()
,它用于在收集付款详细信息后确认设置意图。该方法不用于显示付款单。
查看 Flutter Stripe 文档 了解更多详细信息(GitHub 源链接,因为他们的网站目前似乎已关闭)。