Cancel Order

Cancel on order for which payment has been initiated

You can use the Cancel Order API to initiate a request to cancel an order that has been initiated.

🚧

You can cancel an order only if you have executed the Cancel Order API call either after the Initiate Authentication API call or the Authenticate Payer API call.

Trying the execute the Cancel Order API call after the Pay API call will not cancel the order. This attempt returns a response with the message "Order is already completed".

πŸ“˜

Merchants can present the Cancel payment option to their customers by implementing the Cancel Order API through the Cancel Payment button on their portals. Please note this option must be made available only for payments for which Pay API is not executed.

To initiate a Cancel Order API call, you will need to provide the following required fields.

ParameterDatatypeDescription
orderIdstringThis is a unique identifier for this order to discern it from the other orders you created. If orderId is not sent with the request, an orderId is created by the server and returned in the response. The orderid can be used to refer to this order in subsequent transactions and in retrieving metadata about the order. The orderId must always be unique for every order created under your merchant profile. This must be a valid GUID.

You can find a complete list of parameters which can be used with the Cancel Order API here.

Below is an example of executing a Cancel Order API call with the mandatory parameters.

curl --location 'https://api.merchant.geidea.net/pgw/api/v1/direct/cancel' \
--header 'accept: text/plain' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YTA4N2Y0Y2EtOTg5MC00MDdiLTljMmYtNzYzMDgzNmNjMDIwOmRmMGZjNjg3LTc4M2ItNDA1OC1hZjYzLTllODc2NDQ0YjM1Nw==' \
--data '{
    "orderId": "ddaf3eb8-645e-43d3-99ef-08db103ef12c"
}'
{
    "orderId": "c64d3090-2531-454a-5dca-08db15bcae4b",
    "responseMessage": "Cancelled",
    "detailedResponseMessage": "Order cancelled by user",
    "language": "en",
    "responseCode": "010",
    "detailedResponseCode": "001"
}

API Response

The parameters sent in the API response are as follows:

ParameterDescription
orderIdThis is a unique identifier for this order to discern it from the other orders you created. This value is echoed from the request.
responseMessageDetailed message associated with response from gateway
detailedResponseMessageMessage associated with response from gateway
languageLanguage used for API request
responseCodeCode associated with response message returned by the gateway
detailedResponseCodeDetailed Code associated with response message returned by the gateway