AM
EN
Get Started Free
Menu
Features

Subscriptions

Stripe subscription integration with checkout, portal, sync, and webhook handling.

subscriptionsstripepayments

Subscriptions

AM manages the Stripe subscription lifecycle for accounts so you can focus on pricing and access control instead of webhook handling.

Create checkout sessions, let customers manage their plans, and keep account access in sync with Stripe.

Subscription Flow

StripeAMUserStripeAMUserStart checkoutCreate checkout sessionRedirect to StripeComplete paymentWebhook: checkout.session.completedSync subscription + features

Endpoints

Endpoint Purpose
POST /api/accounts/:account_id/subscriptions/stripe/checkout-session Start subscription checkout
POST /api/accounts/:account_id/subscriptions/stripe/portal-session Open customer portal
POST /api/accounts/:account_id/subscriptions/stripe/checkout-session-sync Sync checkout session to subscription
POST /api/accounts/:account_id/subscriptions/sync Sync subscriptions from Stripe
POST /api/accounts/:account_id/subscriptions/change Change plan or pricing
POST /api/accounts/:account_id/subscriptions/cancel Cancel subscription
GET /api/accounts/:account_id/subscriptions List subscriptions
GET /api/accounts/:account_id/subscriptions/features List active features
GET /api/accounts/:account_id/subscriptions/identity Get Stripe customer identity
POST /api/applications/:application_id/subscriptions/stripe/webhook Stripe webhook receiver

Checkout Session

Creates a Stripe Checkout session for new subscriptions:

// Request
{
  price_id: "price_...",
  success_url: "https://app.example.com/success",
  cancel_url: "https://app.example.com/cancel"
}

// Response
{
  url: "https://checkout.stripe.com/..."
}

Redirect users to the returned URL. After payment, Stripe redirects to your success URL.

Customer Portal

Let customers self-manage:

  • Update payment method
  • View invoices
  • Cancel subscription
  • Change plan
// Request
{
  return_url: "https://app.example.com/settings";
}

// Response
{
  url: "https://billing.stripe.com/...";
}

Subscription Identity

Each account has a subscription identity that maps the account to the Stripe customer. This is used to resolve Stripe webhooks and sync billing state.

Webhook Events

AM handles Stripe webhooks and retries on failure:

Event Action
checkout.session.completed Link customer and create subscription
customer.subscription.* Sync subscription data
invoice.paid Sync invoice + update access
invoice.payment_failed Update access window