Refund

Summary

Refunds a partially or fully captured payment.

Resource URL /api/v3/orders/{orderNumber}/refunds
HTTP method POST
Content type application/json; charset=utf-8

Input parameters

Parameter name Location Type / Model Description
orderNumber Path required
Order number
request Body RefundOrderRequest optional
Request object

Responses

HTTP status code Model Comment
OK(200) RefundOrderResponse Refund order response
BadRequest (400) array of ResponseMessage Request failed. Check response model for list of Errors.
Unauthorized (401) API user is unauthorized. Make sure X-Auth-Key header is sent.
InternalServerError (500) Request failed due internal error. Retry request later.

Examples

{
  "captureNumber": "000000001",
  "orderItems": [
    {
      "productId": "0001",
      "groupId": "0011",
      "description": "Item 1 description",
      "netUnitPrice": 10.00,
      "grossUnitPrice": 12.00,
      "quantity": 5.0,
      "vatCategory": "MiddleCategory",
      "vatPercent": 20.00,
      "vatAmount": 2.00,
      "lineNumber": 1
    }
  ]
}
{
  "totalCapturedAmount": 300.00,
  "totalAuthorizedAmount": 300.00,
  "refundNumbers": [
    "000000002"
  ]
}
var AfterPayApi = require("./afterPay.js");
var apiKeyAuthentication = require("./api_key_filter");

var key = 'CHANGE_ME';
var client = new AfterPayApi().addFilter(apiKeyAuthentication.create(key));
var request = {
  "captureNumber": "000000001",
  "orderItems": [
    {
      "productId": "0001",
      "groupId": "0011",
      "description": "Item 1 description",
      "netUnitPrice": 10.00,
      "grossUnitPrice": 12.00,
      "quantity": 5.0,
      "vatCategory": "MiddleCategory",
      "vatPercent": 20.00,
      "vatAmount": 2.00,
      "lineNumber": 1
    }
  ]
};

client.OrderManagement.refund(orderNumber, request, 
  function(err, response, httpRequest, httpResponse) {
  });
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'after_pay.rb'
require 'json'

client = AfterPayApi::AfterPay.new(AfterPayApi::ApiKeyCredentials.new('YOUR_API_KEY'))

requestAsJson = '{"captureNumber":"000000001","orderItems":[{"productId":"0001","groupId":"0011","description":"Item 1 description","netUnitPrice":10.00,"grossUnitPrice":12.00,"quantity":5.0,"vatCategory":"MiddleCategory","vatPercent":20.00,"vatAmount":2.00,"lineNumber":1}]}'
request = AfterPayApi::Models::RefundOrderRequest.deserialize_object(JSON.parse(requestAsJson))


client.orderManagement.refund_async(orderNumber, request).then{|response|

}.execute.wait
var key = "CHANGE_ME";
var client = new OrderManagementApi(new Configuration() { DefaultHeader = new Dictionary<string, string>() { { "X-Auth-Key", key} } });

var request = new RefundRequest(){
  CaptureNumber = "000000001",
  OrderItems = new List<RefundOrderItem> {
  new RefundOrderItem() {
      ProductId = "0001",
      GroupId = "0011",
      Description = "Item 1 description",
      NetUnitPrice = 10.00,
      GrossUnitPrice = 12.00,
      Quantity = 5,
      VatCategory = VatCategory.MiddleCategory,
      VatPercent = 20.00,
      VatAmount = 2.00,
      LineNumber = 1
    },
  }
};

var responce = client.OrderManagementRefund(orderNumber, request);