# プラットフォーム向け金融口座と Issuing を使用して金融口座とカードを設定します 金融口座を設定し、カードを発行するプラットフォーム向け金融口座と Issuing の導入サンプルに従ってください。 Homebox は、HVAC 技術者、清掃業者、配管工などのホームサービス会社向けのソフトウェアを構築する架空の垂直型 SaaS です。Homebox は、金融口座を設定し、決済カードを作成することで、プラットフォーム向け金融口座の導入を開始します。Homebox が外部の銀行口座とどのように資金をやり取りするかは、[Using Financial Accounts for platforms to move money](https://docs.stripe.com/financial-accounts/connect/examples/moving-money.md) 統合例をご覧ください。 ## プラットフォームのアカウント登録 Homebox は、すでに [Payments](https://docs.stripe.com/payments.md) および [Connect](https://docs.stripe.com/connect.md) を利用している Stripe プラットフォームです。[Custom 連結アカウント](https://docs.stripe.com/connect/accounts.md)を使用しており、これらの連結アカウントではすでに `card_payments` ケイパビリティが有効になっています。 ## ケイパビリティを追加 > #### Accounts v2 API 互換性 > > Accounts v2 API は Financial Accounts ワークフローをサポートしていません。Accounts v2 で作成されたアカウントがある場合は、Accounts v1 を使用して `treasury` と `card_issuing` の機能を管理できます。詳細については、[顧客として Account を使用する](https://docs.stripe.com/connect/use-accounts-as-customers.md)を参照してください。 プラットフォーム向け金融口座と Issuing サービスを使用するには、Homebox はプラットフォームの連結アカウントに追加の `treasury` および `card_issuing` ケイパビリティをリクエストする必要があります。各連結アカウントは、Stripe が金融口座を作成する前にユーザー登録する必要があります。 プラットフォーム向け金融口座で ACH 送金を使用するには、Homebox も `us_bank_account_ach_payments` ケイパビリティをリクエストする必要があります。 `treasury`、`card_issuing`、`us_bank_account_ach_payments` の各ケイパビリティをリクエストするために、Homebox は [Accounts API](https://docs.stripe.com/api/accounts.md) に対してリクエストを行います。 ```curl curl https://api.stripe.com/v1/accounts/{{CONNECTED_ACCOUNT_ID}} \ -u "<>:" \ -d "capabilities[treasury][requested]=true" \ -d "capabilities[card_issuing][requested]=true" \ -d "capabilities[us_bank_account_ach_payments][requested]=true" ``` Hosted Onboarding を使用するために、Homebox は [Account Links](https://docs.stripe.com/api/account_links.md) を呼び出し、連結アカウントが金融口座のユーザー登録情報を送信するために使用できる URL を取得します。 ```curl curl https://api.stripe.com/v1/account_links \ -u "<>:" \ -d "account={{CONNECTEDACCOUNT_ID}}" \ --data-urlencode "refresh_url=https://example.com/reauth" \ --data-urlencode "return_url=https://example.com/return" \ -d type=account_onboarding ``` レスポンスに、連結アカウントがアプリケーションへのアクセスに使用する URL が示されます。アプリケーションには、リンクの期限が切れる前にアクセスする必要があります。 ```json { "object": "account_link", "created": 1612927106, "expires_at": 1612927406,"url": "https://connect.stripe.com/setup/s/iCtLfmYb2tEU" } ``` Homebox は、`account.updated` Webhook をリッスンして、連結アカウントで以下のフィールドとケイパビリティを確認します。 ```json { "object": { "id": "{{CONNECTED_ACCOUNT_ID}}", "object": "account", "capabilities": { "card_payments": "active", "treasury": "active", "card_issuing": "active", // Only appears if requesting the `card_issuing` capability. "us_bank_account_ach_payments": "active", // Only appears if requesting the `us_bank_account_ach_payments` capability. }, ... } } ``` ## FinancialAccount の作成 Stripe が `treasury` 機能をアカウントに追加すると、Homebox がアカウントの `FinancialAccount` オブジェクトを作成できるようになります。そのためには、Homebox が [Financial Accounts API](https://docs.stripe.com/api/treasury/financial_accounts.md) を呼び出し、企業が提供する予定の `Features` をリクエストします。 ```curl curl https://api.stripe.com/v1/treasury/financial_accounts \ -u "<>:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d "supported_currencies[]=usd" \ -d "features[card_issuing][requested]=true" \ -d "features[deposit_insurance][requested]=true" \ -d "features[financial_addresses][aba][requested]=true" \ -d "features[inbound_transfers][ach][requested]=true" \ -d "features[intra_stripe_flows][requested]=true" \ -d "features[outbound_payments][ach][requested]=true" \ -d "features[outbound_payments][us_domestic_wire][requested]=true" \ -d "features[outbound_transfers][ach][requested]=true" \ -d "features[outbound_transfers][us_domestic_wire][requested]=true" ``` レスポンスに、アカウントが処理中であることが示されます。処理が完了して、すべての関連機能が有効になると、Homebox は、`treasury.financial_account.features_status_updated` Webhook リスナーから確認を受信します。 ```json { "object": "treasury.financial_account", "created": 1612927106, "id": "{{FINANCIAL_ACCOUNT_ID}}", "country": "US", "supported_currencies": ["usd"], "financial_addresses": [ // This field is empty until the "financial_addresses.aba" feature becomes active { "type": "aba", "supported_networks": ["ach", "us_domestic_wire"], "aba": { "account_number_last4": "7890", // Use the expand[] parameter to view the `account_number` field hidden by default "account_number": "1234567890", "routing_number": "000000001", "bank_name": "Bank of Earth" } } ], "livemode": true, // State machine: // open - the account is ready to be used // closed - the account is closed "status": "open", "status_details": { // `closed` is null if financial account is not closed "closed": { // List of one or more reasons why the FinancialAccount was closed: // - account_rejected // - closed_by_platform // - other "reasons": [] } }, "active_features": ["card_issuing"], "pending_features": ["deposit_insurance", "financial_addresses.aba", "outbound_payments.ach", "us_domestic_wire", "inbound_transfers.ach", "outbound_transfers.ach", "outbound_transfers.us_domestic_wire"], "restricted_features": [], "features": { "object": "treasury.financial_account_features", "card_issuing": { "status": "active", "status_details": [], "access": "active" }, "deposit_insurance": { "requested": true, "status": "pending", // Becomes "active" after the financial account is set up "status_details": [{"code": "activating", "resolution": null}] }, "financial_addresses": { "aba": { "requested": true, "status": "pending", // Becomes "active" after the financial account is set up "status_details": [{"code": "activating", "resolution": null}] } }, "outbound_payments": { "ach": { "requested": true, "status": "pending", // Becomes "active" after the financial account is set up "status_details": [{"code": "activating", "resolution": null}] }, "us_domestic_wire": { "requested": true, "status": "pending", // Becomes "active" after the financial account is set up "status_details": [{"code": "activating", "resolution": null}] } }, "inbound_transfers": { "ach": { "requested": true, "status": "pending", // Becomes "active" after the financial account is set up "status_details": [{"code": "activating", "resolution": null}] } }, "outbound_transfers": { "ach": { "requested": true, "status": "pending", // Becomes "active" after the financial account is set up "status_details": [{"code": "activating", "resolution": null}] }, "us_domestic_wire": { "requested": true, "status": "pending", // Becomes "active" once the financial account is set up "status_details": [{"code": "activating", "resolution": null}] } } }, "platform_restrictions": { "inbound_flows": "unrestricted", "outbound_flows": "unrestricted" }, "metadata": {}, ... } ``` ## 支払いカード保有者の作成 Homebox が金融口座用のカードを作成する前に、カード会員を作成する必要があります。この例では、Homebox サービスを利用し、プラットフォーム上で連結アカウントを所有する配管工がカード会員となります。 # ダッシュボード > This is a ダッシュボード for when testing-method is without-code. View the full page at https://docs.stripe.com/financial-accounts/connect/examples/financial-accounts?testing-method=without-code. 1. ダッシュボードの[連結アカウント](https://dashboard.stripe.com/test/issuing/cards)ページにアクセスします。 1. カード保有者を作成する連結アカウントを選択して、その詳細を展開します。 1. **カード発行** タブを選択します。 1. **カード保有者** の横にある **+** ボタンをクリックします。 1. カード保有者の詳細を入力し、**カード保有者を作成** をクリックします。 # API > This is a API for when testing-method is with-code. View the full page at https://docs.stripe.com/financial-accounts/connect/examples/financial-accounts?testing-method=with-code. ```curl curl https://api.stripe.com/v1/issuing/cardholders \ -u "<>:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d "name=Jenny Bath Remodeling" \ -d type=company \ --data-urlencode "email=jenny@example.com" \ --data-urlencode "phone_number=+18008675309" \ -d status=active \ -d "billing[address][line1]=1234 Main Street" \ -d "billing[address][city]=San Francisco" \ -d "billing[address][state]=CA" \ -d "billing[address][postal_code]=94111" \ -d "billing[address][country]=US" ``` レスポンスでカード保有者が作成されたことを確認できます。 ```json { "id": "{{CARDHOLDER_ID}}", "object": "issuing.cardholder", "billing": { "address": { "city": "\"San Francisco\"", "country": "US", "line1": "\"1234 Main Street\"", "postal_code": "94111", "state": "CA" } }, "created": 1623803705, "email": "jenny@example.com", "livemode": false, "metadata": {}, "name": "Jenny Bath Remodeling", "phone_number": "+18008675309", "requirements": { "disabled_reason": "under_review", "past_due": [] }, "spending_controls": { "allowed_categories": [], "blocked_categories": [], "spending_limits": [] }, "status": "active", "type": "company" } ``` ## 支払いカードの作成 これで、連結アカウントに `FinancialAccount` オブジェクトが関連付けられ、カード保有者を使用できるようになったため、Homebox は、`FinancialAccount` の残高をカードの利用可能な残高として使用して支払いカードを作成できます。 # ダッシュボード > This is a ダッシュボード for when testing-method is without-code. View the full page at https://docs.stripe.com/financial-accounts/connect/examples/financial-accounts?testing-method=without-code. > [金融口座](https://docs.stripe.com/financial-accounts/connect/account-management/financial-accounts.md) はダッシュボードでは作成できません。API を使用して作成する必要があります。 1. ダッシュボードの[連結アカウント](https://dashboard.stripe.com/test/issuing/cards)ページにアクセスします。 1. カード保有者を作成する連結アカウントを選択して、その詳細を展開します。 1. **カード発行** タブを選択します。 1. **カード** の横にある **+** ボタンをクリックします。 1. カードの種類と、カードに資金を供給する金融口座を選択し、**作成** をクリックします。 # API > This is a API for when testing-method is with-code. View the full page at https://docs.stripe.com/financial-accounts/connect/examples/financial-accounts?testing-method=with-code. ```curl curl https://api.stripe.com/v1/issuing/cards \ -u "<>:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d currency=usd \ -d type=virtual \ -d "cardholder={{ISSUINGCARDHOLDER_ID}}" \ -d "financial_account={{TREASURYFINANCIALACCOUNT_ID}}" ``` レスポンスでカードが発行されたことを確認できます。 ```json { "id": "{{CARD_ID}}", "object": "issuing.card", "cardholder": { "id": "{{CARDHOLDER_ID}}", "object": "issuing.cardholder", "billing": { "address": { "city": "San Francisco", "country": "US", "line1": "123 Main Street", "line2": null, "postal_code": "94111", "state": "CA" } }, ... }, "created": 1643293629, "currency": "usd", "exp_month": 12, "exp_year": 2024, "last4": "0930", "livemode": false, ... } ``` ## See also - [資金移動のためのプラットフォーム向け金融口座の利用](https://docs.stripe.com/financial-accounts/connect/examples/moving-money.md) - [API リファレンス](https://docs.stripe.com/api/treasury/financial_accounts.md)