Testing financial account integration
Learn how to ensure your financial accounts are functioning correctly.
Stripe Treasury includes a live mode and test mode. You can toggle between modes from your Dashboard using the mode toggle in the upper-right corner.
Test mode toggle
Note
You must complete the Gaining API access to Treasury guide’s live mode steps before you have access to live mode financial accounts.
To access test mode in the API, use the test mode API key with your requests. The test mode API key is included within most documentation code examples, but you can also find it in the Developers page of your Dashboard. Make sure to use the test key for testing and not the live one. The test key has the form sk_
, whereas the live key is in the form sk_
.
Before creating a test financial account, create a test connected account using POST /v1/accounts
. Use the connected account ID you receive from the response to assign the financial account you create in the next step to this account. Treasury is supported only in the US, so assign US
to the country
parameter. You’re also requesting capabilities for the connected account that Treasury requires to function properly. Make note of the id
value in the response. As mentioned, you use the ID as the value for the Stripe-Account
header in the following code example.
If successful, the response returns the new connected account Account object.
{ "id": "{{CUSTOM_ACCOUNT_ID}}", "livemode": false, ... }
Next, create a financial account using POST /v1/treasury/financial_
. Include a Stripe-Account
header set to the value of the connected account ID you created in the previous instruction. The only required value in the body is to set supported_
to usd
. To learn more about financial accounts, see Working with financial accounts or the FinancialAccounts object description in the Stripe API reference.
If successful, the response returns the newly created FinancialAccount
object.
{ "id": "{{FINANCIAL_ACCOUNT_ID}}", "livemode": false, "active_features": [], "pending_features": [], "restricted_features": ["financial_addresses.aba"], ... }
You now have a test mode financial account attached to a test mode connected account. However, the connected account hasn’t been onboarded so required information is missing from the requirements
hash. If you call GET /v1/treasury/financial_
using the financial account ID in the JSON response of the previous instruction, you see the financial_
array of hashes has an entry for the requested aba
with a status
of restricted
because the connected account has requirements_
.
{ … "financial_addresses": { "aba": { "requested": true, "status": "restricted", "status_details": [ { "code": "requirements_past_due", "resolution": "provide_information" } ] } } … }
To enable requested features on your test mode financial account without first going through connected account onboarding, you must use POST /v1/accounts/{{CONNECTED_
to provide test values that fulfil all the requirements, as in the following request that uses a previously created connected account to apply the required account details.
Note
You can’t create a test mode financial account attached to a live mode connected account.