This flow shows how to monitor refunds through their complete lifecycle from creation to final status, handling all possible status transitions. Refunds can be created through the API, by merchants in the Wix dashboard, or synchronized from Payment Service Providers.
The following steps describe the complete process of monitoring a refund from creation through final status.
A refund is created (either through the API, by a merchant in the dashboard, or synchronized from a Payment Service Provider).
Action: Receive the Refund Created event.
Result: Refund detected. The initial status is typically PENDING for API-created refunds, but can be any status for provider-synchronized refunds. Refunds can transition to any status (PENDING, SUCCEEDED, FAILED, or REVERSED) at any time. Continue to Step 2.
Inform the merchant about the refund and its current status.
Action: Display the refund details and current status to the merchant.
Result: Merchant notified of refund. Continue to Step 3.
Set up monitoring to detect when the refund status changes.
Actions: Choose one approach:
Result: Status change detected. Continue to Step 4.
Process the refund's final status and update your system accordingly.
Possible results:
rejectionReason field to understand why. Display an appropriate error message to the merchant. Depending on the rejection reason, you may retry by creating a new refund. Flow ends.In rare cases, a previously successful refund may be reversed by the payment provider.
Action: Receive Refund Updated event with REVERSED status.
Result: Update your system to reflect that the refund was reversed. Notify the merchant that the funds have been reclaimed by the payment provider. Flow ends.
After implementing this flow, your app can reliably monitor refunds through all possible status transitions, providing merchants with accurate real-time refund status information and handling edge cases like reversals.