Skip to content

Latest commit

 

History

History
70 lines (55 loc) · 2.53 KB

File metadata and controls

70 lines (55 loc) · 2.53 KB
togo

togo-framework/subscriptions

marketplace pkg.go.dev MIT

Part of the togo framework.

Install

togo install togo-framework/subscriptions

togo

togo · subscriptions

Subscription management for togoplans, subscribe / cancel / change, trials, and status — built on the payment plugin. Charges are delegated to whatever PaymentProvider is registered in the kernel; with no payment provider installed it still manages subscription state.

Install

togo install togo-framework/subscriptions
# usually alongside a payment provider:
togo install togo-framework/payment-stripe

Tables (plans, subscriptions) are created on boot.

API

Method Path Description
GET /api/plans List plans
POST /api/plans Create a plan ({name, price, currency, interval, features})
GET /api/subscriptions?user_id= A user's subscriptions
POST /api/subscriptions Subscribe ({user_id, plan_id, trial_days})
POST /api/subscriptions/{id}/cancel Cancel
POST /api/subscriptions/{id}/change Upgrade/downgrade ({plan_id})

Payment integration

The plugin looks up the payment service from the kernel container and, if it satisfies the local Charger interface (CreateSubscription), creates a provider-side subscription and stores the provider_ref. No hard import on payment, so subscriptions builds and runs standalone.

MIT


Premium sponsors

ID8 Media  ·  One Studio

Support togo — become a sponsor.