Customer-facing loyalty program APIs for storefront operations. These endpoints allow customers to manage their loyalty account, earn and redeem points, submit reviews, handle referrals, and track their rewards. All endpoints require customer authentication via JWT token.
- Get customer point transaction history
Storefront APIs
Request
Accepts a referral offer when a new customer uses a referral link.
Referral flow overview:
- Existing customer (referrer) shares referral link
- New customer (referee) clicks link
- Link contains unique token
- New customer signs up or browses
- Call this endpoint with token and email
- System creates referral record
- May generate welcome discount for referee
- Referrer gets points when referee makes purchase
Request body:
- token: Unique referral token from URL (required)
- email: New customer's email address (required)
What this endpoint does:
- Validates referral token is valid
- Checks referral program is active
- Verifies referee hasn't used a referral before
- Creates referral record linking referee to referrer
- Generates welcome discount code (if configured)
- May award immediate points to referee
- Tracks referral for future reward distribution
- Returns discount code for referee to use
Referral rewards configuration: Different merchants configure different rewards:
- Referee discount: Welcome discount for new customer
- Referrer points: Points when referee makes purchase
- Both rewards: Both parties get something
- Tiered rewards: More for higher-value purchases
Token validation:
- Token must exist in system
- Token must belong to active customer
- Customer must have referral program enabled
- Token has no expiration (typically)
- Each token is unique per customer
Duplicate prevention:
- Email can only accept one referral
- Cannot accept own referral
- Cannot accept multiple referrals
- First referral link used is the one that counts
Response includes:
- id: Referral record ID
- message: Success or error message
- discountCode: Welcome discount for referee (if applicable)
- status: SUCCESS or ERROR
Integration points:
Option 1: Signup page integration
// During signup process
const urlParams = new URLSearchParams(window.location.search);
const referralToken = urlParams.get('token');
if (referralToken) {
// After customer enters email
await acceptReferral(referralToken, customerEmail);
// Show welcome discount to customer
}Option 2: Landing page integration
// On referral landing page
const token = getReferralToken();
document.getElementById('claimButton').onclick = async () => {
const email = document.getElementById('email').value;
const response = await acceptReferral(token, email);
showDiscountCode(response.discountCode);
};Referral tracking states:
- PENDING: Referral accepted, waiting for first purchase
- COMPLETED: Referee made qualifying purchase, rewards distributed
- EXPIRED: Referral expired before qualifying purchase
Best practices:
- Call this endpoint early in customer journey
- Store referral token in cookie/session if email not available yet
- Show welcome discount prominently after acceptance
- Explain referral benefits clearly
- Handle already-accepted gracefully
- Track conversion rate of referrals
- A/B test referral incentives
Common error scenarios:
- Invalid token: Token doesn't exist or is malformed
- Referral program inactive: Store disabled referrals
- Already accepted: This email already used a referral
- Self-referral: Customer trying to refer themselves
- Token from excluded customer: Referrer is excluded from program
When rewards are distributed:
- Referee: Welcome discount immediately on acceptance
- Referrer: Points awarded when referee makes first purchase
- Both: May get additional rewards for repeat purchases
- https://loyalty-admin.appstle.com/loyalty/cp/api/referral-rules/accept-offer
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://loyalty-admin.appstle.com/loyalty/cp/api/referral-rules/accept-offer \
-H 'Content-Type: application/json' \
-d '{
"token": "string",
"email": "string"
}'{ "id": 12345, "message": "Referral accepted successfully! Use code WELCOME20 for 20% off your first order.", "discountCode": "WELCOME20", "status": "SUCCESS" }
Request
Retrieves paginated list of point transactions for the authenticated customer, ordered by ID descending (most recent first). Each transaction includes details about points earned or spent, transaction type, status (PENDING, APPROVED, REJECTED), associated order information, and timestamps. Useful for displaying transaction history to customers.
- https://loyalty-admin.appstle.com/loyalty/cp/api/transaction-by-shop
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
'https://loyalty-admin.appstle.com/loyalty/cp/api/transaction-by-shop?page=0&size=1&sort=string'[ { "id": 12345, "shop": "example-store.myshopify.com", "customerId": 67890, "points": 50, "pointType": "EARNED", "note": "Points earned for purchase", "status": "APPROVED", "transactionRule": "ORDER_PLACED", "createAt": "2025-01-15T10:30:00Z", "spentAmount": 99.99 } ]
- https://loyalty-admin.appstle.com/loyalty/cp/api/logged-in-customer
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
https://loyalty-admin.appstle.com/loyalty/cp/api/logged-in-customer12345