Capture

Summary

Completes the payment that has been authorized. Typically done when the order is shipped. Can be a full or partial capture of the order amount.

Resource URL /api/v3/orders/{orderNumber}/captures
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 CaptureRequest optional
Request object

Responses

HTTP status code Model Comment
OK(200) CaptureResponse Capture 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

{
  "orderDetails": {
    "totalNetAmount": 50.00,
    "totalGrossAmount": 60.00,
    "currency": "EUR",
    "items": [
      {
        "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
      }
    ]
  }
}
{
  "capturedAmount": 60.00,
  "authorizedAmount": 300.00,
  "remainingAuthorizedAmount": 240.00,
  "captureNumber": "000000001"
}
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 = {
  "orderDetails": {
    "totalNetAmount": 50.00,
    "totalGrossAmount": 60.00,
    "currency": "EUR",
    "items": [
      {
        "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.capture(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 = '{"orderDetails":{"totalNetAmount":50.00,"totalGrossAmount":60.00,"currency":"EUR","items":[{"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::CaptureRequest.deserialize_object(JSON.parse(requestAsJson))


client.orderManagement.capture_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 CaptureRequest(){
  OrderDetails = new OrderSummary() {
    TotalNetAmount = 50.00,
    TotalGrossAmount = 60.00,
    Currency = "EUR",
    Items = new List<OrderItem> {
    new OrderItem() {
        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.OrderManagementCapture(orderNumber, request);