BlueForge Docs

client.wallet.configureAutoRefill

Create or update auto-refill configuration

Signature

class Client {
  wallet: {
    configureAutoRefill(workspaceId: string, input: ConfigureAutoRefillInput): Promise<{ config: AutoRefillConfig }>
  }
}

Parameters

NameTypeRequiredNotes
workspaceId
string
YesWorkspace ID
input
ConfigureAutoRefillInput
YesAuto-refill config (triggerBalanceCents, refillAmountCents, paymentMethodId?)

Throws

  • NotFoundError
    — workspace not found
  • ValidationError
    — invalid config

Examples

import { Client } from '@blueforge/client'

const bf = new Client({ apiKey: process.env.BF_API_KEY!, url: 'https://your-project.blueforge.dev' })

const { config } = await bf.wallet.configureAutoRefill('ws_abc', {
  triggerBalanceCents: 500,
  refillAmountCents: 2000,
})

Pitfalls

  • Requires a saved payment method — run
    createRefillSession
    first to collect one

See also

  • client.wallet.getAutoRefill
  • client.wallet.createRefillSession

Tested against

  • Unit:
    packages/client/src/__tests__/wallet.test.ts