Skip to main content

Documentation Index

Fetch the complete documentation index at: https://stackauth-e0affa27-chore-move-mcp-to-a-sep-app.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The Customer interface provides payment and item management functionality that is shared between users and teams. Both CurrentUser and Team types extend this interface, allowing them to create checkout URLs and manage items. This interface is automatically available on:

Table of Contents

Properties

Methods


Related Types

These types are returned by the methods above. You’ll encounter them when working with billing, products, and invoices.

CustomerBilling

Returned by getBilling() / useBilling().

CustomerProduct

Returned by listProducts() / useProducts(). The return value is an array of CustomerProduct with a nextCursor: string | null property for pagination.

CustomerInvoice

Returned by listInvoices() / useInvoices(). The return value is an array of CustomerInvoice with a nextCursor: string | null property for pagination.

Payment Workflow

1

Create checkout URL

Call createCheckoutUrl() with the desired product ID.
2

Redirect to Stripe

Direct the user to the returned URL.
3

User completes payment

Stripe handles the payment process on their hosted page.
4

Webhook processing

Stack Auth receives webhook notifications from Stripe.
5

Item allocation

Purchased items are automatically added to the customer’s account.
6

User returns

The user is redirected back to your application.

Usage Notes

  • Purchases: When a user completes a purchase, associated items are automatically added
  • Subscriptions: Recurring subscriptions automatically replenish items at the specified intervals
  • Manual allocation: Server-side code can manually adjust item quantities using ServerItem methods
  • Race conditions: Use tryDecreaseQuantity() for atomic, race-condition-free item consumption