-
Notifications
You must be signed in to change notification settings - Fork 683
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
"fullpage_redirect_to" is not working #1287
Comments
I am trying your solution but now seeing app install screen in iframe. |
Can you show me the value of @url or how you created the charge? |
Are you include ShopifyApp::ShopAccessScopesVerification in the controller? If so, I think I got the cause. It will not redirect to confirmation page because the shop param is not present. Check this function in shopify_app-17.2.1/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb
So my advice, move all the charge function to another controller, that not include ShopAccessScopesVerification |
What I think that is happening here (correct me if I'm wrong) is that the When inspecting my network calls I can see the request returning the proper output but this is not used. It seems this method is not compatible with turbolinks. I tried to get the So in the end I wrote a new redirect method which uses some js code from Added this to my def top_redirect_to(url)
script = <<-SCRIPT
(function(){
normalizedLink = document.createElement('a');
normalizedLink.href = "#{url}";
data = JSON.stringify({
message: 'Shopify.API.remoteRedirect',
data: {location: normalizedLink.href}
});
window.parent.postMessage(data, "https://#{current_shopify_domain}");
})();
SCRIPT
self.status = 200
self.response_body = script
response.content_type = "text/javascript"
end Now when creating a charge I can redirect the user like so: class SubscriptionsController < AuthenticatedController
def update
...
top_redirect_to result.data.app_subscription_create.confirmation_url
end
end |
@yourivdlans I was running into this same issue as you on this, and (using your code as inspiration) came up with a simpler solution: charge = ShopifyAPI::ApplicationCharge.create(charge_details)
fullpage_redirect_to charge.confirmation_url
response.status = 303 # Makes Turbo render html response So we can keep using the built in |
@forsbergplustwo Nice one! Thanks for sharing :) |
This has saved me after many hours of searching. Thank you so much! @forsbergplustwo |
Me too. Thanks @forsbergplustwo |
If anyone faced the related issue with version 18.1.2 and Application Charge URL, let's check for this issue #1387 |
To me it says, "undefined method `fullpage_redirect_to' for #<HomeController..." I generated the app using Shopify CLI 3.0, here is the glimpse of the Home Controller
|
Description
I have added this gem (version 18.0) and using turbolinks to make it multipage app with session token. I have done it successfully.
Now, i am facing issue when add recurring application charge. I have created charge successfully and getting response.
In response, I am getting confirmation url and i am trying to redirect it using "fullpage_redirect_to" but it is not redirecting to cofirmation url.
Please help me.
Thanks in advance.
The text was updated successfully, but these errors were encountered: