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

Cancel

kit.subscriptions.cancel()#

Cancels a subscription, either immediately or at the end of the current billing period.

Signature#

Parameters#

FieldTypeRequiredDescription
subscriptionIdstringYesThe subscription to cancel.
atPeriodEndbooleanNo, defaults to falseIf true, the subscription keeps running until the current period ends, then cancels (cancel_at_period_end). If false, it is cancelled immediately.
cancellationReasonstringNoStored as a comment on Stripe's cancellation details.

Example request — cancel at period end#

Example response#

Note status stays 'active' and canceledAtUtc stays null when cancelling at period end, only cancelAtPeriodEnd flips to true. If atPeriodEnd is false instead, status becomes 'canceled' immediately and canceledAtUtc is set.

Errors#

ExceptionWhen
StripeOperationErrorThe subscription ID does not exist, or is already cancelled.

Notes#

If a storage adapter is configured, the record is persisted via saveSubscription() immediately.
To undo a scheduled atPeriodEnd cancellation before the period actually ends, use resume().
Previous
Retrieve
Next
Resume
Built with