---
updatedAt: 2025-11-13T14:11:21.000Z
agentTools:
  siteIndex: https://docs.affirm.com/llms.txt
  projectIndex: https://docs.affirm.com/developers/llms.txt
---

# Configure the Checkout Object

```javascript Checkout Object
const checkoutObject = {
  merchant: {
    user_confirmation_url: 'https://merchantsite.com/confirm',
    user_cancel_url: 'https://merchantsite.com/cancel',
    user_confirmation_url_action: 'POST',
    name: 'Your Customer-Facing Merchant Name',
  },
  shipping: {
    name: {
      first: 'Joe',
      last: 'Doe',
    },
    address: {
      street1: '633 Folsom St',
      street2: 'Floor 7',
      city: 'San Francisco',
      state: 'CA',
      zipcode: '94107',
      country: 'USA',
    },
    phone_number: '1235555555',
    email: 'joedoe@123fakedomain.com',
  },
  billing: {
    name: {
      first: 'Joe',
      last: 'Doe',
    },
    address: {
      street1: '633 Folsom St',
      street2: 'Floor 7',
      city: 'San Francisco',
      state: 'CA',
      zipcode: '94107',
      country: 'USA',
    },
    phone_number: '1235555555',
    email: 'joedoe@123fakedomain.com',
  },
  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',
      categories: [
        ['Apparel', 'Pants'],
        ['Mens', 'Apparel', 'Pants'],
      ],
    },
  ],
  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: 'zero_pct_promo',
  shipping_amount: 1000,
  tax_amount: 600,
  total: 30100,
};

affirm.checkout.open(checkoutObject)
```

```javascript VCN Checkout Object
const checkoutObject = {
  merchant: {
    user_confirmation_url: 'https://merchantsite.com/confirm',
    user_cancel_url: 'https://merchantsite.com/cancel',
    user_confirmation_url_action: 'POST',
    name: 'Your Customer-Facing Merchant Name',
    use_vcn: true,
  },
  shipping: {
    name: {
      first: 'Joe',
      last: 'Doe',
    },
    address: {
      street1: '633 Folsom St',
      street2: 'Floor 7',
      city: 'San Francisco',
      state: 'CA',
      zipcode: '94107',
      country: 'USA',
    },
    phone_number: '4153334567',
    email: 'joedoe@123fakedomain.com',
  },
  billing: {
    name: {
      first: 'Joe',
      last: 'Doe',
    },
    address: {
      street1: '633 Folsom St',
      street2: 'Floor 7',
      city: 'San Francisco',
      state: 'CA',
      zipcode: '94107',
      country: 'USA',
    },
    phone_number: '4153334567',
    email: 'joedoe@123fakedomain.com',
  },
  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',
      categories: [
        ['Apparel', 'Pants'],
        ['Mens', 'Apparel', 'Pants'],
      ],
    },
  ],
  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: 'zero_pct_promo',
  shipping_amount: 1000,
  tax_amount: 600,
  total: 30100,
};

affirm.checkout.open_vcn(checkoutObject)
```

```json Response Example
{"success":true}
```

# Call the `affirm.checkout()` function

<!-- javascript@1,76 -->
<!-- javascript@1,77 -->

Call `affirm.checkout()` function to initialize the Affirm application when the customer selects Affirm at checkout.

# Configure the Merchant Object

<!-- javascript@2-7 -->
<!-- javascript@2-8 -->

The Merchant object contains the success and failure callbacks. Here, you'll define the following:
* `user_confirmation_url`: Redirects your customer to your confirmation page
* `user_cancel_url`: Redirects your customer 
to a cancellation page if they choose to cancel the application process. 
* `user_confirmation_url_action`: Defines if Affirm sends the HTTP request via GET or POST. 
This information is <span style="color:red">required</span>.

# Configure the Shipping Object

<!-- javascript@8-23 -->
<!-- javascript@9-13 -->

Contains the customer's shipping information including their name, address, phone number, and email. 
This information is <span style="color:red">required</span>.

# Configure the Billing Object

<!-- javascript@24-39 -->
<!-- javascript@25-40 -->

Contains the customer's shipping information including their name, address, phone number, and email. 
This information *optional*.

# Configure the Items Array

<!-- javascript@40-53 -->
<!-- javascript@41-54 -->

The `items` array contains the `item` object, price, qty, SKU, URLs, etc.
This information is <span style="color:red">required</span>.

# Additional Objects

<!-- javascript@54-67 -->
<!-- javascript@55-68 -->

The Checkout Object contains additional objects that are optional, such as `discounts` and `metadata`. These objects can contain information about discounts applied to an order or travel itinerary details.

# Confirm the Totals

<!-- javascript@44,56,60,71-74 -->
<!-- javascript@45,57,61,72-74 -->

Include the total amounts for shipping, tax, discounts, and more. 
This information is <span style="color:red">required</span>.