Plaid
Plaid Link is used to connect a supplier’s bank account for payouts and for underwriting evidence.
Module configuration
src/app/vendors/plaid/
export const plaidConfigFactory = (config: PlaidConfigData): PlaidLinkConfig => ({
...plaidDefaultConfig,
env: config.sandbox ? PlaidEnv.Sandbox : PlaidEnv.Production,
});
@NgModule()
export class PlaidModule {
static forRoot(config: PlaidConfigData): ModuleWithProviders<PlaidModule> {
return {
ngModule: PlaidModule,
providers: [
{ provide: PLAID_CONFIG_DATA, useValue: config },
{ provide: PLAID_CONFIG, useFactory: plaidConfigFactory, deps: [PLAID_CONFIG_DATA] },
],
};
}
}
Default configuration:
export const plaidDefaultConfig: PlaidLinkConfig = {
products: [PlaidProducts.Assets],
env: PlaidEnv.Sandbox,
countryCodes: [PlaidCountryCodes.Us],
};
|
|
|
|
|
|
AppModule wires it with PlaidModule.forRoot({ sandbox: environment.plaidSandbox }).
The OAuth redirect
Some institutions require a full-page OAuth redirect, so the Link session must be
resumed after the browser returns. AppModule handles this in its constructor,
before any route is activated:
private handlePlaid(): void {
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('oauth_state_id')) {
this.oauthTokenService.oauthToken = window.location.href; (1)
this.oauthTokenService.linkToken = localStorage.getItem('link_token');
localStorage.removeItem('link_token'); (2)
}
}
| 1 | The whole return URL becomes receivedRedirectUri for the resumed session. |
| 2 | link_token was stored before the redirect; it is read once and removed so a
stale token cannot resume a later session. |
OAuthTokenService holds both values for the component that reopens Link.
|
|
State
Slice |
|
Actions |
|
export const savePlaidTokenRefresh = createAction(
PlaidActionTypes.savePlaidTokenRefresh,
props<{ externalProductId: string }>(),
);
savePlaidTokenRefresh covers re-authentication: an existing Plaid item whose
credentials have expired must be re-linked against the same
externalProductId rather than creating a new connection.
The linked account’s masked number is surfaced on the user as
user.plaidAccountMask.
Entry points
Onboarding |
The |
Transfer Information |
Linking or relinking from |
Dashboard notifications |
|
Bank verification check |
|
Lost connection
modals/lost-bank-connection-modal/ prompts the supplier to re-link when the
connection drops, and BannerService shows a persistent banner alongside it.
Related components
|
Explains why bank verification is needed. |
|
Re-link prompt. |
|
Payout method management. |
|
Switch between checking and deposit accounts. |
|
Dashboard summary of the configured method. |