Stripe Connect:Apple Pay 无法使用

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

我已按照 stripe here 的分步说明进行操作。

但最后正如你所看到的文档所说:

Use the Payment Request Button with Stripe Connect by updating the stripe instance,

const stripe = Stripe('pk_test_qblFNYngBkEdjEZ16jxxoWSM', {
  apiVersion: "2023-08-16",
  stripeAccount: 'CONNECTED_STRIPE_ACCOUNT_ID',
});

但是最初在文档中作者使用了loadStripe,但是使用loadStripe我们无法再次重新初始化stripe实例并连接商家的帐户。

因为在我的 React 组件下面我正在使用

const stripe = useStripe();

从父级检索条带实例。

有人可以分享一个示例,如何在父组件中使用 loadStripe 时,如何将 stripe 帐户与 useStripe 挂钩连接。基本上如何更新条带实例?

fyi,我在我的父组件中使用:

const stripe_promise = loadStripe(publishableKey, {
    stripeAccount: business.stripe_account_id,
}); 
reactjs react-hooks stripe-payments applepay
1个回答
0
投票

您是否通过调用 /v1/apple_pay/domains 为连接的帐户注册了域名? https://stripe.com/docs/ payments/ payment-methods/pmd-registration?platform=api#register-your-domain-while-using-connect 这是此操作所必需的。

否则,你的前端代码看起来不错。您可以不能更改实例,但要更改使用哪个(如果有)stripeAccount,它只能在 init 上使用 loadStripe 设置。

© www.soinside.com 2019 - 2024. All rights reserved.