LogoLogo
  • LiquidCommerce Documentation
  • πŸ”Authentication API Integration
    • Get Access Token
  • Services
    • πŸ—ΊοΈAddress API
      • Autocomplete
      • Details
    • πŸ‘₯Users API
      • Session
      • Fetch User
      • Delete User
      • Create/Update Address
      • Delete Address
      • Add Payment
      • Update Default Payment
      • Delete Payment
    • πŸ—ƒοΈCatalog API
      • Search
      • Availability
    • πŸ›’Cart API
      • Create/Update Cart
    • πŸ›οΈCheckout API
      • Prepare
      • Complete
    • πŸ“Orders API
      • Authentication
      • Get Order
  • CLOUD SDK
    • Overview
    • Methods & Usage
  • EVENTS & ERRORS
    • Overview
    • Cart Events
    • Checkout Status Codes
  • EVENT BRIDGE (WEBHOOKS)
    • Orders
  • Types
    • Loc
    • Catalog
    • Catalog Filters
    • Product
    • Cart
    • User
    • Retailer
    • Checkout
    • Order
Powered by GitBook
On this page
  • Endpoint Details
  • Headers
  • Body
  • Response Details
  • Sample Request and Response
Export as PDF
  1. Services
  2. Checkout API

Prepare

Prepares a checkout session based on the provided cart and user information

Endpoint Details

POST /checkout/prepare

Headers

Header
Value

Content-Type

application/json

Authorization

Bearer <YOUR_ACCESS_TOKEN>

Body

Parameter
Type
Description
Required

cartId

string

ID of the cart to checkout

customer

Customer information

billingAddress

Billing address details

hasSubstitutionPolicy

boolean

Whether substitution policy is accepted

isGift

boolean

When the order is set as gift (isGift is set to true), the system adds gift messaging, special packaging, and gift receipts with optional sender anonymity

hasAgeVerify

boolean

Should the checkout verify age

billingSameAsShipping

boolean

Whether billing address is same as shipping

giftOptions

Gift options if applicable

marketingPreferences

Marketing preferences

deliveryTips

Array of delivery tip objects

acceptedAccountCreation

boolean

Whether customer accepted account creation

scheduledDelivery

string

Scheduled delivery datetime (ISO format)

payment

string

Payment method identifier

promoCode

string

Promotional code to apply a discount to the checkout

giftCards

array<string>

Array of gift card codes to apply as payment methods

isLegacy

boolean

Whether to return legacy identifiers

refresh

boolean

When set to true, a new access token will be generated and returned

Response Details

Field
Type
Description

statusCode

number

Internal status code of the response

message

string

A brief message describing the result of the API call

metadata

Contains metadata about the API call

auth

Authentication object, only when refresh in true

checkout

Checkout type

Metadata Object

Sample Request and Response

curl --location 'https://staging.api.liquidcommerce.cloud/checkout/prepare' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "cartId": "cart_abc123xyz789", // create a new cart
    "recipient": {
        "firstName": "Joe",
        "lastName": "John",
        "email": "john.d.joe@gmail.com",
        "phone": "9732119920",
        "birthDate": "11-22-1998",
        "hasAgeVerify": true
    },
    "billingAddress": {
        "firstName": "NewJoe",
        "lastName": "NewJohn",
        "email": "joe.new.john@gmail.com",
        "phone": "1234324987",
        "one": "22 Washington Ave",
        "two": "",
        "city": "Cliffside Park",
        "state": "NJ",
        "zip": "07010"
    },
    "hasSubstitutionPolicy": true,
    "isGift": false,
    "billingSameAsShipping": true,
    "giftOptions": {
        "message": "",
        "recipient": {
            "name": "",
            "phone": "",
            "email": ""
        }
    },
    "marketingPreferences": {
        "canEmail": true,
        "canSms": true
    },
    "deliveryTips": [
        {
            "fulfillmentId": "6570c3ec700628ce1910c105",
            "tip": 2500
        }
    ],
    "refresh": true
}'
{
    "statusCode": 200,
    "message": "Prepare a checkout prior to processing.",
    "metadata": {
        "languages": [
            "en"
        ],
        "timestamp": 1731613340101,
        "timezone": "UTC",
        "requestId": "req_abc123xyz789",
        "path": "/api/checkout/prepare",
        "version": "1.7.0"
    },
    "auth": {
        "token": "auth_token_abc123xyz789",
        "type": "ACCESS_TOKEN",
        "exp": 1731679155851
    },
    "checkout": {
        "token": "checkout_token_abc123xyz789",
        "cartId": "cart_abc123xyz789",
        "customer": {
            "id": "usr_abc123xyz789",
            "email": "user@example.com",
            "firstName": "John",
            "company": "",
            "lastName": "Doe",
            "phone": "(555) 555-5555",
            "profileImage": "",
            "birthDate": "1998-11-22T00:00:00.000Z",
            "createdAt": "2024-11-14T19:13:34.231Z",
            "updatedAt": "2024-11-14T19:42:20.314Z"
        },
        "createdAt": "2024-11-14T19:13:35.004Z",
        "updatedAt": "2024-11-14T19:42:20.420Z",
        "hasAgeVerify": false,
        "hasSubstitutionPolicy": true,
        "acceptedAccountCreation": false,
        "isGift": false,
        "billingSameAsShipping": true,
        "giftOptions": {
            "message": "",
            "recipient": {
                "name": "",
                "email": "",
                "phone": ""
            }
        },
        "marketingPreferences": {
            "canEmail": true,
            "canSms": true
        },
        "shippingAddress": {
            "one": "100 madison ave",
            "two": "",
            "city": "New york",
            "state": "NY",
            "zip": "10016",
            "country": "US"
        },
        "billingAddress": {
            "one": "100 madison ave",
            "two": "",
            "city": "New york",
            "state": "NY",
            "zip": "10016",
            "email": "user@example.com",
            "country": "US",
            "firstName": "John",
            "lastName": "Doe",
            "company": "",
            "phone": "(555) 555-5555"
        },
        "amounts": {
            "subtotal": 5999,
            "engraving": 0,
            "service": 0,
            "shipping": 1599,
            "delivery": 0,
            "platform": 499,
            "discounts": 0,
            "giftCards": 0,
            "tax": 684,
            "tip": 0,
            "total": 8781,
            "details": {
                "discounts": {
                    "products": 0,
                    "delivery": 0,
                    "shipping": 0,
                    "engraving": 0,
                    "service": 0
                },
                "taxes": {
                    "bag": 5,
                    "bottleDeposits": 5,
                    "retailDelivery": 0,
                    "products": 532,
                    "delivery": 0,
                    "shipping": 142
                }
            }
        },
        "items": [
            {
                "variantId": "var_abc123xyz789",
                "liquidId": "liq_abc123xyz789",
                "cartItemId": "item_abc123xyz789",
                "retailerId": "ret_abc123xyz789",
                "fulfillmentId": "ful_abc123xyz789",
                "name": "Whispering Angel RosΓ©",
                "brand": "Chateau D'esclans",
                "mainImage": "https://storage.example.com/images/products/image1.png",
                "image": "https://storage.example.com/images/products/image1.png",
                "size": "1.5 L",
                "pack": false,
                "packDesc": "",
                "volume": "1.5",
                "uom": "LITRE",
                "abv": "14",
                "containerType": "Bottle",
                "container": "Bottle",
                "partNumber": "88320002003_ret_abc123xyz789",
                "upc": "88320002003",
                "catPath": "WINE > ROSE WINE",
                "customerPlacement": "standard",
                "price": 5999,
                "unitPrice": 5999,
                "quantity": 1,
                "attributes": {
                    "giftCard": {
                        "sender": "",
                        "message": "",
                        "recipients": [],
                        "sendDate": ""
                    },
                    "engraving": {
                        "isEngravable": true,
                        "hasEngraving": false,
                        "maxCharsPerLine": 0,
                        "maxLines": 0,
                        "fee": 0,
                        "location": "",
                        "lines": []
                    }
                },
                "bottleDeposits": 5,
                "tax": 532
            }
        ],
        "retailers": [
            {
                "id": "ret_abc123xyz789",
                "name": "East Houston St Wine & Liquors",
                "address": {
                    "one": "250 E Houston Street",
                    "two": "",
                    "city": "New York",
                    "state": "NY",
                    "zip": "10002",
                    "country": "US"
                },
                "subtotal": 5999,
                "engraving": 0,
                "service": 0,
                "shipping": 1599,
                "delivery": 0,
                "platform": 499,
                "discounts": 0,
                "giftCards": 0,
                "tax": 684,
                "tip": 0,
                "total": 8781,
                "details": {
                    "discounts": {
                        "products": 0,
                        "delivery": 0,
                        "shipping": 0,
                        "engraving": 0,
                        "service": 0
                    },
                    "taxes": {
                        "bag": 5,
                        "bottleDeposits": 5,
                        "retailDelivery": 0,
                        "products": 532,
                        "delivery": 0,
                        "shipping": 142
                    }
                },
                "fulfillments": [
                    {
                        "id": "ful_abc123xyz789",
                        "scheduledFor": "",
                        "type": "shipping",
                        "expectation": {
                            "detail": "Ships in 2-3 days",
                            "short": "2-3 days"
                        },
                        "subtotal": 5999,
                        "engraving": 0,
                        "service": 0,
                        "shipping": 1599,
                        "delivery": 0,
                        "discounts": 0,
                        "giftCards": 0,
                        "tip": 0,
                        "items": [
                            "item_abc123xyz789"
                        ],
                        "total": 8282,
                        "details": {
                            "discounts": {
                                "products": 0,
                                "delivery": 0,
                                "shipping": 0,
                                "engraving": 0,
                                "service": 0
                            },
                            "taxes": {
                                "bag": 5,
                                "bottleDeposits": 5,
                                "retailDelivery": 0,
                                "products": 532,
                                "delivery": 0,
                                "shipping": 142
                            }
                        },
                        "tax": 684
                    }
                ]
            }
        ],
        "payment": ""
    }
}
PreviousCheckout APINextComplete

Last updated 3 months ago

array<>

πŸ›οΈ
customer
billingAddress
giftOptions
marketingPreferences
deliveryTip
metaDataObject
authObject
checkoutType
Field
Type
Description

languages

Array<string>

List of supported languages for the response, e.g. ["en"]

timestamp

string

Unix timestamp (in milliseconds) when the response was generated

timezone

string

Timezone used for the response, always "UTC"

requestId

string

Unique identifier for the API request. Used for debugging and support

path

string

API path

version

string

API version used for the request