# 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

| Method | Equivalent to | Description |
| --- | --- | --- |
| `customer($customerId)` | [`$kit->customers->sync()`](/packagist-packages/stripekit/modules/customers/sync) | Re-pull and persist a single customer. |
| `subscription($subscriptionId, $userId = null)` | [`$kit->subscriptions->sync()`](/packagist-packages/stripekit/modules/subscriptions/sync) | Re-pull and persist a single subscription. |
| `payment($paymentIntentId, $userId = null)` | [`$kit->payments->sync()`](/packagist-packages/stripekit/modules/payments/sync) | Re-pull and persist a single payment. |
| `invoice($invoiceId, $userId = null)` | [`$kit->invoices->sync()`](/packagist-packages/stripekit/modules/invoices/sync) | Re-pull and persist a single invoice. |
| `paymentMethods($customerId, $userId = null)` | [`$kit->paymentMethods->sync()`](/packagist-packages/stripekit/modules/payment-methods/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

```php
$state = $kit->sync->everythingForCustomer('cus_R1a2B3c4D5e6F7', 482);
```

Returns:

```php
[
    'customer' => [ /* KitCustomerRecord */ ],
    'subscriptions' => [ /* list of KitSubscriptionRecord */ ],
    'invoices' => [ /* list of KitInvoiceRecord */ ],
    'paymentMethods' => [ /* list of KitPaymentMethodRecord */ ],
]
```

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.