checkoutCreate redirect issue with custom store domain

Solved
Highlighted
Shopify Partner
12 0 1

Hi!

 

We're using the Storefront API mutation createCheckout, the returned webUrl property in particular.

 

Prerequisites:

1) The customer is already logged-in to the shop.

2) The shop uses a custom domain, for example shop.example.com

 

createCheckout returns the default shopify domain instead of the custom domain (no surprise):

https://example.myshopify.com/10000000000/checkouts/abxdefghijklmn?key=abxdefghijklmn

When copy&pasting this URL into the browser, the shop redirects to the following URL although the customer is already logged in:

 

https://shop.example.com/account/login?checkout_url=https%3A%2F%2Fexample.myshopify.com%2F10000000000%2Fcheckouts%2Fabxdefghijklmn%3Fkey%3Dabxdefghijklmn

But when replacing https://example.shopify.com with https://shop.example.com before pasting the URL, it redirects directly to the checkout without a log-in prompt.

 

An "easy fix" is replacing the domains programmatically right after calling the checkoutCreate call.

But the issue seems to be more complicated:

For example, when choosing PayPal Express during checkout, the PayPal pop up opens. When completing the PayPal steps, the popup closes and the main browser again redirects to https://example.shopify.com instead of the custom domain. This means the customer is again asked to log-in, although he already is logged-in.

 

The first issue with copy&pasting the two different domains can be reproduced with any browser while logged-in to a shopify store as customer.

 

The second issue with PayPal is a bit more complicated:

The latest Chrome browser handles the redirect after the popup closes without presenting the log-in form.

A chromium based browser such as CefSharp hits the log-in page and the url parameters are exactly as shown above although the domain had been replaced with the custom domain before initiating the checkout. For some reason PayPal seems to use the default Shopify-domain internally.

 

Why the browsers behave differently in this case is a miracle to me...

 

Is this the expected behaviour? Can PayPal be configured in a way that it uses the custom domain?

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
491 97 88

This is an accepted solution.

Hey @29Palms 

 

When you call the API from the client you can pass in the custom domain so that the .myshopify.com URL returns the custom domain right off the bat. Can you confirm after making this change you are still experiencing the same domain issues? 

 

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


1 Like
Highlighted
Shopify Partner
12 0 1

Hi Vix,

 

awesome thank you! It now seems so obvious, silly me!

1 Like