Skip to main content
Retrieve referral statistics for the currently logged-in customer, including a summary of referral statuses and individual referral details.

Usage

MageSDK.getCustomerReferralStats().then(function(resp) {
  if (resp.success) {
    console.log('Total referrals:', resp.data.summary.totalReferrals);
    console.log('Completed:', resp.data.summary.completed);
  }
});

Response

success
boolean
Whether the request was successful.
data.summary
object
Aggregated referral statistics.
data.referrals
array
List of individual referrals.

Sample response

{
  "success": true,
  "data": {
    "summary": {
      "totalReferrals": 5,
      "pending": 2,
      "friendConverted": 1,
      "completed": 2,
      "expired": 0,
      "availableRewards": 1
    },
    "referrals": [
      {
        "id": "ref_abc",
        "friendEmail": "friend@example.com",
        "status": "completed",
        "createdAt": "2024-06-01T12:00:00.000Z"
      }
    ]
  }
}