Wix-Pay API PaymentResult Status

I have implemented successfully a custom Payment flow on my site using the Wix-Pay API by mostly following this tutorial . (Yay me!)

However, the various statuses in the PaymentResults baffle me. I know what they are, but I can’t figure out the use cases for them (maybe they don’t apply to me). Specifically steps 7 & 8 in the before mentioned tutorial.

My site flows works as such:

  1. Identify a single product from a collection.

  2. Key in user data and call the Wix-Pay API.

  3. Collect payment via the payment window (from API call).

  4. Then show success/summary page if the payment status is successful

  5. Else, if payment status is failed, show error page

When would all these other status options occur in this flow (note, we are using Wix Payments and possibly PayPal):

  • “Pending”: Payment is pending payment provider approval.

  • “Chargeback”: Payment is chargeback.

  • “Offline”: Payment will be executed offline.

  • “PartiallyRefunded”: Payment was partially refunded.

  • “Cancelled”: Payment was canceled and was not processed.

  • “Undefined”: Payment status is pending payment provider input.

API Reference

In the tutorial I referenced above, they display a Pending screen for a pending status, but all the others are handled in the backend, and I simply don’t know what would cause those statuses and if they did occur what would be proper handling of them (from a user’s experience)?

Thanks in advance.

Hello,

For your specific use case, for the Summary page, you should relate on Successful, Failed, Pending, Cancelled and Offline transaction statuses.

  • For Failed and Cancelled (happen when Buyer cancels transaction on the provider’s side) you can build either an Error page if you don’t want your Buyers to try again or navigate them back to the checkout page to try with another payment method (optimal flow).

  • Pending may occur when the Buyer is paying via redirect payment method like PayPal and it takes some time for the transaction to get approved. So it also makes sense to show something like “Your payment is being processed” as a result, or it could be also a Success screen.

  • You will get Offline as a result of offline payment methods. You can use the same Success or Pending screens. Not relevant if you are not going to use such payment methods.

The rest of statuses should be considered when you listen to onPaymentUpdate() to update the transaction status if you are willing to automate the process on your end and build a business logic above, like ship the order, confirm the booking etc.

Hello, awesome explained Anna! I’m using PayPal as one of my payment methods, and I understand that, if the Buyer chooses that payment method, then the Pending status will occur.

I need to insert some data from my page into a collection whenever the status is successful so, do I have to use onPaymentUpdate() event? And, if so, how would I use it to say that if the status if pending, wait till it’s successful and then insert the data?

Already doing the data insertion if the status is successful in the first place.

Thank you in advanced!