Stripe不显示付款表



我确实收到了客户端的秘密,我所有的测试付款都显示在条纹仪表板上。然而,当调用当前付款时,它给我一个错误'No payment sheet has initialized yet'。

// calling func on cloud functions
// create payment intent
final url = Uri.parse(
'https://us-central1-wpbakery-52166.cloudfunctions.net/stripePayment');
final response =
await http.get(url, headers: {'Content-Type': 'application/json'});
_paymentIntent = json.decode(response.body);
print(_paymentIntent);
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
paymentIntentClientSecret: _paymentIntent['paymentIntent'],
applePay: true,
style: ThemeMode.dark,
));
await Stripe.instance.presentPaymentSheet();
}```

我假设你正在使用flutter_stripe库?

如果是这样,那么你还需要在SetupPaymentSheetParameters中传递merchantCountryCode,因为文档提到当Apple Pay启用时需要[1]。

您还应该确保在调用initPaymentSheet之前设置了Stripe.merchantIdentifier

最新更新