The Checkout Object

The checkout object is the data payload that contains information about the customer's order. It is POSTed to the Affirm API to initialize Affirm checkout.

Attributes

Attribute

Data type

Description

merchant required

object

Merchant specific information. See merchant details.

shipping\ required*

object

The shipping details.

  • **Note:** The shipping object is only required for scenarios where goods are shipped. If you don't ship goods, such as if you're a travel merchant, contact support or your customer success manager to update your account configurations.

billing

object

The billing details. For more details, see Billing and Shipping Addresses.

store

object

Address details for in-store transactions.

items\ required

Array

An array of item.

discounts

object

A list of discounts. Each discount must have their discount code.

metadata

object

See metadata details.

order_id

string

The merchant order id. This is stored for your own future reference.

currency\ required

string

Three-letter ISO currency code in uppercase.

Possible values:

  • USD
  • CAD
  • GBP

financing_program

string

A financing program applied on this checkout.

shipping_amount

integer

The total shipping amount in cents. A positive integer representing how much, in USD or CAD cents (e.g., 100 cents to charge $1.00).

tax_amount

integer

The total tax amount in cents. A positive integer representing how much, in USD or CAD cents (e.g., 100 cents to charge $1.00).

total\ required

integer

The total amount of the checkout in USD or CAD cents (e.g., 100 cents to charge $1.00).

checkout_expiration

timestamp

A date-timestamp of when the checkout_id will expire. - ISO timestamp format - No milliseconds

expiration_time

timestamp

If set, this defines a time-to-live (TTL) deadline for the checkout. The checkout must be confirmed before this timestamp. Any confirmation attempt after the TTL expires will be rejected.

🚧

Public API Key

Please note that the public_api_key is required for checkout and store endpoints and must be included in the checkout object.

{
   "merchant":{
      "user_confirmation_url":"https://merchantsite.com/confirm",
      "user_cancel_url":"https://merchantsite.com/cancel",
      "public_api_key": "{YOUR PUBLIC_API_KEY}",
      "user_confirmation_url_action":"POST",
      "use_vcn": false,
      "name":"Your Customer-Facing Merchant Name"
   },
   "shipping":{
      "name":{
         "full":"John Doe"
      },
      "address":{
         "line1":"633 Folsom St",
         "city":"San Francisco",
         "state":"CA",
         "zipcode":"94107",
         "country":"US"
      },
      "phone_number":"1235555555",
      "email":"[email protected]"
   },
   "billing":{
      "name":{
         "full":"John Doe"
      },
      "address":{
         "line1":"633 Folsom St",
         "city":"San Francisco",
         "state":"CA",
         "zipcode":"94107",
         "country":"US"
      },
      "phone_number":"1235555555",
      "email":"[email protected]"
   },
   "items":[
      {
         "display_name":"Awesome Pants",
         "sku":"ABC-123",
         "unit_price":10000,
         "qty":3,
         "item_image_url":"http://merchantsite.com/images/awesome-pants.jpg",
         "item_url":"http://merchantsite.com/products/awesome-pants.html"
      }
   ],
   "discounts":{
      "RETURN5":{
         "discount_amount":500,
         "discount_display_name":"Returning customer 5% discount"
      },
      "PRESDAY10":{
         "discount_amount":1000,
         "discount_display_name":"President's Day 10% off"
      }
   },
   "metadata":{
      "shipping_type":"UPS Ground",
      "mode":"modal"
   },
   "order_id":"JKLMO4321",
   "currency":"USD",  
   "financing_program":"fp_3z6r12r",
   "shipping_amount":10000,
   "tax_amount":600,
   "total":39100
}