首页 > 解决方案 > 我需要在条带支付方式中为 paymentIntentClientSecret 传递哪些参数?

问题描述

我正在创建条纹支付方式,但我不知道 paymentIntentClientSecret 需要什么,所以请帮我看看我的代码

 await Stripe.instance.initPaymentSheet(
        paymentSheetParameters: SetupPaymentSheetParameters(
          applePay: true,
          googlePay: true,
          style: ThemeMode.dark,
          testEnv: true,
          merchantCountryCode: 'US',
          merchantDisplayName: 'Flutter Stripe Store Demo',
          customerId: "4242424242424242",
          paymentIntentClientSecret:"",
          customerEphemeralKeySecret:"sk_test_51JfOcKL28pDgfM8ZNcOgXcOau98OqZMoauV9Qq4fG06rsrHjL2olm4oIkd4DQCCuOh3079xJIo0t1KGNiv5c382L00ZNJHlCaU",

        )); 

标签: flutterdartstripe-paymentspayment-gateway

解决方案


根据doc, paymentIntentClientSecret 似乎需要一个字符串。

paymentIntentClientSecret property Null safety
String? paymentIntentClientSecret

inherited

Secret used for client-side retrieval using a publishable key.
If this value is null make sure to add a setupIntentClientSecret

再次基于文档,它来自运行

final paymentIntentClientSecret =
      await _createPaymentIntent(Stripe.getReturnUrl());

/// Create payment intent and return the client secret.
/// The `return_url` must be set on the PaymentIntent.
/// https://stripe.com/docs/payments/payment-intents/android#create-payment-intent
Future<String> _createPaymentIntent(String returnUrl) {
  return Future.value("client_secret");
}

推荐阅读