#tetthys

1 messages · Page 1 of 1 (latest)

fluid frigateBOT
fossil nimbus
#

Hi there, a complete checkout session doesn't always mean a successful payment. You can should it's underlying PaymentIntent and see if its status is succeeded

sand oak
#

I'm thinking of getting items from cart and putting them in the line_items array.

I don't want to add anything more to that code.

I just want to do a simple redirect.

After the customer has completed the payment, I want to insert something to database.

Is the only way to know if the payment has been successfully completed is to get it from webhook??

fossil nimbus
#

Webhook is one way, you can also add the {CHECKOUT_SESSION_ID} template variable to the success_url when you create the Checkout Session, so that your backend can get the checkout session ID when your customer is redirected to the success_url page. From there you can retrieve the checkout session and expand the payment_intent to get its status.

sand oak
#

Thank you for answer. I'm going to use webhoook now