# Checkout session reference (https://developer.godaddy.com/en/docs/api-users/commerce/accept-payments/online-payments/session-fields)

---
title: Checkout session reference
description: >-
  The identifiers, order formats, checkout sections, and response object of a
  Unified Checkout session.
keywords: >-
  checkout session fields, createCheckoutSession, storeId, returnUrl,
  successUrl, lineItems, draftOrderId, checkout sections, session response,
  session token
related:
  guides:
    - title: How to create a checkout session
      href: /docs/api-users/commerce/accept-payments/online-payments/create-session
    - title: How to configure checkout
      href: /docs/api-users/commerce/accept-payments/online-payments/configure
    - title: How to use hosted checkout
      href: /docs/api-users/commerce/accept-payments/online-payments/hosted
    - title: How to render embedded checkout
      href: /docs/api-users/commerce/accept-payments/online-payments/embedded
  concepts:
    - title: About online payments
      href: /docs/api-users/commerce/accept-payments/online-payments
    - title: About the Commerce API
      href: /docs/api-users/commerce
pageId: 68e8fb1f-fff8-49c8-8bfa-8042321018d1
---

## Overview

`createCheckoutSession` takes a single input object that requires a `storeId`, an order (as `lineItems` or a `draftOrderId`), and public HTTPS return URLs. Everything else is optional.

This page lists the identifiers, order formats, session options, checkout sections, and the object a session returns. Go to [How to configure checkout](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure) for how to use payment methods and the collect and offer options. Go to [How to create a checkout session](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/create-session) for the implementation steps, limits, and common errors.

## Identifiers and URLs

The following table lists the identifiers and URLs a session accepts.

| Field        | Type   | Required | Description                                                          |
| ------------ | ------ | -------- | -------------------------------------------------------------------- |
| `storeId`    | string | Yes      | The store the payment belongs to                                     |
| `returnUrl`  | string | Yes      | Where the shopper goes after cancelling                              |
| `successUrl` | string | Yes      | Where the shopper goes after paying                                  |
| `channelId`  | string | No       | Sales channel for the order. Defaults to the store's default channel |
| `businessId` | string | No       | Response only. GoDaddy resolves it from the store                    |
| `expiresAt`  | string | No       | Set when you want the session to stop being usable                   |

Use public HTTPS URLs for `returnUrl` and `successUrl`. Checkout rejects loopback URLs like `localhost` and `127.0.0.1` before creating the session, so local development needs a tunnel that gives you a public hostname.

Checkout doesn't expand placeholders in `successUrl`. Checkout stores a `${orderId}` you write into the URL and returns it exactly as you sent it.

How you add an order ID depends on the checkout form. Embedded checkout reads `successUrl` from the session object your server passes to the browser, so you can read `draftOrder.id` off the created session and rewrite the URL before handing it over. Hosted checkout reads the stored value instead, so the URL has to be final before you create the session: create the draft order first and pass `draftOrderId` if you need its ID in the URL.

## Ways to supply the order

An order reaches a session through one of two fields (`lineItems` or `draftOrderId`), never both.

Each entry in `lineItems` then takes one of two forms. Define the product inline when your own system owns the cart:

```typescript
{
  lineItems: [
    {
      quantity: 2,
      lineItemData: {
        name: 'T-Shirt',
        priceData: { currencyCode: 'USD', unitAmount: 1999 },
      },
    },
  ],
}
```

`unitAmount` is in the currency's minor unit, so `1999` is $19.99.

Reference products already in your GoDaddy catalog by SKU:

```typescript
{
  lineItems: [{ skuId: process.env.SKU_ID, quantity: 1 }],
}
```

The other field points at an order you created earlier:

```typescript
{
  draftOrderId: process.env.DRAFT_ORDER_ID,
}
```

When you pass `lineItems`, GoDaddy creates the draft order for you and returns it on the session. That means a session needs no pre-existing order.

A session accepts a maximum of 20 line items, and every line item must use the same currency.

## Session options

The following table lists the optional fields that control payment methods and what the form collects and offers, and where each one is described:

| Field                             | Type    | Controls                                                                     | Described in                                                                                                                |
| --------------------------------- | ------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `paymentMethods`                  | object  | Which methods checkout offers, with `processor` and `checkoutTypes` for each | [Choose payment methods](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#choose-payment-methods)         |
| `enablePhoneCollection`           | boolean | Collect a phone number                                                       | [What checkout collects](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-collects)         |
| `enableNotesCollection`           | boolean | Accept an order note                                                         | [What checkout collects](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-collects)         |
| `enableShippingAddressCollection` | boolean | Collect a shipping address                                                   | [What checkout collects](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-collects)         |
| `enableBillingAddressCollection`  | boolean | Collect a billing address                                                    | [What checkout collects](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-collects)         |
| `enableAddressAutocomplete`       | boolean | Suggest addresses as the shopper types                                       | [What checkout collects](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-collects)         |
| `enableShipping`                  | boolean | Collect a shipping method                                                    | [What checkout offers](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-offers)             |
| `enableLocalPickup`               | boolean | Offer pickup at a location you define                                        | [What checkout offers](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-offers)             |
| `enableTaxCollection`             | boolean | Calculate tax on the order                                                   | [What checkout offers](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-offers)             |
| `enablePromotionCodes`            | boolean | Accept a discount code                                                       | [What checkout offers](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-offers)             |
| `enableTips`                      | boolean | Offer a tip                                                                  | [What checkout offers](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#what-checkout-offers)             |
| `locations`                       | array   | Pickup locations                                                             | [Pickup locations and hours](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#pickup-locations-and-hours) |
| `operatingHours`                  | object  | Pickup hours and time slots                                                  | [Pickup locations and hours](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#pickup-locations-and-hours) |
| `enabledLocales`                  | array   | Languages checkout allows                                                    | [Set the checkout language](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/configure#set-the-checkout-language)   |

## Checkout sections

Each session flag maps to one or more sections in the checkout form. The following table lists when each section appears.

| Section            | Appears when                                                                                      | Note                                                                                   |
| ------------------ | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `contact`          | Always                                                                                            |                                                                                        |
| `payment`          | Always                                                                                            |                                                                                        |
| `delivery`         | `enableShipping` or `enableLocalPickup` is set, and the order isn't digital-only                  |                                                                                        |
| `shipping`         | `enableShipping` is set and the shopper chooses shipping                                          |                                                                                        |
| `pickup`           | `enableLocalPickup` is set and the shopper chooses pickup                                         | Needs `locations`, and `operatingHours` for time slots                                 |
| `tips`             | `enableTips` is set                                                                               |                                                                                        |
| `express-checkout` | A payment method offers `express`, `enableShipping` is set, and the order total is greater than 0 |                                                                                        |
| `notes`            | `enableNotesCollection` is set and delivery is off                                                | With delivery on, the note field renders inside the shipping or pickup section instead |

`shipping` and `pickup` are the two halves of one choice, so at most one is ever on screen. With both flags set, the shopper picks between them in the `delivery` section. To offer only one, set the other flag to `false` explicitly. Leaving it out isn't the same as turning it off.

## What the session returns

`createCheckoutSession` returns the following object:

```json
{
  "id": "$SESSION_ID",
  "token": "$SESSION_TOKEN",
  "url": ".../c/$SESSION_ID#$SESSION_TOKEN",
  "storeId": "$STORE_ID",
  "businessId": "$BUSINESS_ID",
  "channelId": "$CHANNEL_ID",
  "draftOrder": {
    "id": "$ORDER_ID",
    "statuses": { "status": "DRAFT" },
    "totals": { "total": { "currencyCode": "USD", "value": 1099 } }
  },
  "paymentMethods": { "card": { "processor": "godaddy", "checkoutTypes": ["standard"] } },
  "successUrl": "$SUCCESS_URL",
  "returnUrl": "$RETURN_URL"
}
```

The sample is trimmed to the fields you act on. A real session also echoes back every option you set, along with the shipping origin, any pickup locations, and the appearance values.

The `id` and `token` together authenticate every later call. Embedded checkout passes the whole object to the checkout component. Hosted checkout sends the shopper to `url`, which carries the token in its fragment so it never reaches a server.

Use the `url` the session returns. Don't construct it yourself.

Go to [How to create a checkout session](https://developer.godaddy.com/docs/api-users/commerce/accept-payments/online-payments/create-session#common-errors) for session create error messages and what to change.
