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

Apply or Clear Voucher Code

Sets or clears the voucher code on the checkout session. This is an independent step and does not determine the next checkout page. The checkout flow proceeds based on the current checkout state.

Required Fields:

  • voucher_code: The voucher code string to apply (optional, max 128 characters). Whitespace is trimmed automatically. Submit an empty value or omit the field to clear the voucher code.

Validation:

  • If a non-empty voucher code is provided, it is validated using OfferApplicator in a dry-run mode (on a copy of the pre-order and basket)

  • The code is considered valid only if it results in an applied and non-failed voucher

  • An invalid code returns a validation error in the errors field

State Changes:

  • pre_order.voucher_code is set to the validated code

  • Submitting an empty value clears pre_order.voucher_code (sets it to null)

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
voucher_codestring · max: 128Optional

Voucher code to apply to the checkout session. Leading and trailing whitespace is trimmed automatically. Submit an empty string or omit this field to clear the currently set voucher code. Maximum 128 characters.

Example: WELCOME2024
Responses
200

Voucher code processed

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

"voucher_code='WELCOME2024'"
200

Voucher code processed

{
  "context_list": [],
  "errors": {}
}

Last updated

Was this helpful?