# Loyalty

Loyalty account and point movements

## Get Total Loyalty Balance

> Returns the user's total loyalty (points) balance.\
> \
> \*\*Business Logic:\*\*\
> \- Aggregates balances from all loyalty accounts for the active session currency\
> \- Returns a single \`balance\` value (Decimal, 2 fractional digits)\
> \- Multi-currency supported: separate balance per currency\
> \- Filtered by session currency\
> \
> \*\*Notes:\*\*\
> \- Only returns balance for the active session currency\
> \- If balance is 0: no account in this currency OR fully consumed

```json
{"openapi":"3.1.0","info":{"title":"Account API - Loyalty & Offers Module","version":"1.0.0"},"tags":[{"name":"Loyalty","description":"Loyalty account and point movements"}],"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/account","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"cookieAuth":[]}],"paths":{"/loyalty-account-balance/":{"get":{"tags":["Loyalty"],"summary":"Get Total Loyalty Balance","description":"Returns the user's total loyalty (points) balance.\n\n**Business Logic:**\n- Aggregates balances from all loyalty accounts for the active session currency\n- Returns a single `balance` value (Decimal, 2 fractional digits)\n- Multi-currency supported: separate balance per currency\n- Filtered by session currency\n\n**Notes:**\n- Only returns balance for the active session currency\n- If balance is 0: no account in this currency OR fully consumed","operationId":"getLoyaltyAccountBalance","parameters":[{"$ref":"#/components/parameters/CookieHeader"},{"$ref":"#/components/parameters/AcceptLanguageHeader"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoyaltyBalanceResponse"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}},"components":{"parameters":{"CookieHeader":{"name":"X-Cookie","in":"header","description":"Use X-Cookie header instead of Cookie header in \"try out\" section.\nUse Cookie header while testing in postman or other tools.\nSome commerce applications may support 'sesionid' instead of 'osessionid'.","required":true,"schema":{"type":"string"}},"AcceptLanguageHeader":{"name":"Accept-Language","in":"header","description":"Language preference (for multilingual content).\nSupported languages: tr, en, ar, ru, de, fr","required":false,"schema":{"type":"string","enum":["tr","en","ar","ru","de","fr"],"default":"tr"}}},"schemas":{"LoyaltyBalanceResponse":{"type":"object","description":"Loyalty balance response","required":["balance"],"properties":{"balance":{"type":"number","format":"decimal","description":"Total loyalty balance (in active currency).\nIf balance is 0: either no account in this currency or fully consumed."}}},"ErrorResponse":{"type":"object","description":"Standard error response","required":["detail"],"properties":{"detail":{"type":"string","description":"Human-readable error message"},"code":{"type":"string","description":"Error code (if any)"},"field_errors":{"type":"object","description":"Field-level errors (for validation failures)","additionalProperties":{"type":"array","items":{"type":"string"}}}}}},"responses":{"UnauthorizedError":{"description":"Authentication credentials were not provided.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```

## List Loyalty Transfers

> Lists the user's loyalty point transfer history.\
> \
> \*\*Business Logic:\*\*\
> \- Includes both point earnings and spendings\
> \- Each transfer: amount, transaction date, related order number, currency\
> \- Sorted newest first (\`-pk\`)\
> \- Supports pagination\
> \- Filtered by session currency\
> \
> \*\*Transfer Types:\*\*\
> \- \*\*Positive values:\*\* Point earning (credit) – post-order accrual\
> \- \*\*Negative values:\*\* Point spending (debit) – usage during checkout\
> \
> \*\*Related Data:\*\*\
> \- Each transfer is linked to a \`LoyaltyTransaction\`\
> \- Transaction contains an order number (\`order.number\`)\
> \- Transaction date (\`transaction.created\_date\`) is also returned

```json
{"openapi":"3.1.0","info":{"title":"Account API - Loyalty & Offers Module","version":"1.0.0"},"tags":[{"name":"Loyalty","description":"Loyalty account and point movements"}],"servers":[{"description":"Server base URL for basket operations","url":"https://{commerce_url}/account","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce server URL"}}}],"security":[{"cookieAuth":[]}],"paths":{"/loyalty/":{"get":{"tags":["Loyalty"],"summary":"List Loyalty Transfers","description":"Lists the user's loyalty point transfer history.\n\n**Business Logic:**\n- Includes both point earnings and spendings\n- Each transfer: amount, transaction date, related order number, currency\n- Sorted newest first (`-pk`)\n- Supports pagination\n- Filtered by session currency\n\n**Transfer Types:**\n- **Positive values:** Point earning (credit) – post-order accrual\n- **Negative values:** Point spending (debit) – usage during checkout\n\n**Related Data:**\n- Each transfer is linked to a `LoyaltyTransaction`\n- Transaction contains an order number (`order.number`)\n- Transaction date (`transaction.created_date`) is also returned","operationId":"getLoyaltyTransfers","parameters":[{"$ref":"#/components/parameters/CookieHeader"},{"$ref":"#/components/parameters/PageParameter"},{"$ref":"#/components/parameters/PageSizeParameter"},{"$ref":"#/components/parameters/AcceptLanguageHeader"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedLoyaltyTransferList"}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}},"components":{"parameters":{"CookieHeader":{"name":"X-Cookie","in":"header","description":"Use X-Cookie header instead of Cookie header in \"try out\" section.\nUse Cookie header while testing in postman or other tools.\nSome commerce applications may support 'sesionid' instead of 'osessionid'.","required":true,"schema":{"type":"string"}},"PageParameter":{"name":"page","in":"query","description":"Page number (starts from 1)","required":false,"schema":{"type":"integer","minimum":1,"default":1}},"PageSizeParameter":{"name":"page_size","in":"query","description":"Number of records per page","required":false,"schema":{"type":"integer","minimum":1,"default":10}},"AcceptLanguageHeader":{"name":"Accept-Language","in":"header","description":"Language preference (for multilingual content).\nSupported languages: tr, en, ar, ru, de, fr","required":false,"schema":{"type":"string","enum":["tr","en","ar","ru","de","fr"],"default":"tr"}}},"schemas":{"PaginatedLoyaltyTransferList":{"type":"object","description":"Paginated loyalty transfer list","required":["count","results"],"properties":{"count":{"type":"integer","description":"Total record count"},"next":{"type":["string","null"],"format":"uri","description":"Next page URL (if any)"},"previous":{"type":["string","null"],"format":"uri","description":"Previous page URL (if any)"},"results":{"type":"array","description":"Records for the current page","items":{"$ref":"#/components/schemas/LoyaltyTransfer"}}}},"LoyaltyTransfer":{"type":"object","description":"Loyalty transfer entry (point movement)","required":["amount","currency","created_date","transaction"],"properties":{"amount":{"type":"string","format":"decimal","description":"Transfer amount (returned as string).\n- Positive: Point earning (credit)\n- Negative: Point spending (debit)"},"currency":{"$ref":"#/components/schemas/EnumValue","description":"Currency"},"created_date":{"type":"string","format":"date-time","description":"Transfer creation date (ISO 8601)"},"transaction":{"$ref":"#/components/schemas/LoyaltyTransaction","description":"Related loyalty transaction"}}},"EnumValue":{"type":"object","description":"Enum value (value + label pair)","required":["value","label"],"properties":{"value":{"type":"string","description":"Enum code value"},"label":{"type":"string","description":"Human readable label"}}},"LoyaltyTransaction":{"type":"object","description":"Loyalty transaction record","required":["order","created_date"],"properties":{"order":{"type":"string","description":"Related order number"},"created_date":{"type":"string","format":"date-time","description":"Transaction creation date (ISO 8601)"}}},"ErrorResponse":{"type":"object","description":"Standard error response","required":["detail"],"properties":{"detail":{"type":"string","description":"Human-readable error message"},"code":{"type":"string","description":"Error code (if any)"},"field_errors":{"type":"object","description":"Field-level errors (for validation failures)","additionalProperties":{"type":"array","items":{"type":"string"}}}}}},"responses":{"UnauthorizedError":{"description":"Authentication credentials were not provided.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}
```
