The shop parameter of redirect url is set to undefined when using Billing API.

Solved
yoshixj
Tourist
7 2 1

Hey,I develop paid shopify app.

When I call appSubscriptionCreate mutation and then confirm subscription, app redirect to "https://app-url.com?shop=undefined".

Why is shop query parameter undefined?

 

This is example of appSubscriptionCreate mutation request.

curl 'https://APP_URL.herokuapp.com/graphql' \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \
-H 'accept: */*' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczpcL1wvc3RvcmUteW9zaGl4ai5teXNob3BpZnkuY29tXC9hZG1pbiIsImRlc3QiOiJodHRwczpcL1wvc3RvcmUteW9zaGl4ai5teXNob3BpZnkuY29tIiwiYXVkIjoiMjlkM2Q4NTY2MDcxMjljOGU3MDJhMGJlYWZmNzRmNjYiLCJzdWIiOiI3MzIxMzQ3NzAzMCIsImV4cCI6MTYyODUxNzg3NywibmJmIjoxNjI4NTE3ODE3LCJpYXQiOjE2Mjg1MTc4MTcsImp0aSI6IjMxOTllM2RhLTA1YTMtNDg2ZS1iMzNjLWU1YjI0NTBiNjVlYiIsInNpZCI6IjEwNWEwM2VmZDA0NDgxN2U5YWMyMzdhZGJkODFjYjgyNWQ0MWZkYzExYzZmYWQwZmY4NzEzNTFhODU4MTM0Y2YifQ.ZghSl4hLXH3Lwg4QqjHTthtw6FW9RXo6PATZ6vuKfpA' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' \
-H 'content-type: application/json' \
-H 'Origin: https://APP_URL.herokuapp.com' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Referer: https://APP_URL.herokuapp.com/plan?shop=store-yoshixj.myshopify.com' \
-H 'Accept-Language: en-US,en;q=0.9,ja;q=0.8' \
--data-raw $'{"operationName":"appSubscriptionCreate","variables":{"name":"月額プラン","trialDays":7,"returnUrl":"https://APP_URL.herokuapp.com?shop=store-yoshixj.myshopify.com","test":true,"lineItems":[{"plan":{"appRecurringPricingDetails":{"price":{"amount":8,"currencyCode":"USD"},"interval":"EVERY_30_DAYS"}}}]},"query":"mutation appSubscriptionCreate($name: String\u0021, $trialDays: Int\u0021, $lineItems: [AppSubscriptionLineItemInput\u0021]\u0021, $returnUrl: URL\u0021, $test: Boolean\u0021) {\\n appSubscriptionCreate(\\n name: $name\\n lineItems: $lineItems\\n returnUrl: $returnUrl\\n test: $test\\n trialDays: $trialDays\\n ) {\\n appSubscription {\\n id\\n name\\n status\\n test\\n __typename\\n }\\n confirmationUrl\\n userErrors {\\n field\\n message\\n __typename\\n }\\n __typename\\n }\\n}\\n"}' \
--compressed

 

 

Accepted Solutions (2)

Accepted Solutions
yoshixj
Tourist
7 2 1

This is an accepted solution.

I tried it today,  redirect to `https://STORE_URL/?charge_id=23604658342&shop=STORE_NAME`  after the payment is confirmed.

How is the redirect url determined?

 

This is capture  of phenomenon.


https://gyazo.com/77afdc4cb42e1d170a3d2133ca663509

View solution in original post

yoshixj
Tourist
7 2 1

This is an accepted solution.

This Problem was fixed by downgrade shopify-app-bridge version 2.0.3 to 1.30.0.

This cause is not providing host parameter from shopify when redirecting after billing was confirmed.

So, I decide to downgrade shopify-app-bridge version 1.30.0  host parameter is not required from 2.0.3 host parameter is required anytime.

View solution in original post

Replies 2 (2)
yoshixj
Tourist
7 2 1

This is an accepted solution.

I tried it today,  redirect to `https://STORE_URL/?charge_id=23604658342&shop=STORE_NAME`  after the payment is confirmed.

How is the redirect url determined?

 

This is capture  of phenomenon.


https://gyazo.com/77afdc4cb42e1d170a3d2133ca663509

yoshixj
Tourist
7 2 1

This is an accepted solution.

This Problem was fixed by downgrade shopify-app-bridge version 2.0.3 to 1.30.0.

This cause is not providing host parameter from shopify when redirecting after billing was confirmed.

So, I decide to downgrade shopify-app-bridge version 1.30.0  host parameter is not required from 2.0.3 host parameter is required anytime.