Two-Step Authorization

This case is intended for merchants, who want to give the customer the option to choose their preferred payment option. Currently, available options are:
  • Invoice
  • Account
  • Installment
  • Consolidatedinvoice

This is the preferred way of authorization in the Nordics and in cooperate the lookup functionality.

Preconditions

We have a customer named John. He is shopping the web for two black tablets and one black music player.
John creates an order and enters his personal data. He adds two black tablets (400 euros each) and one black music player (200 euros each) to cart and proceeds to choose a payment method.

  • Order Items and Proceed
  • Available Payment Methods

Step 1 - Available Payment Methods

Step 1.1 - Request with customer details

Use this case, if you want John to enter his extensive personal details. The merchant gathers John's customer and order information into an AvailablePaymentMethodsRequest. Then, sends it to Available endpoint for validation.

Important variables in this request

customer
object
required

Available payment methods are calculated via a thorough analysis of the customer credit rating. To do that effectively, customer fields are required.

order
object
optional

The order is required either in AvailablePaymentMethodsRequest or in the later step, AuthorizePaymentRequest. In this example, we have already defined the order. Some important fields to note:

  • order number, which is specified by the merchant
  • totalGrossAmount in order details, which has to match the amount in the AvailablePaymentMethodsRequest object
  • currency, which has to match the currency in the AvailablePaymentMethodsRequest object
  • order items - the items grossUnitPrice x quantity has to match the totalGrossAmount
For more detailed information about this request, visit the Payment's API Documentation.

{
  "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": 1000.00,
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

Step 1.2 - AfterPay's response

AfterPay's response consists of checkoutId, outcome and a list of all available payment methods for John.

Important variables in this response

checkoutId
string

checkoutId is required when creating an AuthorizePaymentRequest and serves as an unique identificator for step 5.

paymentMethods
List(paymentMethod)

paymentMethods is a list of all possible payment options for John.

For more detailed information about this response, visit the Payment's API Documentation.

Johns Choice

The merchant lists all available payment options for John. John, after thorough consideration, chooses Invoice.


{
  "CheckoutId": "00000000-0000-0000-0000-000000000000",
  "Outcome": "Accepted",
  "Customer": {
    "FirstName": "John",
    "LastName": "Doe",
    "AddressList": [
      {
        "Street": "Gütersloher Str.",
        "StreetNumber": "123",
        "PostalCode": "33415",
        "PostalPlace": "Verl",
        "CountryCode": "DE"
      }
    ]
  },
  "PaymentMethods": [
    {
      "Type": "Invoice"
    },
    {
      "Type": "Installment",
      "DirectDebit": {
        "Available": true
      }
    }
  ],
  "AdditionalResponseInfo": {
    "rsS_RiskCheck_ResultCode": "SCR000"
  }
}

Step 2 - Authorize Payment

Step 2.1 - Creating an AuthorizePaymentRequest

The merchant now creates an AuthorizePaymentRequest, filling in only checkoutId and payment with payment type. Then sends it to the Authorize endpoint for validation.

Important variables in this request

checkoutId
string
required

This is the same checkoutId, which was the response of AvailablePaymentMethodsRequest. It is important to use the same one because it already has John's order and customer objects attached.

payment
object
required
type
enum
required

In the previous step, John chose 'Invoice'.

For more detailed information about this request, visit the Payment's API Documentation.

{
  "CheckoutId": "00000000-0000-0000-0000-000000000000",
  "Payment": {
    "Type": "Invoice",
    "ContractId": "00000000-0000-0000-0000-000000000000"
  }
}
                

Step 2.2 - AfterPay's response

In case of successful request (Status 200 "OK"), the response consists of an Outcome result (Accepted, Pending, Rejected).

NOTE! If the response is not successful, here are common error codes.

{
  "Outcome": "Accepted",
  "Customer": {
    "FirstName": "John",
    "LastName": "Doe",
    "AddressList": [
      {
        "Street": "Gütersloher Str.",
        "StreetNumber": "123",
        "PostalCode": "33415",
        "PostalPlace": "Verl",
        "CountryCode": "DE"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}