Customer Token
What is customer token?
When a customer selects “remember me” checkbox during the checkout, a token is issued, later used to identify the user and prefill their data automatically in a subsequent checkout.
Why would I care?
For convenience, the flow is handled for you, but in some cases, you may want to handle the token yourself to override the default behavior.
By default, the token is stored within the browser between checkouts, which works well most of the times. However, there are cases where this is not desirable: for example, a user signs out from your platform to let a different person make a purchase on the same computer, but the token issued for the first user is still in the browser, which results in mismatched data being prefilled for the second one.
So what can I do?
You may simply clear the browser-stored token when the user signs out:
Additionally, you may pass the right token during checkout initialization like this:
This of course assumes you have stored the token during a previous checkout, using a callback: