没有初始化的paymentConfiguration。致电PaymentConfiguration.init()

问题描述 投票:0回答:1

目前,我正在尝试在React Native中实现带有订阅付款的条纹。我使用 @Stripe/Stripe-react-Reaction-native库。我做了创建客户和订阅的后端。 后端返回客户ID和SecretClient时起作用。我用脱衣舞夹包装整个应用程序。 initpaymentsheet有效,但现在的付款表不起作用,因为它返回标题中的错误。

I在Internet上进行搜索,解决方案是修改Android的本机代码。这里有没有人遇到此问题,并且知道如何在不修改Android本机代码的情况下解决该问题?

我的代码段是这里

1。在app.js

<StripeProvider publishableKey={process.env.EXPO_PUBLIC_STRIPE_PUBLISHABLE_KEY} > <NavigationContainer theme={MyTheme}> <RootNavigation /> </NavigationContainer> </StripeProvider>

2。我需要显示条纹付款表的文件
  async function handleEditPaymentMethod() {
    const success = await setupStripePaymentSheet();
    if (success) {
      await openStripeCheckout();
    }
  }

<ButtonExtend onPress={handleEditPaymentMethod} > <Text> Upgrade </Text> </ButtonExtend>
3。我实现Initpaymentsheet和prangePaymentsheet和APICall
的文件
import { initPaymentSheet, presentPaymentSheet, } from "@stripe/stripe-react-native"; import { supabase } from "./supabase"; const fetchStripekeys = async () => { const { data, error } = await supabase.functions.invoke("stripe-subscription"); if (error) { return false; } return data; }; export const setupStripePaymentSheet = async (totalAmount) => { try { const { subscriptionId, clientSecret } = await fetchStripekeys(totalAmount); if (!subscriptionId || !clientSecret) { return false; } const { error } = await initPaymentSheet({ paymentIntentClientSecret: clientSecret, customerId: subscriptionId, merchantDisplayName: "My Company", }); if (error) { return false; } return true; } catch (error) { return false; } }; export const openStripeCheckout = async () => { const { error } = await presentPaymentSheet(); if (error) { return false; } return true; };

以不同的是我的帐户,这是它显示的错误日志
android react-native expo stripe-payments stripes
1个回答
0
投票
{“代码”:“失败”,“ declinecode”:null,“ entimizedMessage”:“ payment conconconfiguration未经初始化。呼叫payerdeconconfiguration.init()。”,“ message”:“ paymentconconfiguration notialitized paysectionconfiguration non InliTIAL INTIRLINED。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.