AuthorizePayment

Summary

Approves the payment for a specified customer and basket. Main use-cases are One-Step and Two-Step Authorization. Full fraud and credit scoring applied. If the online-shop customer enter the incorrect address data, the system delivers a suggestion for a corrected address.

Resource URL /api/v3/checkout/authorize
HTTP method POST
Content type application/json; charset=utf-8

Input parameters

Parameter name Location Type / Model Description
request Body AuthorizePaymentRequest required

Responses

HTTP status code Model Comment
OK(200) AuthorizePaymentResponse Authorize Payment 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

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "salutation": "Mr",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com",
    "customerCategory": "Person",
    "address": {
      "street": "Gütersloher Str.",
      "streetNumber": "123",
      "postalCode": "33415",
      "postalPlace": "Verl",
      "countryCode": "DE"
    },
    "conversationLanguage": "EN"
  },
  "order": {
    "number": "ORDER000001",
    "totalGrossAmount": 100.00,
    "currency": "EUR",
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "grossUnitPrice": 40.00,
        "quantity": 2.0
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "grossUnitPrice": 20.00,
        "quantity": 1.0
      }
    ]
  }
}
{
  "customer": {
    "customerNumber": "000000001",
    "firstName": "John",
    "lastName": "Doe",
    "addressList": [
      {
        "street": "Gütersloher Str.",
        "streetNumber": "123",
        "postalCode": "33415",
        "postalPlace": "Verl",
        "countryCode": "DE"
      }
    ]
  },
  "reservationId": "57b82a6f-a21b-44ae-974e-827a6f0d4011",
  "checkoutId": "d1244b02-a7ff-415f-8a97-217573b4e1b3"
}
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 = {
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "salutation": "Mr",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@mail.com",
    "customerCategory": "Person",
    "address": {
      "street": "Gütersloher Str.",
      "streetNumber": "123",
      "postalCode": "33415",
      "postalPlace": "Verl",
      "countryCode": "DE"
    },
    "conversationLanguage": "EN"
  },
  "order": {
    "number": "ORDER000001",
    "totalGrossAmount": 100.00,
    "currency": "EUR",
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "grossUnitPrice": 40.00,
        "quantity": 2.0
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "grossUnitPrice": 20.00,
        "quantity": 1.0
      }
    ]
  }
};

client.Checkout.authorizePayment(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 = '{"payment":{"type":"Invoice"},"customer":{"salutation":"Mr","firstName":"John","lastName":"Doe","email":"john.doe@mail.com","customerCategory":"Person","address":{"street":"Gütersloher Str.","streetNumber":"123","postalCode":"33415","postalPlace":"Verl","countryCode":"DE"},"conversationLanguage":"EN"},"order":{"number":"ORDER000001","totalGrossAmount":100.00,"currency":"EUR","items":[{"productId":"1","description":"Tablet Black","grossUnitPrice":40.00,"quantity":2.0},{"productId":"2","description":"MusicPlayer Black","grossUnitPrice":20.00,"quantity":1.0}]}}'
request = AfterPayApi::Models::AuthorizePaymentRequest.deserialize_object(JSON.parse(requestAsJson))


client.checkout.authorizePayment_async(request).then{|response|

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

var request = new AuthorizePaymentRequest(){
  Payment = new Payment() {
    Type = PaymentMethodType.Invoice
  },
  Customer = new CheckoutCustomer() {
    Salutation = Salutation.Mr,
    FirstName = "John",
    LastName = "Doe",
    Email = "john.doe@mail.com",
    CustomerCategory = CustomerCategory.Person,
    Address = new Address() {
      Street = "Gütersloher Str.",
      StreetNumber = "123",
      PostalCode = "33415",
      PostalPlace = "Verl",
      CountryCode = CountryCode.DE
    },
    ConversationLanguage = LanguageCode.EN
  },
  Order = new Order() {
    Number = "ORDER000001",
    TotalGrossAmount = 100.00,
    Currency = "EUR",
    Items = new List<OrderItem> {
    new OrderItem() {
        ProductId = "1",
        Description = "Tablet Black",
        GrossUnitPrice = 40.00,
        Quantity = 2
      },
    new OrderItem() {
        ProductId = "2",
        Description = "MusicPlayer Black",
        GrossUnitPrice = 20.00,
        Quantity = 1
      },
    }
  }
};

var responce = client.CheckoutAuthorizePayment(request);