Redirect to charge confirmationUrl outside of afterAuth method?

Highlighted
New Member
3 0 0

I'm building an app that has multiple subscription tiers.

 

After install, or before choosing a subscription, I want to show a page where the user can choose a subscription tier.  To do this, I was thinking I'd link them to a route in my node server that is handled like this:

 

router.get("/subscriptions/pro", async ctx => {
    const { shop, accessToken } = ctx.session;
    ctx.cookies.set("shopOrigin", shop, {
      httpOnly: false
    });
    server.context.client = await handlers.createClient(shop, accessToken);

    await handlers.getSubscriptionUrl(ctx);
  });

Right now, the getSubscriptionUrl looks like the default one, nothing custom yet.

 

I'm getting errors, though.  In the terminal:

 

   Error: write EPIPE
┃       at WriteWrap.afterWrite (net.js:779:14)

and in the admin panel, I'm getting

<MY URL> refused to connect.

Not sure what's going on or how to do this properly.  Using the new Shopify CLI that looks like the Node + React tutorial.

0 Likes
Shopify Partner
43 4 8

Also if you check your developer console on browser, you should see the i-frame error.

Basically you need to take the confirmation_url and pass it to your frontend JS and run following on frontend:

<script>
  window.top.location = confirmation_url
</script>
Need some help or work done? Hire me!
0 Likes