less than a minute read • Updated 7 minutes ago
Sync customer data for single sign-on
How to keep customer records synced between Foxy and your site across the points where single sign-on data changes hands.
Single sign-on relies on customer records staying synced between Foxy and your site. There are four points where that sync happens, each triggered differently.
Sync points
Trigger | Triggered by | What to do |
|---|---|---|
Webhooks | Checkout completion, an update-info request, or a subscription modification, cancellation, or past-due payment | Create the user account if it doesn’t exist, and update the password each time so it stays in sync with any changes made at Foxy checkout. If a subscription moves to a different email, you may need to carry data over from the old email’s account to a new one. Track subscriptions by sub_token if this could affect your store. |
Subscription webhook | A subscription being canceled | Delete or modify the user account depending on the subscription’s status and how you use it. |
Your website | A user signing up for a new account or modifying an existing one | Create a linked Foxy account using the API when a new account is created, or update the linked account when an existing one is modified. |
Single sign-on endpoint | A customer checking out from the cart | If the user is logged in, use the API to confirm a Foxy customer account exists for that email, creating one if it doesn’t, before redirecting to checkout authenticated. If no user is logged in, redirect to your login or registration page, or allow guest checkout. |
Notes
Foxy treats a customer’s email as the unique identifier, so if your system lets customers change their email, store the Foxy customer ID alongside the record. It stays stable even when the email changes. See the single sign-on overview for more on identifying customers by email vs. customer ID.