For the complete documentation index, see llms.txt. This page is also available as Markdown.

Select or decline sample products

Accepts the user's sample product selection. The user can either select one or more products (up to allowed_quantity) or submit an empty list to explicitly decline all sample products.

Fields:

  • sample_products: List of product PKs to add as samples. Must be from the available sample product IDs for the current basket discounts. Duplicates are deduplicated automatically. Can be an empty list to decline all samples.

Validation:

  • The number of selected products must not exceed allowed_quantity. If it does, a validation error is returned.

  • Each submitted PK must belong to the set of available sample products for the current offer discount applications.

State Update:

  • If products are selected: pre_order.data['sample_products'] is set to the selected product list.

  • If the list is empty (decline): pre_order.data['unwanted_sample_products'] is set to true and sample_products is removed.

Backward Navigation:

  • When navigating backward, both sample_products and unwanted_sample_products are removed from pre_order.data.

Next Pages:

  • PaymentOptionSelectionPage

post
Header parameters
x-requested-withstring · enumRequired

Required header for AJAX requests. Must be set to XMLHttpRequest for all checkout requests.

Default: XMLHttpRequestPossible values:
CookiestringOptional

Session cookie header (e.g. sessionid=abc123 or osessionid=<session_id>)

Body
sample_productsinteger[]Required

List of product PKs to add as sample products. Must be from the set of available sample products for the current basket's offer discount applications. Duplicates are deduplicated automatically. Submit an empty array to explicitly decline all sample products (sets unwanted_sample_products = true). The count must not exceed the allowed_quantity returned in the page context.

Example: [101]
Responses
200

Sample product selection applied or validation error

application/json
errorsone of · nullableOptional
or
string[]Optional
template_namestringOptional
post/orders/checkout/?page=SampleProductPage
POST /orders/checkout/?page=SampleProductPage HTTP/1.1
Host: sandbox.akinon.com
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 25

"sample_products=[101]"
200

Sample product selection applied or validation error

{
  "context_list": [
    {
      "page_name": "PaymentOptionSelectionPage",
      "page_slug": "paymentoptionselectionpage",
      "page_context": {
        "payment_options": [],
        "unavailable_options": []
      }
    }
  ],
  "pre_order": {
    "user_email": "user@akinon.com"
  },
  "errors": {},
  "template_name": "orders/checkout.html"
}

Last updated

Was this helpful?