I’ve created a kind of “click and collect” app. My challenge this week has been to ensure that an order is only passed onto collection once payment (via the Stripe Plugin) is successful. Previously, after ordering, a user could just shut down the Stripe payment screen and their order would still be processed so they could go and pick it up, no questions asked. Not great.
To tackle this I’ve created a Workflow that creates records for the Order and another for the OrderDetails (ie line items) in their respective DataTypes and each table has a Yes/No field telling me whether the payment has been successful. By default it’s set to “No” but after the user has gone through the Stripe screens successfully, it sets this “PaymentSuccessful” field to “Yes” using Workflows on the page. I can then work with only orders where payment has been successful. This seems clunky though and none of it’s done on the backend which I was advised to do.
To do it on the backend, I tried Webhooks and incorporated a “Payment Successful” event into a backend workflow but I’ve found the actions I can trigger with this are too limited because there are no “Element Actions” available and the “Make a Change to a Thing” doesn’t offer me any way of getting to the specific Order and OrderDetails records that need updating to switch the PaymentSuccessful field to “Yes”. Also, I was unable to find a way to trigger a “payment failed” event to initialize the webhook.
I’ve tried the API Connector but it’s just a mystery to me. I’ve been on here asking questions, I’ve looked a days’ worth of YouTubes. I’ve read Bubble’s docs and Stripe’s docs and I’m still just staring at it like a horse who’s been asked to book a holiday.
So I guess what I’m asking is, what’s the best way of recording an order in Bubble that is dependent on the Stripe payment being successful so I can avoid processing orders for collection where payment failed? Having invested a week to come up with a clunky workaround on the page, should I be investing my time in APIs, Webhooks or something else?
I’d be so grateful for any direction here
All the best
Joe