Contents

addBankAccount#

Add a bank account to the wallet’s list of known bank accounts.

Request:

The request must be an AddBankAccountRequest object.

Response:

On success, the result is an AddBankAccountResponse object.

Side effects:

Adds the bank account to the wallet’s database, or updates the existing account with the same paytoUri. A bank-account-change notification is emitted.

Expected errors:

The caller can handle the following errors inline: GENERIC_PAYTO_URI_MALFORMED, WALLET_BANK_ACCOUNT_NOT_FOUND.

Details:

If an account with the same paytoUri is already known, it is updated (the supported currencies are merged) and its identifier is returned. When replaceBankAccountId is specified, the account with that identifier is replaced and keeps its identifier; the request fails with WALLET_BANK_ACCOUNT_NOT_FOUND when no such account exists.

In all cases the stored account is rewritten with the values from the request, so updating or replacing an account resets its kycCompleted flag to false.

interface AddBankAccountRequest {
  // Payto URI of the bank account that should be added.
  paytoUri: string;

  // Human-readable label for the account.
  label: string;

  // Currencies supported by the bank (if known).
  currencies?: string[] | undefined;

  // Bank account that this new account should replace.
  replaceBankAccountId?: string;
}
interface AddBankAccountResponse {
  // Identifier of the added bank account.
  bankAccountId: string;
}