住所と電話番号を収集する
1 回限りの決済フロー内で住所と電話番号を収集する方法をご紹介します。
請求先または配送先の詳細な住所を収集するには、Address Element を使用します。詳細な住所の収集は、税金の計算に使用される場合などに必要になります。Payment Element は、支払いを完了するために必要な請求先住所情報のみを収集しますが、他の請求詳細を収集するように設定することもできます。
Address Element を使用するその他の理由は次のとおりです。
Stripe は、収集した住所情報と決済手段を組み合わせて、PaymentIntent を作成します。
Address Element を作成する
Address Element の作成時に、shipping
または billing
のいずれかのモードを指定します。Address Element のモードにより、PaymentIntent の確定に配送先住所と請求先住所のいずれを渡すかが決まります。
Address Element を作成する際は、それを配送モードと請求モードのどちらで使用するかを指定します。
その他のエレメントとともに住所 Element を使用する
You can collect both shipping and billing addresses by using multiple Address Elements, one of each mode, on your page.
If you need to collect both shipping and billing addresses and only want to use one Address Element, use the Address Element in Shipping mode and use the Payment Element to collect only the necessary billing address details.
住所 Element を他の Element とともに使用すると、PaymentIntent または SetupIntent の確定時に一部の動作を自動で実行できます。PaymentIntent または SetupIntent の確定時に住所 Element の完全性が検証され、検証エラーが発生した場合はフィールドごとにエラーが表示されます。