@bates-solutions/stripe API Reference - v2.2.1
    Preparing search index...

    Class StripeClient

    Main Stripe client wrapper.

    const stripe = createStripeClient({
    apiKey: process.env.STRIPE_SECRET_KEY!,
    });

    // Create a payment
    const payment = await stripe.payments.create({
    amount: 1000, // $10.00
    currency: 'usd',
    paymentMethod: 'pm_card_visa',
    confirm: true,
    });
    Index
    billingPortal: BillingPortalService
    checkout: CheckoutService
    customers: CustomersService
    invoices: InvoicesService
    paymentLinks: PaymentLinksService
    paymentMethods: PaymentMethodsService
    payments: PaymentsService
    products: ProductsService
    setupIntents: SetupIntentsService
    subscriptions: SubscriptionsService
    • get accountId(): string | undefined

      The connected account this client acts as, or undefined for the platform account.

      Returns string | undefined

    • get sdk(): Stripe

      Get the underlying Stripe SDK client. Use this for advanced operations not covered by the wrapper.

      Returns Stripe

    • Return a client that acts as a connected account. Every call it makes sends Stripe-Account: <accountId>, so all services work unchanged on that account. The original client is not modified.

      Parameters

      • accountId: string

        Connected account ID (acct_…), e.g. the stripeUserId from oauth.exchangeCode

      Returns StripeClient

      When accountId is not an acct_… ID

      const retailer = stripe.forAccount('acct_123');
      const { data: products } = await retailer.products.list({ active: true });