Banking & Payments

API reference for bank account connections, PayPal, Plaid Open Banking, and account management.

List Connected Accounts#

const accounts = await $fetch('https://taxmtd.uk/api/banking/accounts')
// Returns: Array<{ id, provider, label, env, status, createdAt }>

Connect Bank Account (Plaid)#

const { link_token } = await $fetch('https://taxmtd.uk/api/banking/plaid/create-link-token', {
  method: 'POST'
})
// Use link_token with Plaid Link front-end

Step 2: Exchange Public Token#

After user completes Plaid Link:

await $fetch('https://taxmtd.uk/api/banking/plaid/exchange-token', {
  method: 'POST',
  body: {
    public_token: 'public-sandbox-xxxx',
    institution: { name: 'NatWest', institution_id: 'ins_xxx' },
    accounts: [{ id: 'acc_xxx', name: 'Current Account', mask: '1234' }]
  }
})

Step 3: List Plaid Accounts#

const plaidAccounts = await $fetch('https://taxmtd.uk/api/banking/plaid/accounts')

Connect PayPal#

API Credentials Method#

await $fetch('https://taxmtd.uk/api/banking/paypal/connect', {
  method: 'POST',
  body: {
    clientId: 'AcR4fbBm...',
    secret: 'ENv4NrHM...',
    env: 'live',      // 'sandbox' or 'live'
    label: 'PayPal Business'
  }
})

OAuth Method#

Redirect to PayPal for authorisation:

// Initiate OAuth
const { redirectUrl } = await $fetch('https://taxmtd.uk/api/banking/paypal/auth', {
  method: 'POST',
  body: { env: 'live', label: 'PayPal Main' }
})
// Redirect user to redirectUrl
navigateTo(redirectUrl, { external: true })

// Callback handled at /api/banking/paypal/callback

Import PayPal Transactions#

const result = await $fetch('https://taxmtd.uk/api/banking/paypal/import', {
  method: 'POST',
  body: {
    accountId: 1,
    periodId: 1,
    startDate: '2026-01-30',
    endDate: '2026-02-27'
  }
})
console.log(`Imported ${result.imported} transactions`)

Disconnect Account#

await $fetch('https://taxmtd.uk/api/banking/accounts', {
  method: 'DELETE',
  body: { id: 1 }
})

Disconnecting removes all stored tokens and credentials. Transaction history is preserved.

Was this page helpful? Share it.