Product API: These endpoints are part of the Loyalty API. All endpoints begin with: /api/v1/loyalty/

Validate Member

POST Validate Member
member_read
/api/v1/loyalty/members/validate

Check if a phone number is a member of a specific loyalty card (points or stamps).

Step by Step

1

Collect Phone Number

Get the customer's phone number in E.164 format (e.g., +21612345678).

2

Send Validation Request

Send POST request to members/validate endpoint with card_id and phone_number.

3

Check Response

The is_member field tells you if they're signed up.

Request Body

{
  "card_id": 5,
  "phone_number": "+21612345678",
  "include_member_data": false
}

card_id (integer, required) - The loyalty card ID
phone_number (string, required) - Phone number to validate
include_member_data (boolean, optional) - Include full member details

Response

{
  "success": true,
  "data": {
    "card_id": 5,
    "phone_number": "+21612345678",
    "is_member": true,
    "validated_at": "2025-01-15T10:30:00Z"
  }
}

Create Member

POST Create Member
member_write Member Auth Required
/api/v1/loyalty/members

Create a new member account and automatically associate them with the card.

Requires OTP Verification: You must first request an OTP via the member authentication endpoint.

Step by Step

1

Request OTP

Send POST request to /api/v1/auth/member/request-otp with member's email.

2

Verify OTP

Send POST request to /api/v1/auth/member/verify-otp to get X-Member-Token.

3

Create Member

Send POST request to members/ with token in X-Member-Token header.

Headers

X-App-Id: app_abc123...
X-Api-Key: test_xyz789...
X-Member-Token: eyJ0eXAiOiJKV1QiLCJhbGc...
Content-Type: application/json

Request Body

{
  "card_id": 5,
  "name": "John Doe",
  "email": "john@example.com",
  "phone_number": "+21612345678",
  "verification_code": "123456"
}

Get Member Profile

GET Get Profile
member_read Member Auth Required
/api/v1/loyalty/members/{id}

Retrieve member profile and balance for a specific card.

Response

{
  "success": true,
  "data": {
    "member": {
      "id": 123,
      "name": "John Doe",
      "email": "john@example.com",
      "phone": "+21612345678",
      "created_at": "2025-01-15T10:30:00Z"
    },
    "card": {
      "id": 5,
      "name": "Premium Coffee Card",
      "reward_system": "points",
      "points_balance": 150,
      "joined_at": "2025-01-15T10:30:00Z"
    }
  }
}

Update Member Profile

PATCH Update Profile
member_write Member Auth Required
/api/v1/loyalty/members/{id}

Update member name and communication preferences.

Request Body

{
  "name": "John Doe",
  "accepts_emails": true,
  "accepts_text_messages": false
}
ESC