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

Update Fields

$kit->subscriptions->updateFields()#

Updates the custom field values (field_<key> metadata entries) stored on a subscription, for example letting a customer change a seat count or a plan-specific option after the subscription already exists.

Signature#

Parameters#

FieldTypeRequiredDescription
subscriptionIdstringYesThe subscription to update.
fieldValuesarray<string,string>YesThe new values, keyed by field key.
schemalist<array>NoIf given, fieldValues is validated against this schema first, same shape and rules as customFields on $kit->checkout->create().
intervalDaysintNo, defaults to 30Purely informational, used to compute nextUpdateAvailableAtUtc in the response. StripeKit does not enforce this interval itself.

Example request#

Example response#

Note this method returns only fieldValues and nextUpdateAvailableAtUtc, not the full subscription record. Call retrieve() or sync() if you need the full record afterwards.

Errors#

ExceptionWhen
ValidationErrorschema was given and one or more values fail validation, $error->fieldErrors is set the same way as checkout->submitFields().
StripeOperationErrorThe subscription ID does not exist.

Notes#

This replaces only the field_* metadata keys derived from fieldValues, it does not touch any other metadata already on the subscription.
If a storage adapter is configured, the full updated subscription record (not just the fields) is persisted via saveSubscription().
nextUpdateAvailableAtUtc is not enforced anywhere in StripeKit itself, if you want to rate-limit how often a customer can change their fields, check this value yourself before calling updateFields() again.
Previous
Toggle Collection Method
Next
Apply Promotion Code
Built with