Delivering User Details from External Site using Base64-Encoded Stringified JSON Object?

New Member
2 0 0

Hello everybody!

 

Our partner would like to create Shopify user accounts on our store by providing visitors to their external site a referral link with encoded user data.

They suggested the delivery format can be "simply a stringified JSON object encoded in base64 to avoid URL unsafe characters and delivered as query parameter."

 

I found this thread which makes me think it's possible. Is there documentation I can provide the partner or ready myself to help guide our next steps?

 

Thank you kindly folks!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
106 19 22

Hi @Lyearning ,

 

If you are a Shopify Plus merchant, you can use a feature called Mulipass which will allow you to redirect users from the external site to the Shopify store and seamlessly logs them in with the same email address they used to sign up for the original website. If no account with that email address exists yet, one is created. This will automatically handle the use case you are looking for in a simple way. 

 

If you're not on Plus, the method your partner suggested could also work in this use case. While Shopify does not have any official guides or documentation on how to perform this, all you would essentially need to do is: write JavaScript code for your Shopify store that would parse the query string parameters of the URL, determine if the query string parameter for the encoded user data is present, and if so base64 decode that encoded string to get the user data and then finally make a POST request to the Admin API Customer endpoint in order to create a new Shopify Customer account for this user. 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes