Implement refund flow
Overview
This guide provides a step-by-step overview of the refund process facilitated by the Fynd Platform for its payment extension integration. It outlines the interaction between the various components involved, including the customer, the Fynd Platform, the Payment Extension, and the Payment Gateway. This interaction is illustrated in the following diagram:
- Customer cancels an order or places a return request.
- Fynd Platform calls initiateRefundSession API of payment extension with refund details.
- Payment Extension creates a refund request with the payment gateway
- Payment Gateway process the refund and sends refund status to Payment Extension.
- Payment Extension responds to the initiateRefundSession API with the refund details and refund status received from Payment Gateway. Only following refund status are accepted
- refund_initiated: When refund request is created by Fynd Platform, it's in
refund_initiated
state. - refund_pending: When refund state is pending from Payment Gateway, it's status should be updated as
refund_pending
. - refund_done: When refund has been finalized and completed by Payment Gateway, it's state should be updated to
refund_done
. - refund_failed: Refund failed.
- refund_rejected: Refund rejected by Payment Gateway.
- refund_disputed: Refund disputed.
- refund_initiated: When refund request is created by Fynd Platform, it's in
- Fynd Platform shows the refund status to the customer.
- Payment Gateway sends webhook to Payment Extension with updated refund status.
- Payment Extension calls updateRefundSession API with updated refund status. Accepted values of refund status are:
- refund_initiated: When refund request is created by Fynd Platform, it's in
refund_initiated
state. - refund_pending: When refund state is pending from Payment Gateway, it's status should be updated as
refund_pending
. - refund_done: When refund has been finalized and completed by Payment Gateway, it's state should be updated to
refund_done
. - refund_failed: Refund failed.
- refund_rejected: Refund rejected by Payment Gateway.
- refund_disputed: Refund disputed.
- refund_initiated: When refund request is created by Fynd Platform, it's in
- Fynd Platform shows updated refund status to the customer.
Crons Jobs
Fynd Platform runs regular cron jobs to check the status of refund transactions by sending a GET request to Payment Extension on getRefundStatus API. Payment Extension is expected to respond with status of refund transaction corresponding to gid
parameter. Accepted values of payment status are refund_initiated
, refund_pending
, refund_done
,refund_failed
, refund_rejected
and refund_disputed
.
- refund_initiated: When refund request is created by Fynd Platform, it's in
refund_initiated
state. - refund_pending: When refund state is pending from Payment Gateway, it's status should be updated as
refund_pending
. - refund_done: When refund has been finalized and completed by Payment Gateway, it's state should be updated to
refund_done
. - refund_failed: Refund failed.
- refund_rejected: Refund rejected by Payment Gateway.
- refund_disputed: Refund disputed.