Cancel a Pending Order

DELETE /hosted/v1/orders/order_id

To cancel a pending order through the Hosted Payments API, submit a DELETE request as follows:

Request Example
curl -X DELETE \
       -u jTxL2wsNysJ8Jzmpdwim:NAA043a7c53c66ac3826c5e \
        https://api.test.netbanx.com/hosted/v1/orders/25TWPTLHRR81AIG1LF

It is possible to cancel an order only prior to it being processed. If an order has been processed or is "in flight", the cancel request will fail.

Assuming the cancellation request has been successfully processed, the following response will be returned:

Response Example
{
	"currencyCode" : "GBP",
	"extendedOptions" : [],
	"link" : [
		{
			"rel" : "self",
			"uri" : "https://jTxL2wsNysJ8Jzmpdwim:NAA043a7c53c66ac3826c5e@api.test.netbanx.com/hosted/v1/orders/25TWPTLHRR81AIG1LF"
		}
	],
	"merchantRefNum" : "ABCDE12345",
	"id" : "25TWPTLHRR81AIG1LF",
	"totalAmount" : 1000,
	"transaction" : {
		"amount" : 1000,
		"associatedTransactions" : [],
		"authType" : "purchase",
	"settled" : false,
		"currencyCode" : "GBP",
		"lastUpdate" : "2012-06-01T17:12:14",
		"merchantRefNum" : "ABCDE12345",
	"paymentType" : "card",
		"refunded" : false,
		"status" : "cancelled"
   }
}

The status parameter in the response contains the confirmation that the request has been cancelled.

If you attempt to cancel an order that has already been processed, the cancellation request will fail and you will need to submit a refund request.

Did you find this page useful?