Skip to main content

benecaster_get_referral_credit_cents()

Utilities Free
benecaster_get_referral_credit_cents(): int

The credit figure Benecaster last stored from the daily validation run. Cents, not dollars.

It is a cache. Never show it to anyone as their current balance. It refreshes once a day and whenever the Refer a Friend page gets a live answer, so it can be up to a day old, and it stays stale for as long as the licence server is unreachable. It also cannot tell “no credit” from “the lookup failed”: the licence server sends 0 when it cannot read the figure, so a 0 here means either. That is why the Refer a Friend page never displays it.

For display, use benecaster_get_live_referral_balance(). This function is kept for compatibility, and for code that needs a value without a network call and can tolerate it being wrong.

Credit is applied to renewals gradually rather than all at once, up to half of any one invoice, until the balance runs out. So a balance is not the discount on the next bill; it is the total still owed to the podcaster.

Return Value

Type: int

The cached credit figure, in cents. Always an integer, never null: an unlicensed site, a Launch site, a customer with nothing pending and a failed lookup all return 0. Do not show it as the podcaster's balance.

Example

// Do not print this figure as a balance: it is a day-old cache. To show a
// balance, ask for the live one and handle "no answer":
$cents = benecaster_get_live_referral_balance(); // ?int, null = no live answer

Need this built rather than just documented? See our services →