顧客としてアカウントを使用する
顧客として設定されたアカウントから決済を受け付けます。
Accounts v2 では、Account オブジェクトに customer 設定を割り当てることで、Customer オブジェクトと同様に Account オブジェクトを使用することができます。
Accounts v2 を有効にすると、Checkout などの Stripe がホストする連携機能が customer 設定を使用して Account を作成します。コード内の Customer 参照を更新して、顧客設定の Account を参照することをお勧めします。
| 目的 | v1 リファレンス | v2 リファレンス |
|---|---|---|
| 顧客リファレンス | customer | customer_ |
| 顧客 ID | cus_ | acct_ |
| 請求先住所の設定 | address |
|
| 配送先住所の設定 | shipping | configuration.customer.shipping |
顧客として Account を指定
Subscriptions や SetupIntents といった API リクエストでは、顧客を指定する必要があります。これらのリクエストは、customer または customer_ のパラメーターを受け入れます。以下のサンプルは、Accounts v2 オブジェクトを customer_ として渡すことで顧客を指定するサブスクリプションの例です。
Customers v1 の連携機能における参照アカウント
customer_ を指定するリクエストは customer と customer_ の両プロパティを、対応する形式の値で返します。これにより既存の Billing および Payments の連携機能との互換性が維持されます。
{ "id": "sub_1Mow234", . . . "customer": "cus_xxxxx", "customer_account": "acct_xxxxx" }
また、/v1/customers エンドポイントを使用して、顧客が設定した Account の取得または更新ができます。
Accounts v2 Webhook
Accounts v2 の Webhook はシンイベントを送信します。
| アクション | v1 イベント | v2 イベント |
|---|---|---|
| 顧客が作成されました | customer. | Accounts v2 は、アカウントの作成と顧客設定を示す個別のイベントを送信します。
|
| 請求書先住所が更新されました | customer. | v2. |
| サブスクリプションアクション | customer. | なし。v1 イベントを使用する |
| Customer deleted | customer. | v2. |
顧客請求書プロパティ
| データ値 | 顧客 v1 プロパティ | Accounts v2 プロパティ |
|---|---|---|
| 顧客保管クレジット | invoice_ | なし。/v1/customers パスで Accounts v2 ID を参照する方法を参照 |
| 顧客請求書プレフィックス | invoice_ | configuration.customer.billing.invoice.prefix |
| カスタム設定 | invoice_ | configuration.customer.billing.invoice.custom_fields |
| デフォルトの決済手段 | invoice_ | configuration.customer.billing.default_payment_method |
| 請求書のフッター | invoice_ | configuration.customer.billing.invoice.footer |
| 請求書レンダリングオプション | invoice_ | configuration.customer.billing.invoice.rendering.template |
v1/customers パスパラメーターで Accounts v2 ID を参照する
Accounts v2 には、すべての顧客機能にエンドポイントがあるわけではありません。Accounts v2 オブジェクトに対して次のアクションを実行するには、v1/customers エンドポイントを使用し、パスパラメーターとして Account ID (acct_) を渡します。
| ユースケース | アカウント ID を使用した v1 エンドポイント |
|---|---|
| 現金残高の管理 |
|
| 現金残高取引を管理する |
|
請求書のクレジット残高の管理 Accounts v2 の場合、アカウントの直近に確定された請求書の ending_balance は、v1 の顧客の |
|