1. Subscriptions
Documentation
  • Back to home
  • StripeKit
  • Installation
  • Getting Started
  • Choosing a Mode
  • Type Reference
  • Setup
    • Configuration
    • Timezones
    • Storage Adapter
    • Money and Currency
    • Error Handling
  • Stripe
    • Elements
  • Modules
    • Overview
    • Customers
      • Overview
      • List
      • Retrieve
      • Find or Create by Email
      • Create
      • Update
      • Sync
      • Delete
    • Payment Methods
      • Overview
      • Create Setup Intent
      • List
      • Attach
      • Detach
      • Set Default
      • Sync
    • Payments
      • Overview
      • Pay With Saved Method
      • Create
      • Retrieve
      • Confirm
      • Cancel
      • Sync
    • Checkout
      • Overview
      • Get
      • Create
      • Submit Fields
      • Apply Coupon
      • Mark Complete
    • Subscriptions
      • Overview
      • Create
      • Retrieve
      • Cancel
      • Resume
      • Toggle Collection Method
      • Update Fields
      • Apply Promotion Code
      • List By Customer
      • Find By Metadata
      • Sync
    • Invoices
      • Overview
      • Retrieve
      • List By Customer
      • List By Subscription
      • Pay With Saved Method
      • Void
      • Finalize
      • Sync
    • Coupons
      • Overview
      • Create
      • Validate
      • Apply To Subscription
      • List
      • Deactivate
    • Webhooks
      • Overview
      • Process
      • Events Reference
    • Sync
      • Overview
  1. Subscriptions

Overview

$kit->subscriptions creates, retrieves, cancels, resumes and updates Stripe subscriptions, with built-in support for custom fields and both UTC and local period timestamps.

Methods#

MethodDescription
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.

The KitSubscriptionRecord shape#

array{
    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.
Previous
Mark Complete
Next
Create
Built with