Stripe subscription sync
When Stripe is your billing provider, Stripe decides what happens to a subscription after checkout: renewals, failed payments, cancellations at the end of a paid period. Subscription sync keeps PeakCommerce in step with those decisions, so the subscription your team and your own systems see in PeakCommerce matches what Stripe is actually doing.
What stays in sync
For every subscription created through a PeakCommerce journey, Stripe's events update the PeakCommerce subscription:
creates or changes the subscription
refreshes its status, current period, billing interval and whether it cancels at period end, then sends the subscription.changed webhook — only when something actually changed
ends the subscription (for example, at the end of the paid period after a cancel)
marks it cancelled and sends subscription.cancelled, once
records an invoice as paid
sends payment.succeeded
records a failed invoice payment
sends payment.failed
Access therefore ends when the paid period does, not at the moment someone clicks cancel. Subscriptions that were not created through PeakCommerce are left alone.
Connect Stripe's events to PeakCommerce
Sync runs on Stripe's webhooks, so Stripe needs to know where to send them and PeakCommerce needs to be able to verify them.
Find your Stripe integration's id. In PeakCommerce, open Settings → Integrations → Stripe and choose Edit on your Stripe integration. The id is the part of the browser address after
/instances/.Add the endpoint in Stripe. In your Stripe Dashboard, go to Developers → Webhooks and add an endpoint with this URL:
https://[your PeakCommerce domain]/api/stripe/webhook/[integration id]Select these events:
customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.paidinvoice.payment_failed
Copy the signing secret. Stripe shows a signing secret (it starts with
whsec_) for the new endpoint.Paste it into PeakCommerce. Back on the Stripe integration's Edit page, paste it into Webhook Secret and save.
Each Stripe integration has its own endpoint and its own secret. If you run more than one Stripe integration, repeat these steps for each.
The signing secret is required for sync. The field is marked optional, but PeakCommerce refuses every Stripe event it cannot verify. Without a secret, nothing syncs.
What PeakCommerce does with each event
Every event is verified against that integration's signing secret before anything changes. An event that fails verification is refused and changes nothing.
A repeated event is safe. Stripe sometimes sends the same event more than once; PeakCommerce recognizes an event it has already handled and doesn't apply it twice.
A failure is retried, not lost. If PeakCommerce can't process an event, it tells Stripe so, and Stripe retries it on its usual schedule.
Bringing existing subscriptions up to date
Subscriptions that changed in Stripe before sync was connected can be refreshed from Stripe with the admin API's POST /api/v1/billing/stripe/resync. It needs an API key with the admin scope and works in two steps:
Call it without
?execute=truefor a dry run. Nothing changes; the response lists what would change and includes aplanToken.Review the plan, then call it again with
?execute=trueand thatplanTokenin the body to apply exactly the reviewed plan.
You can limit it to one subscription (subscriptionId) or one Stripe integration (integrationId).
Related
Stripe — connecting Stripe as your payment processor
Webhooks — receiving
subscription.changed,subscription.cancelledand payment events in your own systemsSubscriptions API — including cancelling a Stripe subscription at the end of its paid period
Last updated
Was this helpful?
