[英]Stripe Connect – enable Apple Pay?
我正在嘗試使用PaymentElement
使 Stripe Connect 帳戶在我的應用程序中接受付款。 到目前為止,付款是通過常規信用卡輸入進行的,但現在我想啟用 Apple Pay。
因此,我將我的域名添加到我的主要 Stripe 帳戶配置中。 似乎這還不夠,所以我還使用他們的 API 為特定的 Connect 帳戶添加了域名:
await stripe.applePayDomains.create(
{ domain_name: 'my_domain_here.com' },
{ stripeAccount: 'stripe_connect_account_id_here' },
);
當我現在在支持 Apple Pay 的 macOS 上訪問我的PaymentElement
組件 Safari 時(已在其他網站上測試和工作),ApplePay 選項不會出現,並且我收到以下控制台警告:
Either you do not have a card saved to your Wallet or the current domain (my_domain_here.com) or stripeAccount parameter (stripe_connect_account_id_here) is not registered for Apple Pay.
該卡在我的錢包中,當為帶有stripe.applePayDomains.list({ stripeAccount: 'stripe_connect_account_id_here' })
的帳戶列出它們時,域是可見的。
當我嘗試在我的 iOS 設備上訪問它時,會出現 ApplePay 選項,但觸發stripe.confirmPayment
會使 iOS 支付抽屜出現約 1 秒鍾,然后立即消失。
我在這里想念什么?
因此,截至本文發布之日,這確實是測試模式中的默認行為。 在生產環境中一切正常。
我不完全確定 Stripe 是否會(甚至可以)解決這個問題。
要為@mdmb 的答案添加更多內容,這不僅僅是測試模式,而且因為我們使用的是連接帳戶,我們需要在連接帳戶中創建 Apple 域驗證。
我聯系了 Stripe,他們建議我按照https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#verifying在代碼中創建 Apple 域作為連接帳戶-your-domain-with-apple-pay
要讓 Apple Pay 正常工作,這里需要解決一些問題:
1/ Connect賬戶必須在live模式下創建,上面那個是test模式。 因此,您需要使用實時模式詳細信息在實時模式下創建一個新的 Connect 帳戶。
2/ 需要第一步,因為您還需要在實時模式下將您的 Apple Pay 域添加到 Connect 帳戶,這首先需要一個實時模式帳戶。
這里的重要部分是您需要使用 Stripe-Account header + 平台密鑰添加 Apple Pay 域,如下所示: https://stripe.com/docs/stripe-js/elements/payment-request-button? html-or-react=html#html-js-using-with-connect 。
一旦你做了這兩件事,你仍然可以使用你平台的測試模式可發布密鑰和 stripeAccount 參數初始化 Stripe.js,Apple Pay 將工作,它只會創建測試模式令牌,如果這是你可能想要做的事情.
所以他們建議做的關鍵部分(在 PHP 中):
\Stripe\Stripe::setApiKey("sk_live_••••••••••••••••••••••••");
\Stripe\ApplePayDomain::create([
'domain_name' => 'example.com',
]);
但是,如果您使用的是更新的客戶端方式,那么您需要執行以下操作:
$stripeClient = new \Stripe\StripeClient(['api_key' => $this->stripeApiKey,'stripe_account' => $connectedAccount->stripeAccountId]);
$stripeClient->applePayDomains->create([
'domain_name' => $domainName,
]);
對其進行了測試,並且有效。 進行域驗證似乎需要大約 1.5 秒,然后似乎基本是即時的。
干杯!
我在將 Apple Pay 的域驗證添加到我的連接帳戶時遇到問題。 對於連接帳戶,您也需要添加域驗證來連接帳戶。 我犯的錯誤是我傳遞了 https://mysubdomain.example.com而 stripe 只接受 mysubdomain.example.com 格式。 雖然在錯誤中我得到它只是說我們在驗證您的域時遇到了麻煩。 所以錯誤沒有正確指出,但經過反復試驗,這就是我發現的。 希望它可以幫助某人
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.