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
Whether the request was successful.
Aggregated referral statistics.
Total number of referrals made.
Referrals that haven’t been acted on yet.
Referrals where the friend has signed up but not yet completed the required action.
Fully completed referrals.
Referrals that have expired.
Number of unclaimed referral rewards.
List of individual referrals.
Email address of the referred friend.
Current status ("pending", "friend_converted", "completed", "expired").
ISO 8601 timestamp of when the referral was created.
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"
}
]
}
}