Skip to main content

Store Account Configuration

Source: internal/api/v1/store/Controllers/account.js

Overview

The Account controller manages Stripe connected account operations including account retrieval, onboarding links, and external account (bank account) management for payouts.

Key Capabilities

  • Retrieve connected account details
  • Generate onboarding/dashboard links
  • Add/update/delete external accounts (bank accounts)
  • Manage payout destinations

Service Methods

getAccount

Retrieves Stripe connected account details.

Endpoint: GET /store/account/:account_id

Authorization: account_id must match authenticated account

Response: Stripe account object (without dashboard settings)

Business Logic:

const account = await stripe.accounts.retrieve(stripe_connected_account);
delete account.settings.dashboard; // Remove sensitive settings

Generates Stripe account onboarding/dashboard link.

Endpoint: GET /store/account/:account_id/link

Query Parameters:

{
return_uri: string; // Optional: path to return to after onboarding
}

Response:

{
success: true,
data: {
url: string,
expires_at: number
}
}

Link Generation:

const accountLink = await stripe.accountLinks.create({
account: stripe_connected_account,
refresh_url: `${domain}/refresh_stripe_link`,
return_url: `${domain}/${return_uri || ''}`,
type: 'account_onboarding',
});

Domain Resolution:

const prepURL = req => {
let url = 'https://';
if (req.auth.account?.domain?.custom) {
url += req.auth.account.domain.custom;
} else if (req.auth.default_config.domain.custom) {
url += req.auth.default_config.domain.custom;
} else {
url += req.auth.default_config.domain.dashclicks;
}
return url;
};

addExternalAccount

Adds a bank account for payouts to the connected account.

Endpoint: POST /store/account/:account_id/external-accounts

Request Body:

{
external_account: string; // Bank account token from Stripe.js
}

Response: Updated Stripe account object


updateExternalAccount

Updates an existing external account (e.g., set as default).

Endpoint: PATCH /store/account/:account_id/external-accounts/:id

Request Body: Stripe-supported update fields

Response: Updated bank account object


deleteExternalAccount

Removes an external account from the connected account.

Endpoint: DELETE /store/account/:account_id/external-accounts/:id

Response: Success message


makeToken

Helper method to create bank account test tokens (development only).

Response: Stripe bank account token


Edge Cases

  • All methods require stripe_connected_account to be configured
  • Account ID must match authenticated account (no cross-account access)
  • Domain resolution checks custom domains before DashClicks subdomain
  • Dashboard settings removed from account retrieval for security

💬

Documentation Assistant

Ask me anything about the docs

Hi! I'm your documentation assistant. Ask me anything about the docs!

I can help you with:
- Code examples
- Configuration details
- Troubleshooting
- Best practices

Try asking: How do I configure the API?
09:31 AM