Skip to main content

getReferralCodeForUser

Available

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
EnvironmentURL
Productionhttps://bankapi.cheggout.com/api/getReferralCodeForUser
UAThttps://bankapi-uat.cheggout.com/api/getReferralCodeForUser

Authentication — signed envelope — CHANNELID, SIGN, BDATA

You do not need this for the SDK or microsite paths

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​

FieldTypeDescription
virtualIdstringThe customer's pseudonymous identifier
channelNamestringYour channel, matching CHANNELID on the envelope
programmeNamestringThe referral programme the code belongs to, agreed at onboarding
Payload before encoding (synthetic)
{
"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​

FieldTypeDescription
referralCodestringThe customer's code for this programme
Response (synthetic)
{
"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.

Treat a referral code as customer data

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.

Next​