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
OfferApplicatorin 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
errorsfield
State Changes:
pre_order.voucher_codeis set to the validated codeSubmitting an empty value clears
pre_order.voucher_code(sets it tonull)
Required header for AJAX requests. Must be set to XMLHttpRequest for all checkout requests.
XMLHttpRequestPossible values: Session cookie header (e.g. sessionid=abc123 or osessionid=<session_id>)
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.
WELCOME2024Voucher code processed
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'"Voucher code processed
{
"context_list": [],
"errors": {}
}Last updated
Was this helpful?

