A place to discuss charging merchants for your apps and services using the billing API.
Hello,
Once a store owner installs my app, I redirect him/her to the billing page thanks to AppBridge.
Then, after billing, I can choose a url to redirect the user.
👉 I would like to redirect him to my onboarding page which have a specific url : /onboarding.
But, the only thing working on every shop (old and new backoffice urls) is to redirect to this url:
`https://${shop}/admin/oauth/redirect_from_cli?client_id=${apikey}`
That redirects to the app Homepage.
How can I redirect the user to something else?
Thanks!
Hi Growthfamily,
There was previously a App Bridge Redirect
action that might have worked for this, but it's not available on the current version. I will ask internally if there's a way to achieve this.
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks a lot Liam, looking forward to your answer.
Would using the Navigation API work for updating the browser URL?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks for your answer Liam.
My main question is how to format the URL in order to redirect to a specific page of the app from the Billing app API?
When I create a Subscription, I have a ReturnURL parameter (https://shopify.dev/docs/api/admin-graphql/2024-01/mutations/appSubscriptionCreate#argument-returnur...).
This is where I am doing the redirection. The redirection is working properly but I only know how to redirect to my app homepage.
If I want to create a redirection to a specific page of my app, I don't know how to structure the URL.
Shops backoffice have now 2 different URL version.
I would like to redirect the user to: https://admin.shopify.com/store/STORE_NAME/apps/MY_APP/app/help
But it doesn't work for shops using the old backoffice URLs: https://STORE_NAME.myshopify.com
I am also interested in this for a slightly different use case:
From a sub-page of my app I create a subscription based on a certain action. I want the user to be redirected to the page that he was on and not to the home page.
Not sure if it helps, but after reading pretty-much most of the internet and combining answers which I can no longer attribute to their appropriate sources, at least currently, if you are using Remix, you can get the store name like this:
const { session } = await authenticate.admin(request);
let storeName = session.shop.replace(".myshopify.com", "");
And you can substitute your app name by its client id (which I believe doesn't change between app versions). So you can introduce a new environmental variable, e.g. MY_CLIENT_ID in your env file and access it like this:
process.env.MY_CLIENT_ID
So now you can construct the url like this:
const returnUrl = `https://admin.shopify.com/store/${storeName}/apps/${process.env.MY_CLIENT_ID}/your/desired/path`;
I hope this helps someone.