Shopify Billing API Double Billing

Radu_Stefanescu
Tourist
4 0 4

I’ve been following the Build a Shopify App With Node.js and Next.js tutorial. 

In the afterAuth callback they make a graphql call to register a recurring plan.

Everything works fine but when I try accessing the app on the same store from a different browser or device that hasn’t been authenticated I am prompted again with the window where I have to accept the charges even though I’ve already done it.

Is this because this is a test charge on a development store or am I supposed to implement a logic that doesn’t create a recurring charge if I’ve already accepted one? 

Thanks for your time

Replies 5 (5)

SyedUzairAlii
Tourist
10 0 0

@Radu_Stefanescu  hello there ! i'm also having the exact same issue i build an app by following the Build a Shopify App With Node.js and Next.js tutorial. 
in my app i have a 30 days trial period but if i use the app from different browser or in same browser after couple of days, the Authentication happens again prompt the billing screen again to user which is overwriting the previous accepts billing and resetting the trial period back to 30 days .

did you find any solution to this ? do i need to make any logic in my server.js file ?

Thanks !

Radu_Stefanescu
Tourist
4 0 4
You need to implement your own logic to handle this. Try storing the user’s
plan in your database and check that when he logs in the app so you don’t
overwrite it.
SyedUzairAlii
Tourist
10 0 0

That's mean we are on it own no solutions from Shopify side ? and what will happen if user delete the app and install it again ? will I'm able to charge him again because logically its already in my database but new install app wont have the subscription ON?
any idea,

Radu_Stefanescu
Tourist
4 0 4
You can actually use graphql to querry for the user’s plan to see if it’s
active or not when the authentication happens. Look up the billing api.
SyedUzairAlii
Tourist
10 0 0

Or is there any query which  fetch a list of current subscriptions for the store then if we have a subscription active then we will call the for subscription.
Thanks.