CheckOut Services icon

CheckOut Services

As stated previously, we have two ways of authorizing a payment. Either you use the simple One-Step Authorization, that approves the payment based on the shopping basket (e.g. OrderValue, VAT), the consumer (e.g. Name, Address) and which AfterPay Payment Option is chosen (e.g. 14-day invoice, consolidated invoice, fixed instalments or flex payment). Or you use the Two-Step Authorization that lets you evaluate which payment options shall be presented based on the shopping basket (e.g. OrderValue, VAT) and the consumer (e.g. Name, Address).

One-step Authorize

One-Step Authorization is for merchants that have only one valid payment method type in checkout. The customer is offered the payment option that the merchant uses and after the selection, a check is done to find out if this payment option is applicable to the customer depending on his credit scores. The AfterPay offered payment method for this merchant will always be the same and only an Authorize Payment Request is sent.

Two-step Authorize

Two-Step Authorization uses information supplied to identify the customer and display the payment methods that are available based on customer characteristics, the content of the basket and AfterPay's risk and fraud scoring. This is the preferred way of authorization in the Nordics.

One-Step Authorization using 14-day Invoice

The easiest and most convenient way to approve a payment is to use the authorize endpoint.

The most common terms of payment are within 14 days after the purchase, which gives shoppers enough time to experience the goods before paying. The full purchase amount is to be paid by the due date.
For more detailed information about this payment type, visit the AfterPay Basics page.


NOTE! This use-case is meant for merchants who have made a contract with AfterPay and use prearranged payment options. If you want to present the available payment options for a specific customer first, use the two-step authorize use-case.


Preconditions

We have a customer, who is shopping the web for two black tablets and one black music player.
The customer 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 authorize.

  • Order Items and Proceed
  • Authorize Request

Step 1 - Authorize Payment

Step 1.1 - Creating an AuthorizePaymentRequest

The merchant gathers customer and order information into an AuthorizePaymentRequest. Then, sends it to Authorize endpoint for validation.

NOTE! The merchant has chosen the payment method (Invoice) for the customer.


Important variables in this request

payment
object
required
type
enum
required

The payment object with the payment type is always required. Since this is an One-Step Authorize, the merchant chooses the appropriate option for the customer.

customer
object
required

Since this is an One-Step Authorize, the customer object must be defined. Otherwise, AfterPay couldn't evaluate customer's eligibility for credit.

order
object
required

Since this is an One-Step Authorize, the order object must be defined. Otherwise, it would be impossible to manage refunds/voids for the customer later.
Some important fields for Order object:

  • order number, which is specified by the merchant
  • totalGrossAmount, which has to match the SUM of the individual items (grossUnitPrice * quantity)
  • totalNetAmount of the order
  • OrderItem and OrderRisk objects

NOTE! If the provided address doesn't match with the address that was returned in the response, then the merchant has to update the address. Otherwise, AfterPay will not take any risk for the transaction.

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

{
  "payment": {
    "type": "Invoice",
    "directDebit": {
      "bankCode": "GENODEM1GTL",
      "bankAccount": "DE20478601250040154100"
    }
  },
  "customer": {
    "customerNumber": "507885685",
    "salutation": "Mr",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "mobilePhone": "01234567",
    "birthDate": "1954-12-24T00:00:00Z",
    "customerCategory": "Person",
    "address": {
      "street": "Gütersloher Str.",
      "streetNumber": "123",
      "postalCode": "33415",
      "postalPlace": "Verl",
      "countryCode": "DE"
    },
    "riskData": {
      "existingCustomer": true,
      "verifiedCustomerIdentification": true,
      "marketingOptIn": true,
      "customerSince": "2017-01-01T00:00:00Z",
      "customerClassification": "Gold",
      "acquisitionChannel": "SearchEngine",
      "hasCustomerCard": true,
      "customerCardSince": "2017-01-01T00:00:00Z",
      "customerCardClassification": "1",
      "profileTrackingId": "78987657",
      "ipAddress": "100.100.100.100",
      "numberOfTransactions": 7,
      "customerIndividualScore": "1"
    },
    "conversationLanguage": "DE"
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 810.00,
    "totalGrossAmount": 1000.00,
    "risk": {
      "channelType": "Internet",
      "deliveryType": "Normal"
    },
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 324.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 19.0,
        "vatAmount": 76.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 162.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 19.0,
        "vatAmount": 38.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885686",
    "salutation": "Mr",
    "firstName": "Max",
    "lastName": "Mustermann",
    "email": "max.mustermann@example.com",
    "mobilePhone": "0123452323",
    "birthDate": "1962-06-26T00:00:00Z",
    "customerCategory": "Person",
    "address": {
      "street": "Weyringergasse Str",
      "streetNumber": "1",
      "postalCode": "1040",
      "postalPlace": "Vienna",
      "countryCode": "AT"
    },
    "conversationLanguage": "EN"
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 800.00,
    "totalGrossAmount": 1000.00,
    "risk": {
      "deliveryType": "Normal"
    },
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 320.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 20.0,
        "vatAmount": 80.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 160.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 20.0,
        "vatAmount": 40.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885687",
    "salutation": "Mr",
    "firstName": "Max",
    "lastName": "Mustermann",
    "email": "max.mustermann@example.com",
    "mobilePhone": "0123452323",
    "customerCategory": "Person",
    "address": {
      "street": "Alte Steinhauserstrasse",
      "streetNumber": "10",
      "postalCode": "CH-6330",
      "postalPlace": "Cham",
      "countryCode": "CH"
    },
    "conversationLanguage": "EN"
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 923.00,
    "totalGrossAmount": 1000.00,
    "risk": {
      "deliveryType": "Normal"
    },
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 369.2,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 7.7,
        "vatAmount": 30.8,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 184.6,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 7.7,
        "vatAmount": 15.4,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885683",
    "identificationNumber": "080470-0247",
    "firstName": "Antti",
    "lastName": "Virtanen",
    "email": "antti.virtanen@example.com",
    "mobilePhone": "09 123 456",
    "birthDate": "1989-11-20T00:00:00Z",
    "customerCategory": "Person",
    "address": {
      "street": "Kaisaniemenkatu 13A",
      "postalCode": "00101",
      "postalPlace": "Helsinki",
      "countryCode": "FI"
    }
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 760.00,
    "totalGrossAmount": 1000.00,
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 304.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 24.0,
        "vatAmount": 96.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 152.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 24.0,
        "vatAmount": 48.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885682",
    "identificationNumber": "6103213499",
    "firstName": "Andreas",
    "lastName": "Johansson",
    "email": "andreas.johansson@example.com",
    "mobilePhone": "0703112233",
    "customerCategory": "Person",
    "address": {
      "street": "Kungsgatan",
      "streetNumber": "20",
      "postalCode": "111 22",
      "postalPlace": "Stockholm",
      "countryCode": "SE"
    },
    "conversationLanguage": "SE"
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 760.00,
    "totalGrossAmount": 1000.00,
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 300.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 25.0,
        "vatAmount": 100.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 150.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 25.0,
        "vatAmount": 50.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885684",
    "identificationNumber": "2610841349",
    "firstName": "William",
    "lastName": "Jensen",
    "email": "william.jensen@example.com",
    "birthDate": "1984-10-26T00:00:00Z",
    "customerCategory": "Person",
    "address": {
      "street": "Østbanegade",
      "streetNumber": "55",
      "postalCode": "2100",
      "postalPlace": "Kopenhagen",
      "countryCode": "DK"
    }
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 750.00,
    "totalGrossAmount": 1000.00,
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 300.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 25.0,
        "vatAmount": 100.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 150.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 25.0,
        "vatAmount": 50.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885688",
    "salutation": "Mr",
    "firstName": "Sem",
    "lastName": "Jansen",
    "email": "sem.jansen@example.com",
    "mobilePhone": "0648950123",
    "birthDate": "1985-11-28T00:00:00Z",
    "customerCategory": "Person",
    "address": {
      "street": "Hogehilweg",
      "streetNumber": "8",
      "streetNumberAdditional": "C",
      "postalCode": "1101 CC",
      "postalPlace": "Amsterdam-Zuidoost",
      "countryCode": "NL"
    },
    "riskData": {
      "ipAddress": "80.32.33.53"
    },
    "conversationLanguage": "NL"
  },
  "deliveryCustomer": {
    "salutation": "Mr",
    "firstName": "Sem",
    "lastName": "Jansen",
    "customerCategory": "Person",
    "address": {
      "street": "Hogehilweg",
      "streetNumber": "8",
      "streetNumberAdditional": "C",
      "postalCode": "1101 CC",
      "postalPlace": "Amsterdam-Zuidoost",
      "countryCode": "NL"
    }
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 790.00,
    "totalGrossAmount": 1000.00,
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 316.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 21.0,
        "vatAmount": 84.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 158.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 21.0,
        "vatAmount": 42.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885681",
    "identificationNumber": "10114000294",
    "firstName": "Jan",
    "lastName": "Hansen",
    "email": "jan.hansen@example.com",
    "customerCategory": "Person",
    "address": {
      "street": "Kongens gate 2",
      "postalCode": "0153",
      "postalPlace": "Oslo",
      "countryCode": "NO"
    },
    "conversationLanguage": "NO"
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 750.00,
    "totalGrossAmount": 1000.00,
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 300.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 25.0,
        "vatAmount": 100.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 150.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 25.0,
        "vatAmount": 50.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

{
  "payment": {
    "type": "Invoice"
  },
  "customer": {
    "customerNumber": "507885690",
    "salutation": "Mr",
    "firstName": "Thomas",
    "lastName": "Peeters",
    "email": "thomas.peeters@example.com",
    "mobilePhone": "412960123",
    "birthDate": "1987-10-18T00:00:00Z",
    "customerCategory": "Person",
    "address": {
      "street": "Hoge Wei",
      "streetNumber": "27",
      "postalCode": "B-1930",
      "postalPlace": "Zaventem",
      "countryCode": "BE"
    },
    "conversationLanguage": "NL"
  },
  "order": {
    "number": "ORDER000001",
    "totalNetAmount": 790.00,
    "totalGrossAmount": 1000.00,
    "items": [
      {
        "productId": "1",
        "description": "Tablet Black",
        "netUnitPrice": 316.00,
        "grossUnitPrice": 400.00,
        "quantity": 2.0,
        "vatPercent": 21.0,
        "vatAmount": 84.0,
        "imageUrl": "http://testbild.de/productimg.jpg"
      },
      {
        "productId": "2",
        "description": "MusicPlayer Black",
        "netUnitPrice": 158.00,
        "grossUnitPrice": 200.00,
        "quantity": 1.0,
        "vatPercent": 21.0,
        "vatAmount": 42.0,
        "imageUrl": "http://testbild.de/productimg2.jpg"
      }
    ]
  }
}

Step 1.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": {
    "CustomerNumber": "507885685",
    "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"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885686",
    "FirstName": "Max",
    "LastName": "Mustermann",
    "AddressList": [
      {
        "Street": "Weyringergasse Str.",
        "StreetNumber": "1",
        "PostalCode": "1040",
        "PostalPlace": "Vienna",
        "CountryCode": "AT"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885687",
    "FirstName": "Max",
    "LastName": "Mustermann",
    "AddressList": [
      {
        "Street": "Alte Steinhauserstrasse",
        "StreetNumber": "10",
        "PostalCode": "CH-6330",
        "PostalPlace": "Cham",
        "CountryCode": "CH"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885683",
    "FirstName": "Antti",
    "LastName": "Virtanen",
    "AddressList": [
      {
        "Street": "Kaisaniemenkatu 13A",
        "PostalCode": "00101",
        "PostalPlace": "Helsinki",
        "CountryCode": "FI"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885682",
    "FirstName": "Andreas",
    "LastName": "Johansson",
    "AddressList": [
      {
        "Street": "Kungsgatan",
        "StreetNumber": "20",
        "PostalCode": "111 22",
        "PostalPlace": "Stockholm",
        "CountryCode": "SE"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885684",
    "FirstName": "William",
    "LastName": "Jensen",
    "AddressList": [
      {
        "Street": "Østbanegade",
        "StreetNumber": "55",
        "PostalCode": "2100",
        "PostalPlace": "Kopenhagen",
        "CountryCode": "DK"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885688",
    "FirstName": "Sem",
    "LastName": "Jansen",
    "AddressList": [
      {
        "Street": "Hogehilweg",
        "StreetNumber": "8",
        "StreetNumberAdditional": "C",
        "PostalCode": "1101 CC",
        "PostalPlace": "Amsterdam-Zuidoost",
        "CountryCode": "NL"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885681",
    "FirstName": "Jan",
    "LastName": "Hansen",
    "AddressList": [
      {
        "Street": "Kongens gate 2",
        "PostalCode": "0153",
        "PostalPlace": "Oslo",
        "CountryCode": "NO"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}
                

{
  "Outcome": "Accepted",
  "Customer": {
    "CustomerNumber": "507885689",
    "FirstName": "Thomas",
    "LastName": "Peeters",
    "AddressList": [
      {
        "Street": "Hoge Wei",
        "StreetNumber": "27",
        "PostalCode": "B-1930",
        "PostalPlace": "Zaventem",
        "CountryCode": "BE"
      }
    ]
  },
  "ReservationId": "00000000-0000-0000-0000-000000000000",
  "CheckoutId": "00000000-0000-0000-0000-000000000000"
}