Getting the shopify url when creating a RecurringAppSubscription for App with GraphQL

Highlighted
Tourist
6 0 6

Hello, 

We successfully created an AppSubscription.

However, since Shopify only appends the charge id to the returnUrl we created the AppSubscription with, we have to somehow append the shopUrl to the URL so that we could save it and later query for the subscription info based on the chargeId. (Since working with GraphQL Admin Api requires the Shopify URL as part of the Root URL)

My question has two parts then:

1. Is there a way to pass the shop URL along with the charge id in the return URL?

2. Is there a way to query Shopify only with the charge id and out Shopify App Key? (since the charge is connected to our app it seems like there should be a way to do so but I can't seem to find whether in fact it is possible and how)

 

Your help is highly appreciated!

1 Like
Highlighted
Explorer
101 7 14

I am working on the same thing right now and in my testing the answer is yes, when you write your GraphQL mutation to create the app subscription you just dynamically append that shop's URL as long as you have it on the server side during that session (you should). After they pass confirmation_url, using their example, if in your GraphQL query you put 

"return_url": "http://super-duper.shopifyapps.com/?shop={shopOrigin}"

Then the actual url they are directed to is http://super-duper.shopifyapps.com/?charge_id={charge_id}&shop={shopOrigin}

Why do you need to query charge_id without any other key or token? Are you asking this based on your first question in the scenario where you can't tie the URL with the charge_id to a shop? 

 

 

1 Like
Highlighted
Tourist
6 0 6

0 Likes