Skip to main content

Checkout

The Checkout API opens a checkout session from storefront JavaScript and returns the URL to send the customer to. Themes use it for two flows: a Buy now button that takes one product straight to checkout without going through the cart, and a Pay now button that reopens payment for an order the customer left unpaid.

The examples below send an X-CSRF-Token header. See Authentication for how to read the token from the cookie. The bodies on this page are JSON, so set Content-Type to application/json.

All Ajax API requests should use locale-aware URLs to give visitors a consistent experience.

Create a checkout session

POST /{locale}/api/checkout/order

Create a checkout session for a set of variants. The response returns the order_token that the other endpoints on this page take, and the checkout_url the buyer is sent to.

Example request

const data = {
line_items: [
{
product_id: '14a309ec-b966-4cf9-a9bb-33baa821fdbc',
variant_id: 'fff360dd-6457-466a-98b3-16878bacef5b',
quantity: 1
}
],
refer_info: {
source: 'buy_now'
}
};

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrfToken()
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
});

Request parameters

    line_items object[]

    The variants to check out.

  • Array [
  • product_idstring

    The product id of the variant.

    variant_idstring

    The variant id.

    quantitynumber

    The quantity of the variant.

  • ]
  • refer_info object

    The source of the request. It has a source property whose values are add_to_cart, buy_now, or cart.

    sourcestring

Response

    statestring

    Request result flag; success or 0 means the request succeeded.

    messagestring

    Result message returned with the response.

    errorsundefined[]

    List of errors returned when the request fails.

    data object

    The response payload.

    order_tokenstring

    Token that identifies the order.

    checkout_urlstring

    Relative URL of the checkout page for the order.

    prices object

    Amount breakdown of the order.

    total_pricestring

    Total price of the cart after discounts.

    subtotal_pricestring

    Sum of the line item prices before discounts.

    shipping_pricestring

    Shipping fee of the order.

    tax_pricestring

    Tax of the order.

    discount_pricestring

    Total discount applied to the order.

    discount_line_item_pricestring

    Discounted total for the applied discounts.

    discount_code_pricestring

    Discount that comes from the discount code.

    currency_codestring

    Currency code of the order, for example USD.

    discount_applicationsundefined[]

    Discounts applied to this object.

    items object[]

    List of line items in the cart.

  • Array [
  • barcodestring

    Barcode of the variant.

    compare_at_pricestring

    Compare-at price of the item.

    cost_pricestring

    Cost price of the variant.

    customboolean

    Whether the line item is a custom item.

    discount_applicationsundefined[]

    Discounts applied to this object.

    discount_totalstring

    Total discount applied.

    final_line_pricestring

    Combined price of all units in this line item, after line-level discounts.

    idstring

    ID of the line item.

    image object

    Image of the line item's variant.

    altstring

    Alt text of the image.

    heightnumber

    Height of the image, in pixels.

    pathstring

    Path of the image file on the image server.

    srcstring

    URL of the image.

    widthnumber

    Width of the image, in pixels.

    line_pricestring

    Combined price of all units in this line item, before discounts.

    mixed_wholesaleboolean

    Whether mixed wholesale is supported.

    notestring

    Note attached to the line item.

    options object[]

    Option values of the line item's variant.

  • Array [
  • namestring

    Name of the product option, for example Color.

    valuestring

    Value selected for this product option.

  • ]
  • pricestring

    Price of a single unit of the line item.

    product_handlestring

    Handle of the product.

    product_idstring

    ID of the product.

    product_tagsundefined[]

    Tags of the product.

    product_titlestring

    Title of the product.

    product_urlstring

    Relative URL of the product page.

    propertiesstring

    Custom properties captured on the line item.

    quantitynumber

    Quantity of the item.

    requires_shippingboolean

    Whether shipping is required.

    skustring

    SKU of the variant, used for inventory tracking.

    spustring

    SPU of the product.

    tax_codestring
    tax_pricestring

    Tax of the line item.

    tax_ratestring

    Tax rate applied.

    taxableboolean

    Whether tax is charged.

    trunk_pricestring

    Trunk price of the line item.

    variant_idstring

    ID of the variant.

    variant_titlestring

    Title of the variant, for example Blue, Size M.

    vendorstring

    Vendor of the product.

    vendor_urlstring

    URL of the product vendor.

    weightstring

    Weight of the variant.

    weight_unitstring

    Unit of the weight, for example kg.

    wholesale_price object[]

    Wholesale price tiers.

  • Array [
  • min_quantitynumber

    Minimum quantity required for this wholesale tier.

    pricestring

    Unit price of this wholesale tier.

  • ]
  • totalstring

    Total price of the line item.

    tax_linesundefined[]

    Tax breakdown of the order.

    final_pricestring

    Price of a single unit of this line item, after line-level discounts.

    is_free_giftboolean

    Whether the item is a free gift.

    excluded_tax_sub_totalstring
    lengthnumber

    Package length of the line item.

    widthnumber

    Package width of the line item.

    heightnumber

    Package height of the line item.

    dimension_unitstring

    Unit of the package dimensions.

    hs_codestring

    HS code used for the customs declaration.

    origin_country_codestring

    Country code where the product was produced.

    origin_pricestring
    duty_pricestring

    Customs duty of the line item.

    product_typestring

    Product type.

  • ]
  • keystring

    Key required, together with the order ID, to open the checkout page.

    line_items object[]

    List of line items.

  • Array [
  • barcodestring

    Barcode of the variant.

    compare_at_pricestring

    Compare-at price of the item.

    cost_pricestring

    Cost price of the variant.

    customboolean

    Whether the line item is a custom item.

    discount_applicationsundefined[]

    Discounts applied to this object.

    discount_totalstring

    Total discount applied.

    final_line_pricestring

    Combined price of all units in this line item, after line-level discounts.

    idstring

    ID of the line item.

    image object

    Image of the line item's variant.

    altstring

    Alt text of the image.

    heightnumber

    Height of the image, in pixels.

    pathstring

    Path of the image file on the image server.

    srcstring

    URL of the image.

    widthnumber

    Width of the image, in pixels.

    line_pricestring

    Combined price of all units in this line item, before discounts.

    mixed_wholesaleboolean

    Whether mixed wholesale is supported.

    notestring

    Note attached to the line item.

    options object[]

    Option values of the line item's variant.

  • Array [
  • namestring

    Name of the product option, for example Color.

    valuestring

    Value selected for this product option.

  • ]
  • pricestring

    Price of a single unit of the line item.

    product_handlestring

    Handle of the product.

    product_idstring

    ID of the product.

    product_tagsundefined[]

    Tags of the product.

    product_titlestring

    Title of the product.

    product_urlstring

    Relative URL of the product page.

    propertiesstring

    Custom properties captured on the line item.

    quantitynumber

    Quantity of the item.

    requires_shippingboolean

    Whether shipping is required.

    skustring

    SKU of the variant, used for inventory tracking.

    spustring

    SPU of the product.

    tax_codestring
    tax_pricestring

    Tax of the line item.

    tax_ratestring

    Tax rate applied.

    taxableboolean

    Whether tax is charged.

    trunk_pricestring

    Trunk price of the line item.

    variant_idstring

    ID of the variant.

    variant_titlestring

    Title of the variant, for example Blue, Size M.

    vendorstring

    Vendor of the product.

    vendor_urlstring

    URL of the product vendor.

    weightstring

    Weight of the variant.

    weight_unitstring

    Unit of the weight, for example kg.

    wholesale_price object[]

    Wholesale price tiers.

  • Array [
  • min_quantitynumber

    Minimum quantity required for this wholesale tier.

    pricestring

    Unit price of this wholesale tier.

  • ]
  • totalstring

    Total price of the line item.

    tax_linesundefined[]

    Tax breakdown of the order.

    final_pricestring

    Price of a single unit of this line item, after line-level discounts.

    is_free_giftboolean

    Whether the item is a free gift.

    excluded_tax_sub_totalstring
    lengthnumber

    Package length of the line item.

    widthnumber

    Package width of the line item.

    heightnumber

    Package height of the line item.

    dimension_unitstring

    Unit of the package dimensions.

    hs_codestring

    HS code used for the customs declaration.

    origin_country_codestring

    Country code where the product was produced.

    origin_pricestring
    duty_pricestring

    Customs duty of the line item.

    product_typestring

    Product type.

  • ]
  • invalid_line_itemsundefined[]

    Line items that could not be placed into the order.

    redirect_urlstring

    URL the customer should be redirected to.

Get a checkout session

GET /{locale}/api/checkout/order/{order_id}

Get the current state of a checkout session, where order_id is the order token from the checkout URL.

Example request

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/2446407200000000000000')
.then((response) => response.json())
.then((data) => {
// do something...
});

Request parameters

    order_idstring

    The order token returned when the checkout session was created.

Response

    data object

    The response payload.

    idstring

    ID of the order.

    refer_info object

    Information about how the customer reached the store.

    address_checkboolean
    client_idstring
    countrystring
    customer_sessionstring
    domainstring
    fbcstring
    fbpstring
    inventory_deductionstring
    ipstring

    The visitor's IP address.

    segstring
    session_idstring
    sourcestring
    user_agentstring
    order_nostring

    Order number.

    create_timestring

    Time when the order was created; same as create_at.

    placed_atstringnullable

    Time when the order was paid.

    statusstring

    Status of the order, for example opened, placed, finished.

    financial_statusstring

    Payment status of the order, for example waiting, paid.

    fulfillment_statusstring

    Fulfillment status, for example waiting, shipped, finished.

    post_sale_statusstringnullable

    After-sales status of the order.

    email_statusstring

    Status of the order recall email; waiting pending, send sent.

    notestringnullable

    Note the merchant added to the order.

    cancel_reasonstringnullable

    Reason the order was cancelled.

    discount_codestring

    Discount code applied to the order.

    customer_notestring

    Note the customer left during checkout.

    currency_codestring

    Currency code of the order, for example USD.

    shipping_address_editableboolean

    Whether the shipping address can still be edited.

    config object

    Configuration of the order.

    page_typestring

    Layout of the checkout page, for example three_step.

    requires_shippingboolean

    Whether shipping is required.

    checkout_business_typenumber
    product_tax_includedboolean

    Whether product prices include tax.

    checkout_template_typenumber
    market_setting object

    Market settings that apply to the order.

    primary_market_langstring

    Language code of the store's primary market.

    market_langstring

    Language code of the market.

    market_idstring

    ID of the market the order belongs to.

    market_currencystring

    Currency code of the market.

    market_currency_symbol object

    Currency symbol of the market.

    codestring

    Currency code, for example USD.

    valstring

    Currency symbol, for example $.

    leftstring

    Content shown to the left of the amount.

    rightstring

    Content shown to the right of the amount.

    market_base_currencystring

    Base currency code of the market.

    market_base_currency_symbol object

    Symbol of the base currency of the market.

    codestring

    Currency code, for example USD.

    valstring

    Currency symbol, for example $.

    leftstring

    Content shown to the left of the amount.

    rightstring

    Content shown to the right of the amount.

    primary_market_idstring

    ID of the store's primary market.

    primary_market_currencystring

    Currency code of the store's primary market.

    primary_market_currency_symbol object

    Currency symbol of the store's primary market.

    codestring

    Currency code, for example USD.

    valstring

    Currency symbol, for example $.

    leftstring

    Content shown to the left of the amount.

    rightstring

    Content shown to the right of the amount.

    market_price_setting object
    local_currency_enabledboolean
    custom_rate_enabledboolean
    custom_ratenumber
    ratenumber
    back_ratenumber
    actual_ratenumber
    base_to_localnumber
    local_to_basenumber
    adjustnumber
    price_round_enabledboolean
    market_countrystring

    Country code of the market.

    discount_applicationsundefined[]

    Discounts applied to this object.

    canceled_atstringnullable

    Time when the order was cancelled.

    fail_codestringnullable
    shipping_lineundefined[]

    Shipping plan selected for the order.

    customer object

    The customer details.

    idstring

    ID of the customer.

    emailstring

    Email address of the customer.

    first_namestring

    First name of the customer or recipient.

    last_namestring

    Last name of the customer or recipient.

    phonestring

    Phone number of the customer.

    tagsundefined[]

    Tags attached to the object.

    subscribedboolean

    Whether the customer is subscribed to marketing messages.

    namestring

    Full name of the customer.

    notestringnullable

    Note attached to the object.

    contactstring

    Contact of the customer, either an email address or a phone number.

    contact_typestring

    Contact type, either email or phone.

    created_atstring

    Creation time, in ISO-8601 format.

    registeredboolean

    Whether the customer has registered an account.

    registered_atstring

    Time when the customer completed registration.

    sourcestring

    Where the customer record came from.

    free_taxstringnullable

    Whether the customer is exempt from taxes.

    location_idstring
    customer_extra_info object

    Additional statistics about the customer.

    finished_order_countnumber

    Number of completed orders placed by the customer.

    finished_order_totalstring

    Total amount of the completed orders placed by the customer.

    countrystring
    country_codestring
    provincestring

    Province or state of the address.

    province_codestring

    Province or state code.

    currency_codestring

    Currency code of the order, for example USD.

    purchase_product_countnumber

    Number of products the customer has purchased.

    store_customer_idstring
    customer_rolestringnullable
    extstringnullable
    first_order_atstring

    Time when the customer placed the first order.

    last_order_atstring

    Time when the customer placed the last order.

    shipping_address object

    Shipping address of the order.

    idstring

    ID of the address.

    first_namestring

    First name of the customer or recipient.

    last_namestring

    Last name of the customer or recipient.

    emailstring

    Email address associated with the address.

    phonestringnullable

    Phone number associated with the address.

    country_codestring

    ISO country code of the address.

    countrystring

    Country name of the address.

    province_codestring

    Province or state code.

    provincestring

    Province or state of the address.

    areastringnullable

    Area or district of the address.

    citystring

    City of the address.

    addressstring

    Street address of the recipient.

    address1stringnullable

    Primary street address.

    zipstring

    Postal or ZIP code.

    extra_infostringnullable
    companystringnullable

    Company name of the address.

    phone_area_codestring

    Area code of the phone number.

    latitudestringnullable

    Latitude of the address.

    longitudestringnullable

    Longitude of the address.

    sourcestringnullable
    tagsstringnullable

    Tags attached to the object.

    billing_addressstringnullable

    Billing address of the order.

    line_items object[]

    List of line items.

  • Array [
  • idstring

    ID of the line item.

    product_titlestring

    Title of the product.

    product_idstring

    ID of the product.

    product_handlestring

    Handle of the product.

    variant_idstring

    ID of the variant.

    variant_titlestring

    Title of the variant, for example Blue, Size M.

    quantitynumber

    Quantity of the item.

    fulfillment_statusstring

    Fulfillment status, for example waiting, shipped, finished.

    notestring

    Note attached to the line item.

    image object

    Image of the line item's variant.

    altstring

    Alt text of the image.

    heightnumber

    Height of the image, in pixels.

    pathstring

    Path of the image file on the image server.

    srcstring

    URL of the image.

    widthnumber

    Width of the image, in pixels.

    compare_at_pricestring

    Compare-at price of the item.

    pricestring

    Price of a single unit of the line item.

    totalstring

    Total price of the line item.

    skustring

    SKU of the variant, used for inventory tracking.

    weightstring

    Weight of the variant.

    weight_unitstring

    Unit of the weight, for example kg.

    taxableboolean

    Whether tax is charged.

    requires_shippingboolean

    Whether shipping is required.

    options object[]

    Option values of the line item's variant.

  • Array [
  • namestring

    Name of the product option, for example Color.

    valuestring

    Value selected for this product option.

  • ]
  • vendorstring

    Vendor of the product.

    product_urlstring

    Relative URL of the product page.

    propertiesstring

    Custom properties captured on the line item.

    barcodestring

    Barcode of the variant.

    product_spustring

    SPU of the product.

    product_vendor_urlstring

    URL of the product vendor.

    product_tagsundefined[]

    Tags of the product.

    discount_applicationsundefined[]

    Discounts applied to this object.

    tax_codestring
    tax_ratestring

    Tax rate applied.

    tax_pricestring

    Tax of the line item.

    wholesale_price object[]

    Wholesale price tiers.

  • Array [
  • pricestring

    Unit price of this wholesale tier.

    min_quantitynumber

    Minimum quantity required for this wholesale tier.

  • ]
  • mixed_wholesaleboolean

    Whether mixed wholesale is supported.

    item_pricestring
    cost_pricestring

    Cost price of the variant.

    customboolean

    Whether the line item is a custom item.

    trunk_pricestring

    Trunk price of the line item.

    main_currency_prices object

    Order amounts converted into the store's main currency.

    compare_at_pricestring

    Compare-at price of the item.

    pricestring

    Unit price converted into the store's main currency.

    totalstring

    Total converted into the store's main currency.

    tax_pricestring

    Tax of the line item.

    item_pricestring
    cost_pricestring

    Cost price of the variant.

    trunk_pricestring

    Trunk price of the line item.

    actual_ratestring

    Exchange rate used for the conversion.

    fixed_discount_totalstring
    excluded_tax_sub_totalstring
    tax_linesundefined[]

    Tax breakdown of the order.

    lengthnumber

    Package length of the line item.

    widthnumber

    Package width of the line item.

    heightnumber

    Package height of the line item.

    dimension_unitstring

    Unit of the package dimensions.

    commissionstring
    origin_country_codestring

    Country code where the product was produced.

    hs_codestring

    HS code used for the customs declaration.

    created_bystring
    origin_pricestring
    duty_pricestring

    Customs duty of the line item.

    line_pricestring

    Combined price of all units in this line item, before discounts.

    discount_totalstring

    Total discount applied.

    final_line_pricestring

    Combined price of all units in this line item, after line-level discounts.

    final_pricestring

    Price of a single unit of this line item, after line-level discounts.

  • ]
  • payment_linestringnullable

    Payment details of the order.

    testboolean

    Whether this is a test order.

    order_status_urlstring

    Relative URL of the order status page.

    order_keystring

    Key used together with the order ID to access the order.

    yet_paymentstring

    Amount of the order that is still unpaid.

    refundstring

    Refunded amount of the order.

    installment_feestring

    Installment fee charged on the order.

    paid_totalstring

    Total amount already paid for the order.

    updated_timestring

    Time when the order was last updated.

    checkout_idstring
    tax_typenumber
    applied_gift_cardsundefined[]

    Gift cards applied to the order.

    payment_linesundefined[]

    List of the order payment records.

    checkout_urlstring

    Relative URL of the checkout page for the order.

    finished_atstringnullable

    Time when the order was completed.

    fulfillmentsundefined[]

    List of shipments for the order.

    identifier_extrastring
    main_currency_prices object

    Order amounts converted into the store's main currency.

    sub_totalstring

    Sum of the line item prices before order-level discounts.

    shipping_totalstring

    Total shipping fee of the order.

    tax_totalstring

    Total tax applied to the order.

    discount_totalstring

    Total discount applied.

    totalstring

    Total converted into the store's main currency.

    total_tip_receivedstring

    Total tip received for the order.

    refund_totalstring

    Total refunded amount of the order.

    actual_ratestring

    Exchange rate used for the conversion.

    shipping_line_detailstringnullable
    order_typenumber

    Order type; 0 is a regular order, 1 is a gift card order.

    shipping_tax_typenumber
    product_tax_includedboolean

    Whether product prices include tax.

    translationsundefined[]
    location_line object

    Address of the merchant's warehouse.

    idstring

    ID of the address.

    location_idstring

    ID of the warehouse.

    location_namestring

    Name of the warehouse.

    first_namestring

    First name of the customer or recipient.

    last_namestring

    Last name of the customer or recipient.

    phonestring

    Phone number associated with the address.

    emailstring

    Email address associated with the address.

    countrystring

    Country name of the address.

    country_codestring

    ISO country code of the address.

    provincestring

    Province or state of the address.

    province_codestring

    Province or state code.

    areastring

    Area or district of the address.

    citystring

    City of the address.

    addressstring

    Street address of the recipient.

    address1string

    Primary street address.

    companystring

    Company name of the address.

    latitudestring

    Latitude of the address.

    longitudestring

    Longitude of the address.

    zipstring

    Postal or ZIP code.

    phone_area_codestring

    Area code of the phone number.

    extra_infostring
    additional_totalstring

    Total additional charges of the order.

    additional_pricesundefined[]

    Breakdown of the additional charges.

    tax_lines object

    Tax breakdown of the order.

    sales_tax_linesundefined[]
    locale_zonestring
    tagsundefined[]

    Tags attached to the object.

    order_customer object

    Customer information recorded on the order.

    origin_idstring
    first_namestring

    First name of the customer or recipient.

    last_namestring

    Last name of the customer or recipient.

    emailstring

    Email address of the customer.

    phonestring

    Phone number of the customer.

    customer_rolestring
    extundefined[]
    duty_totalstring

    Total customs duty and tax of the order.

    mail_send_configundefined[]
    custom_fieldsundefined[]
    already_payment_linesundefined[]
    additional_rules object[]
  • Array [
  • idstring
    namestring
    input_typenumber
    descriptionstring
    enablenumber
    show_typestring
    show_rules object[]
  • Array [
  • fieldstring
    rulesundefined[]
  • ]
  • requirenumber
    validatesundefined[]
    enumsundefined[]
  • ]
  • checkout_settings object

    Checkout settings of the store.

    customer_authoritystring
    checkout_page_typestring

    Layout of the checkout page, for example three_step.

    lineitems_validateboolean
    discount_showstring
    discount_show_v2string[]
    reduction_show object
    singlestring[]
    two_stepstring[]
    three_stepstring[]
    zip_checkstring
    zip_check_v2string
    zip_format_checkstring
    zip_check_config object
    GBnumber
    USnumber
    BRnumber
    MXnumber
    CLnumber
    COnumber
    DEnumber
    KRnumber
    ROnumber
    zip_check_config_v2 object
    AEnumber
    BHnumber
    KWnumber
    OMnumber
    QAnumber
    SAnumber
    order_timeoutnumber
    inventory_deductionstring
    shipping_cpf object
    config_info object
    config_default object
    lengthstring
    typestring
    config_br object
    lengthstring
    typestring
    is_show_countries object
    cpf_cnpj object
    titlestring
    country_codesstring
    is_filledboolean
    countriesstringnullable
    format_checkboolean
    rut object
    titlestring
    country_codesstring
    is_filledboolean
    countriesstringnullable
    format_checkboolean
    other object
    titlestring
    is_filledboolean
    countriesundefined[]
    format_checkboolean
    countriesundefined[]
    is_showboolean
    instructionstring
    address_setting object
    namestring

    How the name fields are laid out in the address form.

    emailstring

    Display setting of the email field in the address form.

    phonestring

    Display setting of the phone field in the address form.

    companystring

    Display setting of the company field in the address form, for example hidden.

    addressstring

    Display setting of the street address field in the address form.

    address1string

    Display setting of the street address field in the address form.

    name_requirementstring

    Which name field is required, for example last_name.

    contact_detailsstring

    How contact fields are collected in the address form.

    auto_completestring
    doorplate_format_checkstring
    forced_zip_checkstring[]
    identification_info object
    default object
    countriesstringnullable
    format_checkboolean
    is_filledboolean
    rules object[]
  • Array [
  • country_codestring
    namestring
    regexpstring
    example_valstring
  • ]
  • shipping_method_display_stylestring
    address_settings object

    How the address form is configured.

    namestring

    How the name fields are laid out in the address form.

    emailstring

    Display setting of the email field in the address form.

    phonestring

    Display setting of the phone field in the address form.

    companystring

    Display setting of the company field in the address form, for example hidden.

    addressstring

    Display setting of the street address field in the address form.

    address1string

    Display setting of the street address field in the address form.

    name_requirementstring

    Which name field is required, for example last_name.

    contact_detailsstring

    How contact fields are collected in the address form.

    customer_info object

    Contact information filled in at checkout.

    emailstring

    Email address of the customer.

    first_namestring

    First name of the customer or recipient.

    last_namestring

    Last name of the customer or recipient.

    phonestring

    Phone number of the customer.

    payment_settings object

    Payment settings available at checkout.

    settings object
    dynamic_config object
    paypal_js_sdk_urlstring
    express_checkout_config object
    express_channelsundefined[]
    express_account_infosundefined[]
    express_theme_configsundefined[]
    scmstring
    unified_user_idstring
    fallback_reasonstring
    request_idstring
    ec_legacy_apple_pay_block_store_idsstring[]
    ec_legacy_google_pay_block_store_idsstring[]
    ec_legacy_spz_paypal_store_idsundefined[]
    express_checkout_config object
    express_account_infosundefined[]
    express_channelsundefined[]
    express_theme_configsundefined[]
    payment_icon_resourcesundefined[]
    payment_resourcesundefined[]
    paypal_accountundefined[]
    paypal_account_typestring
    paypal_creditcard_enabledboolean
    paypal_express_enabledboolean
    paypal_shipment_enabledboolean
    support_channelsstring[]
    order_tokenstring

    Token that identifies the order.

    currency_symbolstring

    Currency symbol of the order.

    currency_symbol_posstring

    Where the currency symbol is placed, left or right.

    payment_duestring

    Amount of the order that is still unpaid.

    all_tax_totalstring

    Total of all taxes on the order.

    prices object

    Amount breakdown of the order.

    subtotal_pricestring

    Sum of the line item prices before discounts.

    shipping_pricestring

    Shipping fee of the order.

    tax_pricestring

    Tax of the order.

    discount_code_pricestring

    Discount that comes from the discount code.

    discount_pricestring

    Total discount applied to the order.

    total_pricestring

    Total price of the cart after discounts.

    shipping_tax_totalstring

    Total shipping tax of the order.

    discount_line_item_pricestring

    Discounted total for the applied discounts.

    total_tip_receivedstring

    Total tip received for the order.

    discount_shipping_pricestring

    Discount applied to the shipping fee.

    discount_sub_totalstring

    Subtotal after discounts.

    gift_card_pricestring

    Amount paid with gift cards.

    paid_totalstring

    Total amount already paid for the order.

    payment_duestring

    Amount of the order that is still unpaid.

    all_tax_totalstring

    Total of all taxes on the order.

    payment_discount_totalstring

    Discount that comes from the payment method.

    additional_totalstring

    Total additional charges of the order.

    duty_totalstring

    Total customs duty and tax of the order.

    except_notification object

    Information about an exception raised while completing the order.

    codestring

    Exception code, for example total_price_changed.

    ip_address object

    Location resolved from the customer's IP address.

    country_codestring

    Country code resolved from the customer's IP address.

    province_namestring

    Province name resolved from the customer's IP address.

    country_namestring

    Country name resolved from the customer's IP address.

    citystring

    City of the address.

    ipstring

    The visitor's IP address.

    policy_titlesundefined[]

    Titles of the store policies shown at checkout.

    checkout_page_typestring

    Layout of the checkout page, for example three_step.

    stepstring

    Current step of the checkout flow.

    statestring

    Request result flag; success or 0 means the request succeeded.

    messagestring

    Result message returned with the response.

    errorsundefined[]

    List of errors returned when the request fails.

Save a shipping address on a checkout session

POST /{locale}/api/checkout/order/presave

Save a shipping address on the session before payment, so that shipping rates and taxes can be calculated for it.

Example request

const data = {
order_token: '2446407200000000000000',
shipping_address: {
first_name: 'Jane',
last_name: 'Doe',
address: '123 Main St',
city: 'Los Angeles',
country: 'United States',
country_code: 'US',
province: 'California',
province_code: 'CA',
zip: '90001',
}
};

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/presave', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrfToken()
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
});

Request parameters

    order_tokenstring

    The order token of the checkout session.

    shipping_address object

    The shipping address to save on the session.

    first_namestring
    last_namestring
    phonestring
    emailstring
    countrystring
    country_codestring
    areastring
    addressstring
    address1string
    companystring
    provincestring
    province_codestring
    citystring
    zipstring

Response

    datastringnullable

    The response payload.

    statestring

    Request result flag; success or 0 means the request succeeded.

    messagestring

    Result message returned with the response.

    errorsundefined[]

    List of errors returned when the request fails.

Reopen the checkout of an unpaid session

POST /{locale}/api/checkout/order/repay

Reopen the checkout of a session that was created but not paid, and get its checkout URL back.

Example request

const data = { order_token: '2446407200000000000000' };

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/repay', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrfToken()
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
});

Request parameters

    order_tokenstring

    The order token of the checkout session.

Response

    data object

    The response payload.

    idstring

    ID of the order.

    checkout_urlstring

    Relative URL of the checkout page for the order.

    statestring

    Request result flag; success or 0 means the request succeeded.

    messagestring

    Result message returned with the response.

    errorsundefined[]

    List of errors returned when the request fails.

Submit a checkout session for payment

POST /{locale}/api/checkout/order/complete

Submit the checkout session for payment with the addresses, the contact details, the chosen shipping and payment options and the prices that the session settled on.

Example request

Read shipping_line, payment_line and prices from GET /{locale}/api/checkout/order/{order_id} and send them back unchanged, so that the server prices the order the same way the session did.

const data = {
order_token: '2446407200000000000000',
shipping_address: {
first_name: 'Jane',
last_name: 'Doe',
phone: '',
country: 'United States',
country_code: 'US',
area: '',
address: '456 Oak Ave',
address1: 'Apt 4',
company: '',
province: 'California',
province_code: 'US-CA',
city: 'Los Angeles',
zip: '90002'
},
billing_address: {
first_name: 'Jane',
last_name: 'Doe',
phone: '',
country: 'United States',
country_code: 'US',
area: '',
address: '456 Oak Ave',
address1: 'Apt 4',
company: '',
province: 'California',
province_code: 'US-CA',
city: 'Los Angeles',
zip: '90002'
},
use_shipping_address: '1',
customer_info: {
first_name: 'Jane',
last_name: 'Doe',
phone: '',
newsletter: 0,
note: '',
save_address: 0,
email_or_phone: '[email protected]'
},
shipping_line: {
id: 'd43bfac3-5f80-433d-b9ce-49a3d645cd5c',
name: 'Standard shipping',
desc: '',
delivery_method: 1,
shipping_price: '1.00',
discount_shipping_price: '1.00',
discounts: [],
is_free: false,
support_cod: 0,
location_id: '0',
plan_code: ''
},
payment_line: {
id: '59107222-a7a9-479a-a1f7-dd5d40015033',
name: 'bogus',
payment_channel: 'bogus',
payment_method: 'bogus_gateway',
payment_key: 'bogus',
status: 'open',
is_active: true
},
prices: {
subtotal_price: '1.00',
shipping_price: '0.00',
tax_price: '0.00',
discount_code_price: '0.00',
discount_price: '0.00',
total_price: '1.00',
shipping_tax_total: '0.00',
discount_line_item_price: '0.00',
total_tip_received: '0.00',
discount_shipping_price: '0.00',
discount_sub_total: '1.00',
gift_card_price: '0.00',
paid_total: '0.00',
payment_due: '1.00',
all_tax_total: '0.00',
payment_discount_total: '0.00',
additional_total: '0.00',
duty_total: '0.00'
},
risk_control_info: []
};

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/complete', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrfToken()
},
body: JSON.stringify(data)
})
.then((response) => response.json())
.then((data) => {
// do something...
});

Request parameters

    order_tokenstring

    The order token of the checkout session.

    shipping_address object

    The shipping address of the order.

    first_namestring
    last_namestring
    phonestring
    emailstring
    countrystring
    country_codestring
    areastring
    addressstring
    address1string
    companystring
    provincestring
    province_codestring
    citystring
    zipstring
    billing_address object

    The billing address of the order.

    first_namestring
    last_namestring
    phonestring
    emailstring
    countrystring
    country_codestring
    areastring
    addressstring
    address1string
    companystring
    provincestring
    province_codestring
    citystring
    zipstring
    use_shipping_addressstring

    Whether the billing address is the same as the shipping address, 1 or 0.

    customer_info object

    The contact details of the buyer, and whether to subscribe them and save their address.

    emailstring
    first_namestring
    last_namestring
    phonestring
    newsletternumber
    notestring
    save_addressnumber
    email_or_phonestring
    shipping_line object

    The shipping option chosen from the session, copied from the session response.

    idstring
    namestring
    descstring
    delivery_methodnumber
    shipping_pricestring
    discount_shipping_pricestring
    discountsarray
    is_freeboolean
    support_codnumber
    location_idstring
    plan_codestring
    payment_line object

    The payment option chosen from the session, copied from the session response.

    idstring
    namestring
    payment_channelstring
    payment_methodstring
    payment_keystring
    statusstring
    is_activeboolean
    prices object

    The prices the session settled on, copied from the session response.

    subtotal_pricestring
    shipping_pricestring
    tax_pricestring
    discount_code_pricestring
    discount_pricestring
    total_pricestring
    shipping_tax_totalstring
    discount_line_item_pricestring
    total_tip_receivedstring
    discount_shipping_pricestring
    discount_sub_totalstring
    gift_card_pricestring
    paid_totalstring
    payment_duestring
    all_tax_totalstring
    payment_discount_totalstring
    additional_totalstring
    duty_totalstring
    risk_control_infoarray

    The risk control data collected for the order. Pass an empty array when you collect none.

Response

    data object

    The response payload.

    except_notification object

    Information about an exception raised while completing the order.

    codestring

    Exception code, for example total_price_changed.

    statestring

    Request result flag; success or 0 means the request succeeded.

    messagestring

    Result message returned with the response.

    errorsundefined[]

    List of errors returned when the request fails.