Skip to main content
To allow Gameball to track rewards, events, and progress for each user, your app must register or identify the customer after login or during onboarding.
This step links all Gameball activity to the correct player profile.

1. Basic Customer Initialization

Use initializeCustomer whenever a user logs in, registers, or updates their information.
🔒
Secure API Access: To benefit from v4.1 secure API endpoints, pass the sessionToken parameter when calling methods (required in upcoming SDK v4). This enables automatic routing to v4.1 secure endpoints. Learn more about v4.1 →
Swift (Completion Handler)
Swift(Asyn/Await)

2. Request Parameters

customerId
String
required
Permanent unique identifier for the customer. Should never change.
email
String
Customer email address.
mobile
String
Mobile number formatted with country code.
deviceToken
String
Push notification token (Firebase FCM or Huawei Push Kit).
pushProvider
PushProvider
Push provider (.firebase or .huawei).
customerAttributes
CustomerAttributes
Structured attributes such as name, DOB, language, and custom fields.
referralCode
String
Referral code used when registering a referred customer.
isGuest
Bool
Indicates if this user is a guest session (default: false).
sessionToken
String
Optional override for global session token for this request only. Required in upcoming SDK v4.

3. Validation Rules

InitializeCustomerRequest validates:
  • customerId cannot be empty
  • If pushProvider is provided → deviceToken is required
  • If deviceToken is provided → pushProvider is required
If validation fails, the SDK returns an error before sending the request.

4. Customer Attributes

You can enrich customer profiles with additional metadata.

5. Advanced Examples

With Push Notifications


With Referral Code


Guest User


Full Customer Profile Example

Use a permanent, unchanging customer ID.
Do NOT use email or phone number as they can change.
Call initializeCustomer immediately after successful login or registration so Gameball can keep the profile updated.