I have an orders table and an orders detail table. I am using Stripe as the payment processor and using the Wappler App Connect Stripe Checkout.
I had initially had one server action that handled the insert into the orders table and order details table based on the datastore then completed the Stripe Checkout, then update the orders table with the payment intent. After payment was completed, I use the Webhooks to retrieve the order based on the payment intent and then update the orders table to show the order was completed.
An issue arose when doing it in this manner as discussed here.
So, I went back to the drawing board and re-thought the logic. I separated the insertion of the orders into the orders table into a separate server action. So, when the form containing the basic information is submitted, it submits to the orders table. Upon success, the form then fires off the Stripe Checkout using a different server action. The Stripe Checkout server action needs to update the order details with various data, but to do so, it needs the order id.
So, how do I pass the order id to the Stripe Checkout?
What I tried doing was setting a value on the orders sever action and passing it back to the page. The output works as intended. I then set a variable on the page to capture that output. I then added an order_id to the datastore since Stripe Checkout seems to only accept entries via Line Items.
The issue is that I am not sure how to properly connect the variable to the datastore. This is what it looks like when I try through an upsert.
However, this is not working correctly because it is not properly adding the order id to the existing prd id.
If this is the proper way of passing an order id to Stripe Checkout, what do I need to change to make it work?
If this is not the proper way of doing it, what is the best route to go?
I reviewed several topics, including this topic, but it does not seem to be quite on point because it appears to be using a form method and not the Stripe Checkout component.
Thanks.