getReferralCodeForUser
Returns the referral code for one customer on one referral programme. This exists for the CRM entry point — your campaign system needs the code before it can send a WhatsApp, SMS or email inviting the customer to refer friends.
POST /api/getReferralCodeForUser
| Environment | URL |
|---|---|
| Production | https://bankapi.cheggout.com/api/getReferralCodeForUser |
| UAT | https://bankapi-uat.cheggout.com/api/getReferralCodeForUser |
Authentication — signed envelope — CHANNELID,
SIGN, BDATA
On those paths the referral centre resolves the code itself once the customer is authenticated. Call this endpoint only when your system needs the code in its own hands. See Entry points.
Request
BDATA payload
| Field | Type | Description |
|---|---|---|
virtualId | string | The customer's pseudonymous identifier |
channelName | string | Your channel, matching CHANNELID on the envelope |
programmeName | string | The referral programme the code belongs to, agreed at onboarding |
{
"virtualId": "pub_8f14e45fceea167a",
"channelName": "YOURCHANNEL",
"programmeName": "YOURCHANNEL_REFERRAL"
}
TBD The published material does not mark these fields mandatory or optional, and
does not state what a channel with a single programme should send for programmeName. Confirm both
during onboarding.
Response
| Field | Type | Description |
|---|---|---|
referralCode | string | The customer's code for this programme |
{
"referralCode": "ZGFKMJ"
}
Using it in a campaign
A code is stable for a given customer and programme, so fetch it when you build the campaign audience and cache it against the customer record. There is no need to call per send, and no need to call again on a resend.
Build the outbound link so the code travels into your own signup funnel:
https://<your-domain>/apply?referralCode=ZGFKMJ
Your apply flow persists referralCode against the application, and passes it back as
subEventType on RegisterEvent when the account is activated.
A code identifies a specific customer within your programme. Do not put codes in shared logs,
analytics events keyed to other people, or support tickets, and do not expose an endpoint that
returns a code for an arbitrary virtualId to your front end.
Errors
TBD Error responses for this endpoint are not published. Handle a missing or empty
referralCode by excluding the customer from the campaign rather than sending a broken message, and
see Error codes for the platform conventions.