Create API to Initiate Refund Session
The initiateRefundSession API initiates or creates a refund session for a particular transaction. This API is triggered by a microservice and directed to the Payment Extension’s endpoint to process the refund request. Before proceeding, the Payment Extension must validate the checksum_auth
in the headers to ensure the authenticity and integrity of the request.
- Endpoint: POST/api/v1/payment_session/{gid}
Request
In the below given example request, the API request contains details such as the transaction identifier (gid
), refund amount, currency, and payment mode. The Payment Extension is responsible for forwarding this request to the PG and tracking its status until completion. Once the request is received and validated, the Payment Extension processes the refund by interacting with the respective PG.
{
"gid": "TR661CED900E91E14001",
"object": "refund",
"request_id": "17066802422601819004",
"amount": "79",
"currency": "INR",
"status": "initiate",
"meta": {
"payment_mode": "CARD"
}
}
Response
In the below given example response, the response from the initiateRefundSession API provides the status and details of the refund session initiated by Fynd Commerce. After the Payment Extension processes the refund request, it returns information regarding the refund’s progress, including the amount being refunded, the currency in which the refund is being processed, and the unique request_id
associated with the refund. The refund process has been initiated but has not yet been completed.
In addition to these details, the response includes the gid
, which refers to the original payment transaction, ensuring that the refund is correctly associated with the corresponding payment. This response allows Fynd Commerce to track and update the refund process, providing real-time status information to the customer and seller.
{
"aggregator_payment_refund_details": {
"amount": 10000,
"currency": "INR",
"request_id": "17066802422601819004",
"status": "started"
},
"gid": "TR661CED900E91E14001"
}