LIVE: Join us for a live Feedback On My Store Webinar. Click or tap here.

PayPal Express callback url is not on primary domain

nrdcp
New Member
2 0 1

We are a Shopify Plus client and we have a custom storefront (nextjs app). As a business that is a combination of a service and a store it is very important that users do not change their email address during their checkout process as this will result in Shopify creating a new account for them.

See the following scenario:

1. User goes to our web app (https://app.OUR_DOMAIN.co.uk) and retrieves their checkout by logging in into Storefront API

2. When user is ready to make an order, we log them in into Shopify using Multipass

3. User then ends up on Shopify Checkout page on our primary domain (e.g. https://OUR_DOMAIN.co.uk/33977925764/checkouts/CHECKOUT_ID)
Notice user is shown as logged in on Checkout page

4. User selects PayPal Express and logs in using their PayPal credentials

5. User is then redirected back to Shopify Checkout, but they are now shown as NOT logged in any longer (url is https://OUR_HANDLE.myshopify.com/33977925764/checkouts/CHECKOUT_ID?refresh_count=1) -> notice the *.myshopify.com domain
Expected: user to be still shown as logged in.

Screenshot 2020-09-30 at 12.50.57.png

In Shopify Admin we have the option to redirect user to Primary Domain selected

Replies 2 (2)
Marcus_
New Member
1 0 0

@nrdcp I have the same problem now. How did you solve the issue? 

nrdcp
New Member
2 0 1

@Marcus_ , so this is the solution that Shopify support proposed and (that worked for us).

When you call Storefront API to create or amend users' checkouts, the URL must have your primary custom domain as the base, e.g.

```
// instead of
https://<MY_HANDLE>.myshopify.com/api/2011-04/graphql.json

// change to
https://<MY_CUSTOM_DOMAIN>/api/2011-04/graphql.json (assuming your checkout url is `https://<MY_CUSTOM_DOMAIN>/checkout/...`

```

The fix will not resolve the issue retrospectively, so only new checkouts created with <MY_CUSTOM_DOMAIN> storefront URL will have user logged in automatically