I am trying to verify that a user on my website has completed the onboarding process with Stripe through their API. I don't see any fields in the Accounts object (https://stripe.com/docs/api/accounts) that tells me if their account is Complete. If it's not complete, they shouldn't be allowed to do certain things on my website.
Using PHP. Stripe connected accounts are "Standard" accounts. (not express or custom)
In my Stripe dashboard, I see the statuses of "complete", "pending", "restricted", etc. I'm trying to find that field through the API.
img of stripe dashboard
My Answer:
Unfortunately, the Stripe API does not provide a direct field that indicates whether a connected account is complete or not. However, you can infer the completion status by checking the verification status of the account.
You can use the List all accounts API endpoint (https://stripe.com/docs/api/accounts/list) to retrieve a list of connected accounts and their verification status. The verification status will indicate whether the account is complete, pending, or restricted.
Here is an example code snippet in PHP to retrieve the verification status of a connected account:
php
require_once('vendor/autoload.php');
\Stripe\Stripe::setApiKey('sk_test_1234567890');
$accounts = \Stripe\Account::all();
foreach ($accounts->data as $account) {
echo 'Account ID: ' . $account->id . '
';
echo 'Verification Status: ' . $account->verification->status . '
';
echo '
';
}
In the above code snippet, we are using the List all accounts API endpoint to retrieve a list of connected accounts. We then loop through each account and output the account ID and verification status.
You can use the verification status to determine if the account is complete or not. If the verification status is 'verified', then the account is complete. If the verification status is 'pending' or 'unverified', then the account is not complete.
You can then use this information to restrict certain actions on your website for users whose connected accounts are not complete.
Rate this post
3 of 5 based on 8560 votesComments