Home » Docs » Billing & Subscription Abilities

Billing & Subscription Abilities

These abilities manage Stripe subscriptions and billing on behalf of members. They all require the manage_options capability (site administrator) and, naturally, a working Stripe connection. See the Abilities API Overview for the full catalog.

Subscription Ownership

cancel-subscription and reactivate-subscription take both a user identifier (user_id or email) and a subscription_id, and verify that the subscription actually belongs to that user before acting. Mismatches return distinct errors:

  • members_only_no_stripe_customer — the user has no Stripe customer record
  • members_only_subscription_not_found — the subscription ID does not exist
  • members_only_subscription_customer_mismatch — the subscription belongs to a different customer

cancel-subscription

members-only/cancel-subscription cancels a Stripe subscription at period end — the member keeps access until their current billing period runs out. Pass dry_run: true to preview the change without making it.

ParameterTypeRequiredDescription
user_id / emailinteger / stringOne requiredIdentifies the user who owns the subscription
subscription_idstringYesThe Stripe subscription ID to cancel. Must belong to the identified user.
dry_runbooleanNoWhen true, report what would happen without cancelling. Defaults to false.

Returns: subscription_id, dry_run, canceled, the subscription status, cancel_at_period_end, and the current_period_end timestamp (when access will end).

Errors: the ownership errors above, plus members_only_cancel_failed when the Stripe call fails.

reactivate-subscription

members-only/reactivate-subscription resumes a subscription that was set to cancel at period end — the member changed their mind before the period ran out.

ParameterTypeRequiredDescription
user_id / emailinteger / stringOne requiredIdentifies the user who owns the subscription
subscription_idstringYesThe Stripe subscription ID to reactivate. Must belong to the identified user.

Returns: subscription_id, reactivated, the subscription status, and cancel_at_period_end (now false).

Errors: the ownership errors above, plus members_only_reactivate_failed when the Stripe call fails.

get-billing-portal-link

members-only/get-billing-portal-link creates a Stripe billing portal session for a user and returns the URL where they can manage their payment methods and subscriptions themselves. Useful for support workflows: generate the link and send it to the member.

ParameterTypeRequiredDescription
user_id / emailinteger / stringOne requiredIdentifies the user
return_urlstringNoWhere to send the user after they leave the portal. Validated against the site’s allowed redirect hosts; defaults to the account page.

Returns: user_id and the portal url. Each call creates a fresh, short-lived portal session.

Errors: members_only_no_stripe_customer when the user has no Stripe customer record.

list-products-and-prices

members-only/list-products-and-prices lists the membership products, prices, and promotion codes configured in Stripe, so an agent can answer what plans are offered and what they cost. It takes no parameters.

Returns: products (ID, name, description, active flag), prices, and promotion_codes arrays, plus a truncated array naming any list that hit its fetch cap and is therefore incomplete (each list is fetched up to a generous cap of a few hundred items). truncated is empty when every list is complete.

If Stripe is unreachable or not configured, this ability returns a members_only_stripe_unavailable error rather than presenting empty catalogs as valid data.