Refund

Astrid has received her shipment, and has decided that the jacket in size M looks better on her. She uses the original packaging to send the size S jacket back to the merchant. Then she goes to MyAfterPay.com and uses the “Report a Return” feature. The merchant is notified to expect a return of the jacket.

The merchant receives the jacket, sees that it is in great condition and still has the tags attached. The refund is accepted, and the merchant issues a REFUND call from their webshop to the AfterPay eCom API. Astrid’s invoice is updated, and the cost of the jacket is deducted from the total; she only has to pay for the items she kept.

This is a POST call to the REFUND endpoint of the AfterPay eCommerce API. Embedded in the URL is the Order.Number from the AUTHORIZE and CAPTURES calls.

The API call contains the following blocks:

Capture Number

This is the unique ID that was provided in the response to the CAPTURES call. This tells AfterPay where to debit the money (from the merchant’s settlement account, and the specific transaction) that will be credited to the customer.

Order Items

This contains the same information as the AUTHORIZE (and/or CAPTURES) call, for the product(s) being refunded.

In this example, we are doing a Partial Refund – refunding only one order item out of many.

If we send the POST call to the REFUND endpoint with nothing in the body, we will be making a Full Refund – refunding all order items.

You can do multiple Partial Refunds within the same order. You can also do a Full Refund after a Partial Refund – refunding all items that were not refunded before.

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


{
  "captureNumber": "800001138",
  "orderItems": [
    {
      "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"
    }
  ]
}
                    

RESPONSE from eCom API


{
  "totalCapturedAmount": 2085.00,
  "totalAuthorizedAmount": 2085.00,
  "refundNumbers": [
    "800001139"
  ]
}