将来の Cash App Pay による支払いを設定する
Cash App Pay の詳細を保存し、後で顧客に請求する方法をご紹介します。
This guide covers how to save a Cash App Pay payment details using Checkout, our fully hosted checkout page.
To create recurring payments after saving a payment method in Checkout, see Set up a subscription with Cash App Pay for more details.
Customer を作成または取得するサーバー側
今後の支払いに Cash App Pay 支払い方法を再利用できるようにするには、これを Customer に関連付けます。
Create a Customer object when your customer creates an account with your business, and associate the ID of the Customer object with your own internal representation of a customer. Alternatively, you can create a new Customer later, right before saving a payment method for future payments.
新たに Customer を作成するか、または既存の Customer を取得して、この決済に関連付けます。サーバーに以下のコードを含め、新しく Customer を作成します。
Checkout セッションを作成するサーバー側
Your customer must authorize you to use their Cash App account for future payments through Stripe Checkout. This allows you to accept Cash App payments. Add a checkout button to your website that calls a server-side endpoint to create a Checkout Session.
<html> <head> <title>Checkout</title> </head> <body> <form action="/create-checkout-session" method="POST"> <button type="submit">Checkout</button> </form> </body> </html>
Create a Checkout Session in setup
mode to collect the required information. After creating the Checkout Session, redirect your customer to the URL returned in the response.