Hi experts,
While developing a simple Shopify app, I’m struggling to set up billing logic. I followed the workshop tutorial to include billing logic into the authentication flow: https://workshops.shopify.dev/workshops/usage-billing#4
Everything works as expected except that when I click ‘cancel’ button in the payment page, it still installs the app. I also realized that session is getting stored in the designated DB before going through the payment. Is this expected or this is because I set isTest flag to true when calling request.billing? What would be the solution to this? Should I implement a middleware logic to re-direct all request to the payment page until the payment is made?
Hello,
It is expected. The app has to be installed to call the billing api’s.
You can just redirect traffic to a payment info page until the the merchant has accepted or uninstalls.
Hi,
I replied to someone with the same problem than you few days ago. My answer is here but I believe the whole thread can be interesting for you. I quote the interesting part of my first response below so you don’t have to navigate around if you don’t want to:
The workshop is about a “Usage Billing with the Shopify Billing API” which means that the subscription is here to limit the usage of a specific feature in your app, not to limit the access of the application.
Later in the thread, you can find a discussion on how to change the billingConfig and an advice on how to implement the access restriction (a middleware is probably the best solution)
I hope it helps you.