1. Sync
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. Sync

Overview

$kit->sync is a thin convenience module that groups together the individual sync() methods already available on other modules, plus one aggregate method that pulls a customer's entire state in one call. Nothing here does anything you couldn't already do by calling the individual modules directly, it exists purely so a full reconciliation reads as one clear call instead of five.

Methods#

MethodEquivalent toDescription
customer($customerId)$kit->customers->sync()Re-pull and persist a single customer.
subscription($subscriptionId, $userId = null)$kit->subscriptions->sync()Re-pull and persist a single subscription.
payment($paymentIntentId, $userId = null)$kit->payments->sync()Re-pull and persist a single payment.
invoice($invoiceId, $userId = null)$kit->invoices->sync()Re-pull and persist a single invoice.
paymentMethods($customerId, $userId = null)$kit->paymentMethods->sync()Re-pull and persist a customer's payment methods.
everythingForCustomer($customerId, $userId = null)—Pulls the customer, all their subscriptions, all their invoices and all their payment methods in one call. See below.

everythingForCustomer() in detail#

Returns:
Internally this calls, in order: customers->sync(), subscriptions->listByCustomer(), invoices->listByCustomer(), and paymentMethods->sync(). Every subscription and invoice returned is individually persisted via saveSubscription() / saveInvoice() when a storage adapter is configured, so a single call fully reconciles that customer's entire billing state in your own database.

When to use this#

A support agent needs to see, or you need to rebuild, a customer's complete current state, for example after they report something looks wrong in your app.
A scheduled nightly job that reconciles every customer's Stripe state against your database, to catch anything a missed or failed webhook might have left out of sync.
Onboarding an existing Stripe account into a new deployment of your app before any webhooks have fired yet.

Notes#

This module has no payments-by-customer or paymentMethods-only equivalent inside everythingForCustomer() beyond what's listed above; it deliberately covers exactly the four object types StripeKit tracks. For anything else, call the underlying Stripe client directly via $kit->raw.
None of sync's individual methods (customer, subscription, payment, invoice, paymentMethods) do anything different from calling the same method directly on their own module; they exist purely for convenience and discoverability.
Previous
Events Reference
Built with