Skip to content

Create Promo Code

You can create Promo Codes on the Dashboard or using the SDK.

Create on Dashboard

To create a Promo Code from our Dashboard, follow the steps below:

  1. Login into the GetSocial Dashboard.
  2. Click on Create new code from the sidebar menu or from the Promo Codes section.
    Create Link on the Dashboard
  3. (Optional) Specify a code or leave the field empty to let the Dashboard generate a 5-chars code for you.
  4. (Optional) Define a time period during which the code can be claimed.
  5. (Optional) Limit the amount of times that the code can be claimed.
  6. (Optional) Include key-value pairs to the code with extra information. This custom data will be available when the code is claimed.
  7. Click Create.

Create on SDK

To create new Promo Code use createPromoCode method:

PromoCodes.create(PromoCodeContent.createRandomCode(), { result: PromoCode ->
    Log.d("PromoCodes", "Promo code created: $result")
}, { error: GetSocialError ->
    Log.d("PromoCodes", "Failed to send notifications: $error")
PromoCodes.create(PromoCodeContent.withRandomCode(), success: { promoCode in
    print("Promo Code successfully created: \(promoCode.code)")
}) { error in
    print("Failed to create Promo Code, error: \(error)")
    (promoCode) => {
        Debug.Log("Promo code created: " + promoCode.Code);
    (error) => {
        Debug.Log("Failed to create promo code, error: " + error);
PromoCodes.create(PromoCodeContent.withRandomCode()).then((promoCode) => {
    console.log('Promo code created: ' + promoCode.code);
}, (error) => {
    console.log('Failed to create promo code, error: ' + error);

You can create Promo Code with randomly generated code(5 symbols) or provide a code.

Create with random code

To create a Promo Code with random code:

val promoCode = PromoCodeContent.createRandomCode()
let promoCode = PromoCodeContent.withRandomCode()
var promoCode = PromoCodeContent.CreateRandomCode();
const promoCode = PromoCodeContent.withRandomCode();

Create with provided code

Promo codes can contain only numbers, small and big letters. The length of code should not be more than 16 symbols. To create Promo Code:

val code : String = ... // your code
val promoCode = PromoCodeContent.createWithCode(code)
let code: String = ... // your code
let promoCode = PromoCodeContent.withCode(code)
var code = ... // your code
var promoCode = PromoCodeContent.CreateWithCode(code);
const code = ... // your code
const promoCode = PromoCodeContent.withCode(code);

Setup promo code limitations

For now you can set next limitations:

  • Time span when promo code is active.
  • Maximum claim count for all users.

Time limitations

By default Promo Code is active from the moment of creation and forever(unless you disable it manually on the Dashboard). To set time limits:

val startDate : Date = ... // when promo code should start being active
val endDate : Date = ... // when promo code should stop beign active
val promoCode = PromoCodeContent.createRandomCode()
    .withTimeLimit(startDate, endDate)
let startDate: Date = ... // when promo code should start being active
let endDate: Date = ... // when promo code should stop being active
let promoCode = PromoCodeContent.withRandomCode()
promoCode.setTimeLimit(start: startDate, end: endDate)
DateTime startDate = ... // when promo code should start being active
DateTime endDate = // when promo code should stop being active
var promoCode = PromoCodeContent.CreateRandomCode();
promoCode.SetTimeLimit(startDate, endDate);
const promoCode = PromoCodeContent.withRandomCode();
promoCode.setTimeLimit(startDate, endDate);

Max claims count

If you want to limit the number of users who can claim Promo Code, you can use max claim count. If it is set to some number n, only first n users can successfully claim the code, all next attempts will result in error. By default max claim count is 0 which means there is no limit. To set max claim count:

val maxClaimCount : Int = ... // your limitation
val promoCode = PromoCodeBuilder.createRandomCode()
let maxClaimCount: UInt = ... // your limitation
let promoCode = PromoCodeContent.withRandomCode()
promoCode.maxClaims = maxClaimCount
var maxClaimCount = ... // your limitation
var promoCode = PromoCodeContent.CreateRandomCode();
promoCode.MaxClaimCount = maxClaimCount;
const maxClaimCount = ... // your limitation
const promoCode = PromoCodeContent.withRandomCode();
promoCode.maxClaimCount = maxClaimCount;

Attach custom data

You can attach key-value pairs of strings to Promo Code and get them later to have more details which promotions or referrals it holds.

val customData : Map<String, String> = ...
val promoCode = PromoCodeContent.createRandomCode()
    .addProperty("key", "value")  // you can attach single pair
    .addProperties(customData) // or entire map
let promoCode = GetSocialPromoCodeBuilder.withRandomCode()
promoCode.setProperties(value: "value1", key: "key1")  // you can attach single key-value pair = ["key1" : "value1"] // or entire map
var promoCode = PromoCodeContent.CreateRandomCode();
promoCode.AddProperties(new Dictionary<string, string>() {
    { "key1", "value1" },
    { "key2", "value2" },
const promoCode = PromoCodeContent.withRandomCode();['key1'] = 'value1';['key2'] = 'value2';

Next steps

Give us your feedback! Was this article helpful?

😀 🙁