I built a very simple app just to test out the stripe integration. The app has 4 buttons: Purchase plan, start free trial, manage billing, and cancel plan.
Everything works, except for the “cancel plan” bit. For some reason, it’s returning the wrong “current_period_end” date (it’s showing today’s date instead of next month, when the subscription expires).
The way the backend workflow that updates the user data is configured is exactly like this: https://youtu.be/GE2fYHFWahw?t=694 (included the timestamp in the link) only in my case, I’m canceling using a button in my app, instead of using the customer portal to do so. And I’m canceling the subscription at the end of the current billing period, instead of canceling it immediately.
What happens is:
- I have a backend workflow called “update_subscription” that updates the current user with data received from the Stripe webhook (such as subscription id, status, start and end date, etc.)
- In the bubble app, I click the red “Cancel plan button” which triggers a workflow that cancels the user’s subscription, and then shows me this text: “Your subscription expires on: Thursday, June 15, 2023” (it gets the date from stripe via the backend workflow I mentioned above)
- The backend workflow works fine when I first initialize it using this webhook url in stripe: https://mybubbleapp.bubbleapps.io/version-test/api/1.1/wf/update_subscription/initialize
- So since it worked, I then removed the “/initialize” bit from the endpoint url in stripe and tried canceling the plan again, in the bubble app. For some reason, it now shows today’s date as the subscription expiration date, instead of June 15, 2023.
- So instead of the backend workflow url of “https://mybubbleapp.bubbleapps.io/version-test/api/1.1/wf/update_subscription/”, I tried using the root workflow api URL of “https://mybubbleapp.bubbleapps.io/version-test/api/1.1/wf” in my Stripe webhook. I then canceled the plan again in bubble and it now shows the correct expiration date.
My question is: Should I just continue using the bubble workflow API root URL in my stripe webhook? Would that cause any issues going forward, especially if I have multiple backend stripe workflows with different names, but in Stripe I only have one webhook that uses the root URL?
And why is the workflow URL not working after I remove the “/initialize” bit from it? I thought that’s what you’re supposed to do after you successfully initialized the request.
Thanks