Skip to content
Sign in
An image of the Stripe logo
/
Create account
Sign in
Home
Payments
Finance automation
Banking as a service
Developer tools
No-code
All products
Home
Payments
Finance automation
Home
Payments
Finance automation
Banking as a service
Developer tools
Overview
Start an integration
Products
Issuing cards
Treasury
    Overview of Stripe Treasury
    Treasury requirements
    Treasury and Issuing product marketing, design, and compliance guidelines
    Get started with API access
    Guides and samples
    Using Treasury to set up financial accounts and cards
    Using Treasury to move money
    Issuing and Treasury sample application
    Treasury platform end user onboarding guide
    Treasury fraud guide
    Webhooks for Stripe Issuing and Stripe Treasury
    Account management
    Stripe Treasury accounts structure
    Working with connected accounts
    Working with financial accounts
    Financial account features
    Platform financial accounts
    Working with Stripe Issuing cards
    Working with balances and transactions
    Moving money
    Payouts and top-ups from Stripe Payments
    Working with SetupIntents, PaymentMethods, and BankAccounts
    Moving money into financial accounts
    Moving money out of financial accounts
    Money movement timelines
Business financing
Treasury
·
HomeBanking as a serviceTreasury

Using Treasury to set up financial accounts and cards

Follow a sample Treasury integration that sets up a financial account and creates cards.

Homebox is a fictitious vertical SaaS that builds software for home-services companies like HVAC technicians, cleaners, and plumbers. Homebox begins its Treasury integration by setting up a Treasury financial account and creating payment cards. To see how Homebox moves money to and from external bank accounts, see the Using Treasury to move money example integration.

Platform onboarding

Homebox is already a Stripe platform with Payments and Connect enabled. Homebox uses Custom connected accounts, and those connected accounts already have the card_payments capability enabled.

Adding capabilities

To use Treasury and Issuing services, Homebox needs to request the additional treasury and card_issuing capabilities for the platform’s users. The connected accounts must then onboard before Stripe can create a Treasury financial account for the user.

To use ACH transfers with Treasury, Homebox also needs to request the us_bank_account_ach_payments capability.

To request the treasury, card_issuing, and us_bank_account_ach_payments capabilities, Homebox makes a request to the Accounts API.

Command Line
curl https://api.stripe.com/v1/accounts/{{CONNECTED_ACCOUNT_ID}} \ -u "
sk_test_4eC39HqLyjWDarjtT1zdp7dc
:"
\ -d "capabilities[treasury][requested]"=true \ -d "capabilities[card_issuing][requested]"=true \ -d "capabilities[us_bank_account_ach_payments][requested]"=true

To use Hosted Onboarding, Homebox makes a call to Account Links to retrieve a URL their customer can use to submit onboarding information for the Treasury financial account.

Command Line
curl https://api.stripe.com/v1/account_links \ -u "
sk_test_4eC39HqLyjWDarjtT1zdp7dc
:"
\ -d account=
{{CONNECTED_ACCOUNT_ID}}
\ --data-urlencode refresh_url="https://example.com/reauth" \ --data-urlencode return_url="https://example.com/return" \ -d type=account_onboarding

The response includes a URL the customer uses to access the application, which must be done before the link expires.

{ "object": "account_link", "created": 1612927106, "expires_at": 1612927406, "url": "https://connect.stripe.com/setup/s/iCtLfmYb2tEU" }

Homebox listens for the account.updated webhook to confirm the following fields and capabilities on the connected account:

{ "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. }, ... } }

Creating a FinancialAccount

After Stripe adds the treasury capability to an account, Homebox can create the FinancialAccount object for the account. To do so, Homebox calls FinancialAccounts and requests the Features the company wants to provide.

Command Line
curl https://api.stripe.com/v1/treasury/financial_accounts \ -u "
sk_test_4eC39HqLyjWDarjtT1zdp7dc
:"
\ -H "Stripe-Account:
{{CONNECTED_ACCOUNT_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

The response confirms the account is processing. After complete and all relevant features are active, Homebox gets a confirmation from their treasury.financial_account.features_status_updated webhook listener.

{ "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" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, "financial_addresses": { "aba": { "requested": true, "status": "pending", // Becomes "active" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, }, "outbound_payments": { "ach": { "requested": true, "status": "pending", // Becomes "active" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, }, "us_domestic_wire": { "requested": true, "status": "pending", // Becomes "active" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, "inbound_transfers": { "ach": { "requested": true, "status": "pending", // Becomes "active" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, }, "outbound_transfers": { "ach": { "requested": true, "status": "pending", // Becomes "active" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, }, "outbound_payments": { "ach": { "requested": true, "status": "pending", // Becomes "active" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, }, "outbound_transfers": { "us_domestic_wire": { "requested": true, "status": "pending", // Becomes "active" once the Treasury financial account is set up "status_details": [{"code": "activating", "resolution": nil}], }, }, "platform_restrictions": { "inbound_flows": "unrestricted", "outbound_flows": "unrestricted" }, "metadata": {}, ... }

Creating a payment cardholder

Before Homebox can create cards for Treasury financial accounts, it needs to create cardholders. The cardholders in this example are plumbers who utilize Homebox services and own the connected accounts on the platform.

Command Line
curl https://api.stripe.com/v1/issuing/cardholders \ -u "
sk_test_4eC39HqLyjWDarjtT1zdp7dc
:"
\ -H "Stripe-Account:
{{CONNECTED_ACCOUNT_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

The response confirms the cardholder is created.

{ "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" }

Creating payment cards

Now that the connected account has a FinancialAccount object associated with it and an available cardholder, Homebox can create a payment card using the FinancialAccount balance as the card’s available balance.

Command Line
curl https://api.stripe.com/v1/issuing/cards \ -u "
sk_test_4eC39HqLyjWDarjtT1zdp7dc
:"
\ -H "Stripe-Account:
{{CONNECTED_ACCOUNT_ID}}
"
\ -d currency=usd \ -d type=virtual \ -d cardholder=
{{CARDHOLDER_ID}}
\ -d financial_account=
{{FINANCIAL_ACCOUNT_ID}}

The response confirms the card is issued.

{ "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

  • Using Treasury to move money
  • API reference
Was this page helpful?
Need help? Contact Support.
Watch our developer tutorials.
Check out our product changelog.
Questions? Contact Sales.
Powered by Markdoc
You can unsubscribe at any time. Read our privacy policy.
On this page
Platform onboarding
Adding capabilities
Creating a FinancialAccount
Creating a payment cardholder
Creating payment cards
See also
Products Used
Treasury
Stripe Shell
Test mode
Welcome to the Stripe Shell! Stripe Shell is a browser-based shell with the Stripe CLI pre-installed. Log in to your Stripe account and press Control + Backtick (`) on your keyboard to start managing your Stripe resources in test mode. - View supported Stripe commands: - Find webhook events: - Listen for webhook events: - Call Stripe APIs: stripe [api resource] [operation] (e.g., )
The Stripe Shell is best experienced on desktop.
$