hi bubblers
so i have finally went away from stripe plugins and maked the hole setup by using stripe API calls by following Gregs tutorial for a complete stripe setup
and it works so much better than it did before!
but there is one thing that i cant get to work..
i offer both yearly and monthly plans for my 2 subscriptions plans
and have saved each price id’s as attributes for an option set of my plan
but i cant find the logic and expression for how bubble should know what to change in db based on the webhooks
for and endpoint for invoice paid for instance i try to create a payment and will define the plan in the payment and depending on the plan also get an amount paided.. but the only logic there make sense for me is making 2 constraints in the search but i also think bubble cant figure that out like that..
same thing when i try to create a checkout session.. i cant find the logic for the line_items[price]
either
Your “Create a new payment” constraints won’t work because you are saying the request data has to have both the monthly Price ID and the Yearly Price ID, when it will only ever have one or the other.
Better to have an additional attribute i.e “Plan Type” of “Monthly” or “Annual” and do a “is Monthlys Plan ID: format as text” condition - if its monthly, it must be the monthly price ID you want. Otherwise it must be the annuals price ID.
This actually looks like what you do in the second screenshot, with the “Yes” condition evaluating to either dev or live monthly price ID and the “no” condition evaluating to either dev or live annual price ID.
Hi @NoCodePhill
But what i do in second screenshot doesnt work either.. then it comes with a 400 error in stripe when i chose yesrly price id
And in the first screenshot i dont get to use the format as text action
as you see i cant use the format as text as an operator in this expression..
i have tried to make a option set called frequency and option called month and year and modified each attributes to the different price id’s now.. but still cant find the logic for the expression as you see above
You need to go to the next “more” to find the formatted as text.
You could try to abstract this a bit more to make it easier to trace.
Create a custom event with a parameter of “Plan”. When you need to create a new payment, trigger that custom event sending in the respective plan.
Within that custom event you have to “Create a new payment” actions, one of which contains the Monthly Plans specs, the other the annual. Set a condition on each to only fire when its the respective schedule.
That should help separate out the various If/Thens you have and make it easier to determine where the source of error lies.
Regarding Price_IDs - be sure that wherever you are storing them there are no whitespaces at the end which otherwise appear invisible as this will cause issues (or just add :trimmed onto the end of your declaration). That should save you the 3+ hours it took me to work out that this was the issue one time.
could i use the operator “or” instead of format as text? doenst that says that the retrived data have to be either monthly id “or” yearly id