Set loyalty money amount to apply to the order
Specifies the amount of loyalty money the user wishes to apply to the current order. The submitted amount is stored in the checkout session and used when the payment is finalized.
Two input modes are supported:
Legacy mode — submit
loyalty_amount_to_useas a flat decimal amount. The system automatically distributes the debit across the user's accounts in label-priority order.Label-based mode — submit
account_usagesas a JSON-encoded array specifying the exact amount to debit from each account label.
When both fields are provided, loyalty_amount_to_use takes precedence and account_usages is discarded.
Required Fields:
At least one of
loyalty_amount_to_useoraccount_usagesmust be present. Submittingnullforloyalty_amount_to_usesets the applied amount to zero.
Validation:
Each entry in
account_usagesmust reference a label the user owns.The requested amount per label must not exceed the available balance for that label.
account_usagesmust be a valid JSON array; a malformed value returns a validation error.
State Update:
The selected payment option, card details, and installment selection are cleared from the checkout session, as loyalty money usage is evaluated independently of credit card payment flows.
loyalty_amount_to_useandloyalty_account_usagesare updated with the submitted values.
Backward Navigation:
Navigating backward from this page does not alter the checkout state.
Next Pages:
This is an independent step; the checkout flow continues to the page determined by the current checkout state.
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>)
The flat loyalty money amount to apply to the order, as a decimal value
with up to 12 digits and 2 decimal places (e.g., "50.00"). When
provided alongside account_usages, this field takes precedence and
account_usages is ignored. Submit 0 or null to remove any
previously applied loyalty money amount.
50.00A JSON-encoded array specifying the loyalty money amount to debit from each account label. Each array item must contain:
label_id: integer primary key of the account label, ornullfor unlabeled accountsamount: decimal string representing the amount to debit from that label group
The requested amount per label must not exceed the user's available
balance for that label. Unlabeled accounts are referenced with
"label_id": null. Malformed JSON returns a validation error.
Ignored when loyalty_amount_to_use is also provided.
[{"label_id": 1, "amount": "25.00"}, {"label_id": null, "amount": "10.00"}]Loyalty money usage amount set successfully
POST /orders/checkout/?page=LoyaltyMoneyUsagePage HTTP/1.1
Host: sandbox.akinon.com
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 33
"loyalty_amount_to_use='50.00'"Loyalty money usage amount set successfully
{
"context_list": [
{
"page_name": "LoyaltyMoneyUsagePage",
"page_slug": "loyaltymoneyusagepage",
"page_context": {
"balance": "85.00",
"accounts": [
{
"label_id": 1,
"label": "Welcome Bonus",
"balance": "25.00",
"currency": "try"
}
]
}
}
],
"pre_order": {
"user_email": "user@akinon.com",
"loyalty_amount_to_use": "50.00",
"payment_option": null
},
"errors": {},
"template_name": "orders/checkout.html"
}Last updated
Was this helpful?

