How to add multiple billing plans to an app?

New Member
2 0 0

Hi There,

 

I have followed the step to step guide to implement a recurring application charge (https://developers.shopify.com/tutorials/build-a-shopify-app-with-node-and-react/charge-a-fee-using-...), but I would actually like to have four options (Basic, Normal, Advanced and Enterprise), how do I do this? I have looked everywhere and tried everything, but I can't get it working. This is the part of the code from the tutorial where I add a billing option:

const stringifiedBillingParams = JSON.stringify({

  recurring_application_charge: {

    name: 'Recurring charge',

    price: 20.01,

    return_url: TUNNEL_URL,

    test: true,

  }

})

 

Where do I put the other options?

0 Likes
Highlighted
Community Manager
Community Manager
618 45 81

Hi @gunnar-1,

 

I think you may be thinking about creating recurring charges wrong. You create a recurring charge on a shop that matches the plan that merchant selected, rather than create a single charge that encompasses all your plans.

 

So using your example, if your plan tiers cost $5, $10, $15, and $20 per month respectively, and the merchant chose the Advanced plan, your Billing params would looks like this:

 

const stringifiedBillingParams = JSON.stringify({
  recurring_application_charge: {
    name: 'Advanced plan',
    price: $15,
    return_url: TUNNEL_URL,
    test: true,
  }
})

You'll need to have logic in your app to know which plan a merchant chooses, and to make the appropriate API call to create the correct charge.

 

Hope that helps! Let me know if you need any clarification!

 

 

0 Likes
New Member
2 0 0

Thanks for the reply! It's the logic for a client to choose a plan in the first place that I'm after, would you be able to help me with that?

0 Likes