$kit->subscriptions creates, retrieves, cancels, resumes and updates Stripe subscriptions, with built-in support for custom fields and both UTC and local period timestamps.| Method | Description |
|---|---|
create() | Create a new subscription for a customer. |
retrieve() | Fetch a subscription by ID. |
cancel() | Cancel immediately or at period end. |
resume() | Undo a scheduled cancel-at-period-end. |
toggleCollectionMethod() | Switch between automatic card charging and emailed invoices. |
updateFields() | Update custom field values stored on a subscription. |
applyPromotionCode() | Apply a coupon's promotion code to an active subscription. |
listByCustomer() | List a customer's subscriptions, optionally filtered by status. |
findByMetadata() | Find an active subscription by a metadata key/value pair. |
sync() | Re-pull a subscription from Stripe and persist it via your storage adapter. |
KitSubscriptionRecord shapearray{
id: string,
userId: string|int|null,
customerId: string|null,
priceId: string|null,
status: string,
currentPeriodStartUtc: string|null,
currentPeriodEndUtc: string|null,
currentPeriodStartLocal: string|null,
currentPeriodEndLocal: string|null,
cancelAtPeriodEnd: bool,
canceledAtUtc: string|null,
trialEndUtc: string|null,
collectionMethod: string|null,
metadata: array<string, string>,
fieldValues: array<string, string>,
createdAtUtc: string,
}fieldValues is automatically extracted from any metadata keys prefixed field_, so it always reflects whatever you last wrote through updateFields() or via a fieldValues argument on create(). See Timezones for how ...Utc / ...Local pairs work.