Annull order

Annull an order for a specific merchant.

This operation enables you to:

  • Annull a specefic order

When you annull an order you send which orderId it refers to and the below attributes:

  • type: type of transaction (ANNULL)
  • amount: amount on transaction, in order currency. If it is equal to residual order amount, order will be closed implicitly. 
  • transactionReference: merchant’s transaction reference. If supplied, will be returned as transactionReference when requesting balance transactions. 
  • rows: rows on this order
  • message: message to consumer if the payment method allows it

1. Create annull transaction

To annull a specific order you have to send the above attributes,  via a server-side call to our REST API. You’ll find the complete REST API reference here.

POST /v1/orders/<orderId>/transactions

x-api-key: njdfdsdkjfl5598503mnfkfe
x-merchant-key: 86969769
Content-Type: application/json

{
  "type":"ANNULL",
  "amount":15000,
  "transactionReference":"transRef100",
  "message":"TestMessage",
  "rows":[
    {
      "name":"Vit T-shirt",
      "quantity":1.0,  
      "unitAmount":15000,
      "vatRate":2500,
      "partNumber":"00012",
      "description":"Bomull vit",
      "unit":"st",
      "discountAmount":0,
      "serials":[],
      "fee":false,
      "provided":false
    }
  ]
}

2. Handle response

The response will either be OK or an error code.

The response contains following information:

  • orderStatus:  status on order, after transaction has been created
  • transaction: the created transaction
  • message: message to consumer if the payment method allows it
  • merchantId: 

 You can see all Ecster's custom objects here

Below you have an example of the response from the request obove.

Status: 201 Created

{
    "orderStatus": "ANNULLED",
    "transaction": {
        "id": "WVJAGSdOx6AlQEbByU9N",
        "transactionReference": "transRef100",
        "type": "ANNUL",
        "created": "2018-12-16T21:15:59+01:00",
        "amount": 0,
        "rows": [
            {
                "name": "Vit T-shirt",
                "quantity": 1,
                "unitAmount": 15000,
                "vatRate": 2500,
                "partNumber": "00012",
                "description": "Bomull vit",
                "unit": "st",
                "discountAmount": 0,
                "serials": [],
                "fee": false
            }
        ],
        "message": "TestMessage",
        "merchantId": "69260825"
    }
}
Request test account