Skip to main content

promocode.core.PromoCode Class

Validates promotional codes to asynchronously return JSON formatted payloads associated with them. More...

Classes

interface  Listener
 Receives the result of validating a promotional code. More...
 

Static Public Member Functions

static void validate (@NonNull final String promoCode, @NonNull final Listener listener)
 Asynchronously validate the promoCode to receive the JSON associated with it. More...
 

Detailed Description

Validates promotional codes to asynchronously return JSON formatted payloads associated with them. Promotional codes must be validated using the class's validate method. The promotional code may be expired or already redeemed enough times to reach the limit set for it in TackleBox, an error response will be sent in these cases.

Member Function Documentation

◆ validate()

static void com.bigfishgames.bfglib.promocode.core.PromoCode.validate (@NonNull final String promoCode,
@NonNull final Listener listener 
)
inlinestatic
Asynchronously validate the promoCode to receive the JSON associated with it. The listener's success method receives a JSON formatted String (format is not checked by the SDK) defined by the game developers/producers. The listener's failure method can receive a JSON formatted String (format is not checked by the SDK) that holds a code and message associated with the error that occurred.An example of a valid payload would be the following:
{
"rewardType": "coins",
"coins": "1000"
}
An example of an error payload would be the following:
{
"errorCode": "abbreviated",
"errorMessage": "Description here"
}
Parameters
promoCodeThe promoCode to validate
listenerThe listener to receive the results of the validation