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

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:

  1. Legacy mode — submit loyalty_amount_to_use as a flat decimal amount. The system automatically distributes the debit across the user's accounts in label-priority order.

  2. Label-based mode — submit account_usages as 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_use or account_usages must be present. Submitting null for loyalty_amount_to_use sets the applied amount to zero.

Validation:

  • Each entry in account_usages must reference a label the user owns.

  • The requested amount per label must not exceed the available balance for that label.

  • account_usages must 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_use and loyalty_account_usages are 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.

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
loyalty_amount_to_usenumber · nullableOptional

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.

Example: 50.00
account_usagesstring · nullableOptional

A 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, or null for unlabeled accounts
  • amount: 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.

Example: [{"label_id": 1, "amount": "25.00"}, {"label_id": null, "amount": "10.00"}]
Responses
200

Loyalty money usage amount set successfully

application/json
errorsone of · nullableOptional
or
string[]Optional
template_namestringOptional
post/orders/checkout/?page=LoyaltyMoneyUsagePage
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'"
200

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?