Create API to Get Payment Status
The getPaymentStatus API needs to be developed to retrieve the current status and details of a payment session or transaction. By using the gid
, the platform tracks whether a payment has been successfully processed, is still pending, or has failed. This API ensures that payment transactions are accurately recorded and updated in the system, preventing discrepancies in order and payment records.
- Endpoint: GET/api/v1/payment_session/{gid}
Response
In the below given example response, it is shown that the getPaymentStatus API is utilized by Fynd Commerce to retrieve the current status and details of a payment session or transaction by using the gid
.
When Fynd Commerce calls this API, the Payment Extension first validates the order_checksum_auth
to ensure data security and authenticity before processing the request. Once validated, the extension responds with the latest payment status along with relevant transaction details. This response helps the platform maintain accurate records of payment states and ensures proper reconciliation of transactions.
Additionally, Fynd Commerce uses this API in scheduled background tasks (cron jobs) to periodically check and update payment statuses for transactions where updates were missed. This automation reduces discrepancies, enhances payment tracking, and improves order management.
{
"payments": [
{
"aggregator_transaction_id": "hpp_vqrUEvucg001",
"amount": 10000,
"amount_captured": 10000,
"amount_refunded": 0,
"currency": "INR",
"fynd_platform_id": "FY662F91410E0BCBD001",
"g_user_id": "65fc3a26b7e85bd44752641a",
"gid": "TR662637B30D570001",
"kind": "sale",
"payment_methods": [
{
"code": "TABBY",
"name": "TABBY",
"sub_payment_mode": [
{
"code": "CARD",
"name": "CARD"
}
]
}
],
"status": "started"
}
]
}