Skip to content

Synchronization model

Strent combines webhooks with reads from Stripe. A webhook tells Strent that something changed; Strent then reads the affected customer from Stripe and replaces its saved copy of that customer in one step.

  1. Stripe sends a subscribed customer, subscription, or schedule event.
  2. Strent verifies and records the event before acknowledging it.
  3. The event schedules customer refresh work.
  4. A worker reads current customer billing state from Stripe.
  5. Strent replaces its saved copy of the customer in one step, so a check never sees half an update.
  6. Checks read only the last complete copy.

Webhooks can arrive more than once and out of order. Reading the customer’s current state from Stripe gives the right result either way, instead of applying each webhook in order.

Call await strent.customers.refresh({ customer }) from your server when the app needs current Stripe state, such as after Checkout. Success guarantees that a Stripe read started after the request arrived and Strent’s copy of the customer is ready. Then use your existing runtime read to derive the plan. The response contains no billing or access data, and Strent does not grant access from a Checkout redirect.

Only work still in the queue can be reused. If the 10-second wait expires, Strent returns CUSTOMER_REFRESH_NOT_FINISHED and the worker continues. Refreshes created by this command appear in the activity log as “Your app refreshed from Stripe”; reused webhook refreshes appear through their event.

While Strent reads a customer again, checks keep using the last complete copy. A failed read does not partly overwrite it. A customer Strent has never read successfully stays not ready and returns 409 CUSTOMER_STATE_NOT_READY.

customers.retrieveBillingState exposes detailed subscription state and the last refresh time for inspection and billing pages. For checks on every request, use the faster active-items reads.

Strent refreshes every customer automatically when you connect Stripe in Strent Admin and whenever you replace the restricted key or the signing secret, so customers that existed before the connection, and changes missed while it was broken, are read with no action from you.

Strent also refreshes every customer from Stripe once a day, including customers deleted in Stripe, so a change it missed, such as a lost event, is corrected within about a day.

Use Refresh all customers from Stripe in Configuration → Stripe after fixing the event destination in Stripe, to catch changes Strent missed while events were lost. Use Refresh from Stripe on a customer for one customer. Neither changes anything in Stripe.