Class StripeConnectApiClient
The receiving side: an account the platform can pay, and the onboarding that makes it payable.
public class StripeConnectApiClient : IPayeeAccountClient
- Inheritance
-
StripeConnectApiClient
- Implements
- Inherited Members
Remarks
A marketplace pays people it has not vetted itself. The provider verifies the identity and bank details and decides whether the account may be paid out. The screens that ask are the provider's own — hosted, or embedded in the application — or the application's, which then sends the details as tokens the payee's browser obtained, so they never reach the platform either way.
Constructors
StripeConnectApiClient(IStripeClient, IOptions<StripeApiClientConfig>, ILogger<StripeConnectApiClient>)
The receiving side: an account the platform can pay, and the onboarding that makes it payable.
public StripeConnectApiClient(IStripeClient client, IOptions<StripeApiClientConfig> config, ILogger<StripeConnectApiClient> logger)
Parameters
clientIStripeClientconfigIOptions<StripeApiClientConfig>loggerILogger<StripeConnectApiClient>
Remarks
A marketplace pays people it has not vetted itself. The provider verifies the identity and bank details and decides whether the account may be paid out. The screens that ask are the provider's own — hosted, or embedded in the application — or the application's, which then sends the details as tokens the payee's browser obtained, so they never reach the platform either way.
Methods
CreateAccountAsync(PayeeAccountRequest, CancellationToken)
Creates an account able to receive transfers, prefilled with what the application knows about its owner, and returns the provider's identifier for it.
public Task<IResult<string>> CreateAccountAsync(PayeeAccountRequest request, CancellationToken cancellationToken = default)
Parameters
requestPayeeAccountRequestThe country, the address, and the optional prefill.
cancellationTokenCancellationTokenCancels the call.
Returns
CreateAccountAsync(string, string, IDictionary<string, string>?, CancellationToken)
Creates an account able to receive transfers, and returns the provider's identifier for it.
public Task<IResult<string>> CreateAccountAsync(string countryCode, string email, IDictionary<string, string>? metadata = null, CancellationToken cancellationToken = default)
Parameters
countryCodestringISO 3166-1 alpha-2, the country the payee is paid in.
emailstringWhere the provider writes to the payee.
metadataIDictionary<string, string>Carried on the provider's object; the caller's own identifiers belong here.
cancellationTokenCancellationTokenCancels the call.
Returns
CreateOnboardingLinkAsync(string, string, string, CancellationToken)
A link to the provider's hosted onboarding. Single-use and short-lived by design, so it is created when the payee asks rather than stored.
public Task<IResult<string>> CreateOnboardingLinkAsync(string accountId, string refreshUrl, string returnUrl, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe account being onboarded.
refreshUrlstringWhere the provider sends the payee when the link has expired.
returnUrlstringWhere it returns them when they are done.
cancellationTokenCancellationTokenCancels the call.
Returns
CreateOnboardingSessionAsync(string, CancellationToken)
A short-lived secret that lets the provider's embeddable onboarding run inside the application's own page, for this account only.
public Task<IResult<string>> CreateOnboardingSessionAsync(string accountId, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe account being onboarded.
cancellationTokenCancellationTokenCancels the call.
Returns
Remarks
The alternative to CreateOnboardingLinkAsync(string, string, string, CancellationToken): the payee never leaves the application. The secret is handed to the browser and used at once, never stored.
DeleteAccountAsync(string, CancellationToken)
Closes the account at the provider, for a payee who no longer wants to be paid there. The provider refuses while the account still holds a balance, and keeps what the law requires it to.
public Task<IResult> DeleteAccountAsync(string accountId, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe account to close.
cancellationTokenCancellationTokenCancels the call.
Returns
GetAccountAsync(string, CancellationToken)
What the provider currently says about the account.
public Task<IResult<PayeeAccountDTO>> GetAccountAsync(string accountId, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe account to read.
cancellationTokenCancellationTokenCancels the call.
Returns
GetPersonsAsync(string, CancellationToken)
The people registered on a company account.
public Task<IResult<IReadOnlyList<PayeePersonDTO>>> GetPersonsAsync(string accountId, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe company's account.
cancellationTokenCancellationTokenCancels the call.
Returns
RemovePersonAsync(string, string, CancellationToken)
Removes a person registered on a company account by mistake.
public Task<IResult> RemovePersonAsync(string accountId, string personId, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe company's account.
personIdstringThe person to remove.
cancellationTokenCancellationTokenCancels the call.
Returns
SavePersonAsync(string, string, string?, bool?, CancellationToken)
Registers a person on a company account, or changes one already there, from a provider person token the payee's browser obtained. Answers the person's identifier.
public Task<IResult<string>> SavePersonAsync(string accountId, string personToken, string? personId = null, bool? politicallyExposed = null, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe company's account.
personTokenstringThe person's details, as a provider person token.
personIdstringThe person to change; null registers a new one.
politicallyExposedbool?Whether the person holds, or held, a senior public office, or is close to someone who does; null leaves it as it is. A provider whose browser library drops this answer from the token receives it here and records it right after the token.
cancellationTokenCancellationTokenCancels the call.
Returns
UpdateAccountAsync(string, PayeeAccountUpdateRequest, CancellationToken)
Changes the account: its legal entity, terms acceptance and bank account as tokens the payee's browser obtained from the provider, and what it does. Answers the account as it then stands.
public Task<IResult<PayeeAccountDTO>> UpdateAccountAsync(string accountId, PayeeAccountUpdateRequest request, CancellationToken cancellationToken = default)
Parameters
accountIdstringThe account to change.
requestPayeeAccountUpdateRequestThe tokens and the business profile; anything left out stays as it was.
cancellationTokenCancellationTokenCancels the call.