Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirecting back to app after billing / how to get app name #1227

Closed
JeaneC opened this issue Jan 26, 2023 · 4 comments
Closed

Redirecting back to app after billing / how to get app name #1227

JeaneC opened this issue Jan 26, 2023 · 4 comments

Comments

@JeaneC
Copy link

JeaneC commented Jan 26, 2023

I'm using appSubscriptionCreate to create a subscription which needs a returnUrl and according to shopify support this returnUrl needs to be back in my embedded app. Would be nice if this could be automatic (the user just returns back to the page they were at before billing).

I don't know how to get a return URL in the backend of the embedded app. I saw a function called getEmbeddedAppUrl somewhere, but this only seems to work well during the auth flow (where it's used) where the host and shop name are passed as query parameters.

I also thought about manually constructing the URL www.store.myshopify.com/admin/${APP_NAME}, but then I need an app name

@mkevinosullivan
Copy link
Contributor

@JeaneC when you say you are using appSubscriptionCreate, I assume you are referring to the GraphQL mutation, so you're doing this manually?

There are mechanisms in the API library to allow you to do billing checks and requests that might help

Using those mechanisms, the user is returned to the main page of your app.

W.r.t. constructing the URL manually, note that www.store.myshopify.com/admin/${apiKey} will work, as the apiKey of your app is the unique identifier for the app.

@JeaneC
Copy link
Author

JeaneC commented Jan 27, 2023

🤦 .Thank you @mkevinosullivan for the pointer and fast response! I think I must've just missed these in the docs as I was learning a lot of things. I was doing it manually but no more!

@JeaneC JeaneC closed this as completed Jan 27, 2023
@juanpasolano
Copy link

@mkevinosullivan, the guides appear to be out of date. I am wondering if there is no easier way to get the store and host, it seems they are used internally to check auth but not exposed anywhere in the shopify-api-js api.
Is there a reason why getting this apparently basic information is not easily accessible?

@remy727
Copy link

remy727 commented Jan 17, 2025

This should help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants