1.10. Taler Bank Access API

This chapter describes the API that the GNU Taler demonstrator bank offers to access accounts.

This API differs from the “Bank Integration API” in that it provides advanced API access to accounts, as opposed to enabling wallets to withdraw with a better user experience (“tight integration”).

1.10.1. Accounts and Withdrawals

The following endpoints require HTTP “Basic” authentication with the account name and account password, at least in the GNU Taler demo bank implementation.

GET ${BANK_API_BASE_URL}/accounts/${account_name}

Request the current balance of an account. (New: ) In case of a public bank account, no authentication is required.

Response

Details

interface BankAccountBalanceResponse {
  // Available balance on the account.
  balance: {
    amount: Amount;
    credit_debit_indicator: "credit" | "debit";
  };
  // payto://-URI of the account. (New)
  paytoUri: string;
}
POST ${BANK_API_BASE_URL}/accounts/${account_name}/withdrawals

Create a withdrawal operation, resulting in a taler://withdraw URI.

Request

interface BankAccountCreateWithdrawalRequest {
  // Amount to withdraw.
  amount: Amount;
}

Response

interface BankAccountCreateWithdrawalResponse {
  // ID of the withdrawal, can be used to view/modify the withdrawal operation.
  withdrawal_id: string;

  // URI that can be passed to the wallet to initiate the withdrawal.
  taler_withdraw_uri: string;
}
GET ${BANK_API_BASE_URL}/accounts/${account_name}/withdrawals/${withdrawal_id}

Query the status of a withdrawal operation.

Response

Details

interface BankAccountGetWithdrawalResponse {
  // Amount that will be withdrawn with this withdrawal operation.
  amount: Amount;

  // Was the withdrawal aborted?
  aborted: boolean;

  // Has the withdrawal been confirmed by the bank?
  // The wire transfer for a withdrawal is only executed once
  // both confirmation_done is true and selection_done is true.
  confirmation_done: boolean;

  // Did the wallet select reserve details?
  selection_done: boolean;

  // Reserve public key selected by the exchange,
  // only non-null if selection_done is true.
  selected_reserve_pub: string | null;

  // Exchange account selected by the wallet, or by the bank
  // (with the default exchange) in case the wallet did not provide one
  // through the Integration API.
  selected_exchange_account: string | null;
}
POST ${BANK_API_BASE_URL}/accounts/${account_name}/withdrawals/${withdrawal_id}/abort

Abort a withdrawal operation. Has no effect on an already aborted withdrawal operation.

200 OK: The withdrawal operation has been aborted. The response is an empty JSON object. 409 Conflict: The reserve operation has been confirmed previously and can’t be aborted.

POST ${BANK_API_BASE_URL}/accounts/${account_name}/withdrawals/${withdrawal_id}/confirm

Confirm a withdrawal operation. Has no effect on an already confirmed withdrawal operation. This call is responsible of wiring the funds to the exchange.

Response

200 OK:
The withdrawal operation has been confirmed. The response is an empty JSON object.
409 Conflict:
The withdrawal has been aborted previously and can’t be confirmed.
422 Unprocessable Entity (New):
The withdraw operation cannot be confirmed because no exchange and reserve public key selection happened before.

1.10.2. Transactions

GET ${BANK_API_BASE_URL}/accounts/${account_name}/transactions

Retrieve all the fresh transactions where the bank account with the label account_name was debited or credited. A transactions is ‘fresh’ if it was never included in a “history” type response.

Request

FIXME: this needs query parameters to filter the results.

Response

interface BankAccountTransactionsResponse {
  transactions: BankAccountTransactionInfo[];
}
GET ${BANK_API_BASE_URL}/accounts/${account_name}/transactions/${transaction_id}

Response

Retrieve the transaction whose identifier is transaction_id, in the following format:

interface BankAccountTransactionInfo {

  creditorIban: string;
  creditorBic: string;
  creditorName: string;

  // Temporary.  Payto address to let the wallet tests that
  // use x-taler-bank still function.  This information
  // should flow through the TWG in the exchange's incoming
  // history.
  creditorXTalerBank: string;

  debtorIban: string;
  debtorBic: string;
  debtorName: string;

  // Same as creditor's.
  debtorXTalerBank: string;

  amount: number;
  currency: string;
  subject: string;

  date: string; // YYYY-MM-DD
  uid: string; // transaction (unique) ID
  direction: "DBIT" | "CRDT";
}
POST ${BANK_API_BASE_URL}/accounts/${account_name}/transactions

Create a new transaction where the bank account with the label account_name is debited.

Request

interface CreateBankAccountTransactionCreate {
  // Note: the authority value ('iban' or 'x-taler-bank')
  // depends on the particular service that offers the Access API.
  // euFin offers only 'iban' and the PyBank only 'x-taler-bank'.
  paytoUri: string;

  amount: string; // with currency
  subject: string;
}

Response

200 OK:
the transaction has been created.
400 Bad Request:
the request was invalid or the payto://-URI used unacceptable features.

1.10.3. Registration (Testing)

POST ${BANK_API_BASE_URL}/testing/register

Create a new bank account. This endpoint should be disabled for most deployments, but is useful for automated testing / integration tests.

Request

interface BankRegistrationRequest {
  username: string;

  password: string;
}

Response

200 OK: Registration was successful.