How can I confirm that a cart has been successfully paid for?

Hello,

I am currently trying to automate some calls based on the products purchased in a cart using code. Here’s a life cycle that I’d like to follow:

  1. Customer adds desired products to cart
  2. Customer adds coupon to cart
  3. Customer pays total after the discount is applied and total payment is received
  4. Verify payment is successful
  5. Digital products in the cart are sent to them separately via email

I have a couple of questions on how to execute this:

  • How do get the total after the coupon has been applied?
  • How can I verify that the payment has been made from the shopping cart page?
  • How can I access the items in the cart after the payment has been verified?

Thank you for your time

Have you looked through the options in the Wix API reference already for Wix Stores Backend with Events, Wix CartIcon and Thank you page with getOrder etc?
https://www.wix.com/corvid/reference/wix-stores.html
https://www.wix.com/corvid/reference/wix-stores-backend.html
https://www.wix.com/corvid/reference/$w.CartIcon.html
https://www.wix.com/corvid/reference/$w.ThankYouPage.html

Also, have a look at Wix Pay itself for a typical pay cycle.
https://www.wix.com/corvid/reference/wix-pay.html
https://www.wix.com/corvid/reference/wix-pay-backend.html