Shopify rest billing api

Shopify Partner
46 0 4

I am integrating the shopify app charges with my app using the REST API. The problem I am facing because the lack of some functionalities about the Shopify billing flow. Currently In order to set up the billing I need to pass the minimum following params,

  • name (plan name)
  • price 
  • return_url

And creating charge returns at minimum  the following params,

  • id
  • name
  • return_url (confirmation_url) etc

This is simple enough for an app. But it introduces some difficulties to the app developer. The first implicit issue is that we need to keep a unique name for billing plan. Since there is no other way we could get around with it. So this means your db schema also need to remember this. An issue here is that the plan name is also a consumer friendly name. This means it can be lengthy with spaces and long characters. So whenever we get an  activation request we must fetch the plan details based on this lengthy "plan name".One way to get around this to fetch the plan based on price. SInce it is frequent that we are as an app developers experiment with price and occasionally with plan name. So this make painful.  This happens because Shopify does not allow any other plan meta info accepting as a parameter ( stripe etc does this). So this issue can be overcome. 

So if there another way with in the limits of the API ?

Digging it seems we could pass query params to the confirmation_url which is to the user is redirected upon accepting the charge. SO you could pass something like  https://your-return-url/planId=your_database_id. SO the return URL will be like https://your-return-url/planId=your_database_id&charge_id=some_charge_id. But the problem here is that the return_url must be of 255 characters. So what ever you are passing must be of length = (length(your_ativation_url) - length(charge_id=some_charge_id). So what ever we passing must be of plain text or the code must be of in the limits of the length. This pretty much useless. 

So my question is howare you handling these difficulties. Of course you can choose to exist  with in  the boundaries of the system. My necessary requirements are like I need to experiment on the billing strategy and which involves a/b test of plan names and price. But during these a/b tests the user might not need to know about this ( I mean they should see the plan they have opted). Also my app can have recurring charges and one time charges( a/b test). 

SInce we can do this lot of way around the system by obeying the rules. I want to know if there any best practices for doing this without doing so much manual coding things ?

I think Shopify API lacks some of the billing feature. Making two separate end point also cumbersome. It needs us to check the type of billing charge or remembering the type of a billing charge before making the appropriate end points.

Any insights appreciatd