BlueForge Docs

client.wallet.createRefillSession

Create a Stripe refill checkout session

Signature

class Client {
  wallet: {
    createRefillSession(workspaceId: string, input: CreateRefillInput): Promise<RefillSession>
  }
}

Parameters

NameTypeRequiredNotes
workspaceId
string
YesWorkspace ID
input
CreateRefillInput
YesRefill parameters (amountCents, successUrl, cancelUrl)

Throws

  • NotFoundError
    — workspace not found
  • AuthError
    — insufficient permissions

Examples

import { Client } from '@blueforge/client'

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

const { sessionUrl, sessionId } = await bf.wallet.createRefillSession('ws_abc', {
  amountCents: 2000,
  successUrl: 'https://app.com/wallet',
  cancelUrl: 'https://app.com/wallet',
})

Pitfalls

  • Redirect-based — the user must be redirected to the returned Stripe Checkout URL

See also

  • client.wallet.getAutoRefill
  • client.wallet.configureAutoRefill

Tested against

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