Creating customer carts on a headless storefront

Hello!

I’m working with a team of developers, and we’re new-ish to Shopify (~1y now). I need some help with customer tokens in a headless scenario:

We’re developing a headless storefront and a private subscription app. The need I have right now is to create a customer-bound cart (ie, buyerIdentity) through a server-side request. The use case is for CX personal preparing a cart on the behalf of a customer.

I’m creating the cart using the storefront’s cartCreate mutation, but to make it bound to a customer, I need their access token, which I won’t have in this particular scenario, as the actor making the call is a Customer eXperience rep.

Is there another way to obtain an authenticated cart, or a cart bound to a customer, where personal (ie, address) is pre-filled on the checkout page? Can such an access token be obtained without the customer-facing authentication flow?

I did some research and found this old topic [How can I create an access token in the new Customer Accounts API using headless/external auth/SSO], which I found to be relevant, but not responses.

Please Help!

1 Like

Hey @phrfpeixoto, since the customer can’t log in to generate the customer access token, the best alternative would be to use the admin API and draft orders

You can apply all of the customer attributes and that will generate a checkout URL specific to the customer.

Thanks for the feedback KyleG!

1 Like