Loyalty Card
Retrieves the authenticated user's loyalty card information including available points balance.
This endpoint fetches both local loyalty card data and queries the external loyalty system for current points balance. Points are cached for 2 minutes to reduce external API calls.
Response Scenarios:
Success: Returns card details with points balance
No Card: Returns null card with 0 points
Points Query Failed: Returns card details with error message in
errorsfield
Use Cases:
Display loyalty card information on account page
Show available points before checkout
Verify loyalty account status
Check points balance for redemption
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osssionid=abc123Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: Successfully retrieved loyalty card details
Authentication required
GET /loyalty-card/loyalty_card/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osssionid=abc123
Accept: */*
{
"card": {
"pk": 1,
"attributes": {
"account_number": "3839200"
},
"created_date": "2025-05-30T07:45:21.383195Z",
"modified_date": "2025-05-30T07:45:21.383222Z",
"number": "+966123457799",
"user": {
"pk": 92,
"username": "fe710061d9d32af17b96f38bf49ee29655ae8b19682e10b1a8d02d6f79c35520",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"is_active": true,
"date_joined": "2025-05-30T07:45:20.915321Z",
"last_login": "2025-05-30T07:45:21.240293Z",
"email_allowed": false,
"sms_allowed": false,
"call_allowed": null,
"gender": "male",
"attributes": {
"confirmed": true,
"logged_ip": "192.168.1.100",
"verified_user": true,
"register_client_type": "default"
},
"phone": "+966123457799",
"date_of_birth": "1990-12-10",
"attributes_kwargs": {},
"user_type": "registered",
"modified_date": "2025-05-30T07:45:21.812607Z"
}
},
"points": 150,
"errors": null
}Returns current user information for loyalty card registration form, or redirects if user already has a loyalty card.
Use Cases:
Pre-fill registration form with user data
Check if user already has loyalty card
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osssionid=abc123Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: User information for registration form
Redirect to loyalty-card page (user already has card)
Authentication required
GET /loyalty-card/add_loyalty_card/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osssionid=abc123
Accept: */*
{
"pk": 92,
"username": "fe710061d9d32af17b96f38bf49ee29655ae8b19682e10b1a8d02d6f79c35520",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"is_active": true,
"date_joined": "2025-05-30T07:45:20.915321Z",
"last_login": "2025-05-30T07:45:21.240293Z",
"email_allowed": false,
"sms_allowed": false,
"call_allowed": null,
"gender": "male",
"attributes": {
"register_client_type": "default"
},
"phone": "+966123457799",
"date_of_birth": "1990-12-10",
"attributes_kwargs": {},
"user_type": "registered",
"modified_date": "2025-05-30T07:45:21.812607Z"
}Creates a loyalty card for the authenticated user with SMS verification flow.
SMS Verification Flow (when enabled):
First Request (without code):
Submit registration data without
codefieldSystem generates 4-digit verification code
SMS sent to provided phone number
Code stored in session as
confirmation_dataReturns 202 Accepted with submitted data
Resend Request:
Submit same data with
resend: trueNew code generated and sent
Returns 200 OK with success message
Final Request (with code):
Submit complete data including
codefieldSystem validates phone and code match session
Creates loyalty account in external system
Creates local LoyaltyCard record
Sets user attributes:
has_loyalty=true,verified_user=trueOptionally syncs user data if
is_sync=trueReturns 201 Created with card details
Without SMS Verification:
If client has
verify_sms=false, skips verificationDirectly creates account on first request
Returns 201 Created immediately
Account Creation Logic:
Searches for existing account in external system first
If found, links existing account
If not found, creates new account
Local LoyaltyCard record always created
Configuration Dependencies:
CUSTOMER_LOYALTY_CARD_SERVICEmust be configuredClient
verify_smsattribute controls verification requirementis_sync=trueenables automatic user data sync
Use Cases:
New user loyalty card registration
SMS-verified account creation
Link existing external loyalty account
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osessionid=abc123; csrftoken=def456CSRF token for state-changing requests
def456Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: User's first name
JohnUser's last name
DoeConsent for email marketing
falseExample: falseConsent for SMS marketing
falseExample: falseConsent for phone calls
nullGender type enumeration.
Supported values:
male- Malefemale- Femaleunknown- Unknown/Prefer not to say
malePossible values: User's date of birth (YYYY-MM-DD)
1990-12-10Phone number in international format (E.164)
+966123457799Pattern: ^\+?1?\d{9,15}$SMS verification code (required on second submission)
1234Request to resend SMS verification code
falseExample: falseSMS verification code resent successfully
Loyalty card successfully created
SMS verification code sent, awaiting verification
Validation error or verification failed
Authentication required
POST /loyalty-card/add_loyalty_card/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osessionid=abc123; csrftoken=def456
X-Csrftoken: def456
Content-Type: application/json
Accept: */*
Content-Length: 181
{
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"gender": "male",
"date_of_birth": "1990-12-10",
"phone": "+966123457799",
"email_allowed": false,
"sms_allowed": false
}{
"message": "success"
}Creates a loyalty card for users who have already completed OTP verification through other means.
This endpoint bypasses SMS verification and directly creates the loyalty account. It's intended for scenarios where:
User already verified during registration
Verification handled by external system
SMS verification not required for loyalty enrollment
Account Creation Process:
Validates submitted data
Creates loyalty account in external system (or links existing)
Creates local LoyaltyCard record
Sets user attribute:
has_loyalty=trueOptionally syncs user data if
is_sync=true
Differences from Standard Registration:
No SMS verification step
Does not set
verified_userattributeSingle-step process (no session state)
No code validation
Use Cases:
Post-registration loyalty enrollment
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osessionid=abc123; csrftoken=def456CSRF token for state-changing requests
def456Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: Loyalty card successfully created without SMS verification
Validation error
Authentication required
POST /loyalty-card/add_loyalty_card_otp/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osessionid=abc123; csrftoken=def456
X-Csrftoken: def456
Content-Type: application/json
Accept: */*
Content-Length: 200
{
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"gender": "male",
"date_of_birth": "1990-12-10",
"phone": "+966123457799",
"email_allowed": false,
"sms_allowed": true,
"call_allowed": null
}{
"card": {
"pk": 2,
"attributes": {
"account_number": "3839201"
},
"created_date": "2025-06-01T10:20:15.123456Z",
"modified_date": "2025-06-01T10:20:15.123456Z",
"number": "+966123457799",
"user": {
"pk": 93,
"username": "8f21a0a7c3e4b2d9f1e7c8a4b6d5f3e2a1c9b7d8e6f4a3c2b1d9e8f7a6b5c4d3",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"is_active": true,
"date_joined": "2025-06-01T10:15:00.000000Z",
"last_login": "2025-06-01T10:15:30.000000Z",
"email_allowed": false,
"sms_allowed": true,
"call_allowed": null,
"gender": "male",
"attributes": {
"has_loyalty": true,
"register_client_type": "default"
},
"phone": "+966123457799",
"date_of_birth": "1990-12-10",
"attributes_kwargs": {},
"user_type": "registered",
"modified_date": "2025-06-01T10:20:15.500000Z"
}
},
"redirect_url": "omnishop_loyaltycard:loyalty-card"
}Retrieves current loyalty card information from external system for update form.
Use Cases:
Display current loyalty card info before update
Pre-fill update form with existing values
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osssionid=abc123Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: Current loyalty card information from external system
Redirect to loyalty-card page (no card exists)
Authentication required
GET /loyalty-card/update_loyalty_card/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osssionid=abc123
Accept: */*
{
"card": {
"first_name": "John",
"last_name": "Doe",
"phone": "+966123457799",
"email": "[email protected]",
"gender": "male",
"date_of_birth": "1990-12-10",
"email_allowed": false,
"sms_allowed": true,
"call_allowed": null
}
}Updates loyalty card information in both external system and local database.
Synchronization:
If
is_sync=truein config, updates local user profileSynchronizes: first_name, last_name, phone, gender, date_of_birth, preferences
External system always updated
Use Cases:
Update contact information
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osessionid=abc123; csrftoken=def456CSRF token for state-changing requests
def456Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: Phone number (must be unique, cannot match other active users)
+966123457799Pattern: ^\+?1?\d{9,15}$User's first name
JohnUser's last name
DoeConsent for email marketing
falseExample: falseConsent for SMS marketing
falseExample: trueConsent for phone calls
nullGender type enumeration.
Supported values:
male- Malefemale- Femaleunknown- Unknown/Prefer not to say
malePossible values: User's date of birth
1990-12-10Loyalty card successfully updated
Validation error
Authentication required
User has no loyalty card
POST /loyalty-card/update_loyalty_card/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osessionid=abc123; csrftoken=def456
X-Csrftoken: def456
Content-Type: application/json
Accept: */*
Content-Length: 172
{
"phone": "+966123457799",
"first_name": "John",
"last_name": "Smith",
"email_allowed": false,
"sms_allowed": true,
"call_allowed": false,
"gender": "male",
"date_of_birth": "1990-12-10"
}{
"card": {
"phone": "+966123457799",
"first_name": "John",
"last_name": "Smith",
"email_allowed": false,
"sms_allowed": true,
"call_allowed": false,
"gender": "male",
"date_of_birth": "1990-12-10"
},
"redirect_url": "omnishop_loyaltycard:loyalty-card"
}Retrieves loyalty card information for deletion confirmation screen.
Use Cases:
Display card info before deletion
Confirmation screen data
Verify card to be deleted
Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: Loyalty card information for deletion confirmation
Redirect to loyalty-card page (no card exists)
Authentication required
GET /loyalty-card/delete_loyalty/ HTTP/1.1
Host: sandbox.akinon.com
Accept: */*
{
"card": {
"pk": 1,
"attributes": {
"account_number": "3839200"
},
"created_date": "2025-05-30T07:45:21.383195Z",
"modified_date": "2025-05-30T07:45:21.383222Z",
"number": "+966123457799",
"user": {
"pk": 92,
"first_name": "John",
"last_name": "Doe",
"phone": "+966123457799"
}
}
}Deletes the user's loyalty card from the local database.
Deletion Process:
Retrieves user's loyalty card
Optionally notifies external system (implementation-dependent)
Deletes local LoyaltyCard record
Returns 204 No Content on success
Important Notes:
Local LoyaltyCard record always deleted
External account may or may not be deactivated (depends on implementation)
User attributes (
has_loyalty) not automatically clearedAction is irreversible
Post-Deletion State:
User no longer has loyalty card in local system
Cannot query points or use points
Can create new loyalty card later
Use Cases:
User requests account deletion
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osessionid=abc123; csrftoken=def456CSRF token for state-changing requests
def456Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: Loyalty card successfully deleted (no content returned)
Authentication required
User has no loyalty card to delete
POST /loyalty-card/delete_loyalty/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osessionid=abc123; csrftoken=def456
X-Csrftoken: def456
Accept: */*
No content
Searches for an existing loyalty account in the external system and creates a local LoyaltyCard link if found.
Search Process:
Queries external loyalty system with provided criteria
If account found, creates local LoyaltyCard record
Links local user to external loyalty account
Sets user attribute:
has_loyalty=trueReturns card number on success
Search Criteria:
Email (required): Primary search field
Phone (optional): Additional matching criterion
Date of birth (optional): Additional matching criterion
Multiple fields improve match accuracy
Response Scenarios:
Account Found (201): Local card created, returns number
Account Not Found (200): No match in external system, returns message
No Account Creation:
This endpoint only links existing accounts
Does not create new external loyalty accounts
If account not found, user must use registration endpoints
Use Cases:
Link existing loyalty account during first login
Migrate users from external system
Connect pre-existing loyalty members
Use the X-Cookie header instead of the Cookie header in the “TEST IT” section. When testing via Postman or other external tools, continue using the standard Cookie header. Some commerce applications may use 'sessionid' instead of 'osessionid'. Set 'ENABLE_X_COOKIE_HEADER = True' in your project environments to enable the “TEST IT” feature. This setting should be applied only for the “TEST IT” button.
osessionid=abc123; csrftoken=def456CSRF token for state-changing requests
def456Language preference (for multilingual content). Supported languages: tr, en, ar, ru, de, fr
trExample: trPossible values: Phone number to search for
+966123457799Pattern: ^\+?1?\d{9,15}$Date of birth for additional matching
1990-12-10No existing account found in external system
Existing account found and local card created
Validation error
Authentication required
POST /loyalty-card/search_exists_create/ HTTP/1.1
Host: sandbox.akinon.com
X-Cookie: osessionid=abc123; csrftoken=def456
X-Csrftoken: def456
Content-Type: application/json
Accept: */*
Content-Length: 56
{
"email": "[email protected]",
"phone": "+966123457799"
}{
"message": "not find remote account"
}Last updated
Was this helpful?

