Void (Cancellation)

Based on the example of the API Walkthrough and Partial Capture, let’s take a common scenario:

The merchant has not shipped the socks that Astrid bought. He thought that he would get them in stock soon, but as it turns out, his supplier has stopped producing them. He sends an email to Astrid to apologize.

Fortunately, since he did not Capture the socks yet, Astrid does not have to pay anything or wait for a refund.

The merchant sends a Void / Cancellation call for the unavailable item. This is a POST call to the VOIDS endpoint of the AfterPay eCommerce API. It contains the total price of all the items being cancelled, and the individual item details (same format as in the Authorize call).

The response contains the following information:

  • Total Captured Amount – the sum of all Captures on this order so far.
  • Total Authorized Amount – the full order value, as originally submitted during the Authorize call.

See our detailed API documentation for more.

This example is a Partial Void. You can also send the POST call to the VOIDS endpoint with the Order Number, but nothing in the body. In that case, all items that were authorized but not captured or previously voided, will now be voided.

POST https://sandbox.afterpay.io/api/v3/orders/{orderNumber}/voids

  "cancellationDetails": {
    "totalGrossAmount": 1000.00,
    "items": [
        "productId": "0001-BLK-S",
        "description": "Leather jacket, Black, size S",
        "grossUnitPrice": 1000.00,
        "quantity": 1.00,
        "vatPercent": 20.00,
        "imageUrl": "https://cdn.afterpay.io/dev-portal/images/black_leather_jacket.jpg",
        "lineNumber": 1


  "TotalCapturedAmount": 0.00,
  "TotalAuthorizedAmount": 2085.00