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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
GetSocial.createPromoCode(PromoCodeBuilder.createRandomCode(), new Callback<PromoCode>() {
    @Override
    public void onSuccess(final PromoCode result) {
        Log.d("GetSocial", "Promo Code successfully created: " + result.getCode());
    }

    @Override
    public void onFailure(GetSocialException exception) {
        Log.d("GetSocial", "Failed to create Promo Code, error: " + exception.getMessage());
    }
})
1
2
3
4
5
6
7
8
9
GetSocial.createPromoCode(PromoCodeBuilder.createRandomCode(), object : Callback<PromoCode> {
    override fun onSuccess(promoCode: PromoCode) {
        println("Promo Code successfully created: ${promoCode.code}")
    }

    override fun onFailure(exception: GetSocialException) {
        println("Failed to create Promo Code, error: ${exception.message}")
    }
})
1
2
3
4
5
6
7
[GetSocial createPromoCode:[GetSocialPromoCodeBuilder withRandomCode]
        success:^(GetSocialPromoCode *_Nonnull promoCode) {
            NSLog(@"Promo code successfully created: %@", promoCode.code);
        }
        failure:^(NSError *_Nonnull error) {
            NSLog(@"Failed to create Promo Code, error: %@", error);
        }];
1
2
3
4
5
GetSocial.createPromoCode(GetSocialPromoCodeBuilder.withRandomCode(), success: { promoCode in
    print("Promo Code successfully created: \(promoCode.code)")
}) { error in
    print("Failed to create Promo Code, error: \(error)")
}
1
2
3
4
5
6
7
GetSocial.CreatePromoCode(PromoCodeBuilder.WithRandomCode(), promoCode =>
{
    Debug.Log("Promo Code created successfully: " + promoCode.Code);
}, error =>
{
    Debug.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:

1
PromoCodeBuilder promoCode = PromoCodeBuilder.createRandomCode();
1
val promoCode = PromoCodeBuilder.createRandomCode()
1
GetSocialPromoCodeBuilder *promoCode = [GetSocialPromoCodeBuilder withRandomCode];
1
let promoCode = GetSocialPromoCodeBuilder.withRandomCode()
1
var promoCode = PromoCodeBuilder.CreateRandomCode();

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:

1
2
String code = ... ; // your code
PromoCodeBuilder promoCode = PromoCodeBuilder.createWithCode(code);
1
2
val code : String = ... // your code
val promoCode = PromoCodeBuilder.createWithCode(code)
1
2
NSString *code = ... ; // your code
GetSocialPromoCodeBuilder *promoCode = [GetSocialPromoCodeBuilder withCode:code];
1
2
let code: String = ... // your code
let promoCode = GetSocialPromoCodeBuilder.withCode(code)
1
2
string code = ... ; // your code
var promoCode = PromoCodeBuilder.CreateCode(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:

1
2
3
4
Date startDate = ... ; // when promo code should start being active
Date endDate = ... ; // when promo code should stop beign active
PromoCodeBuilder promoCode = PromoCodeBuilder.createRandomCode()
    .withTimeLimit(startDate, endDate);
1
2
3
4
val startDate : Date = ... // when promo code should start being active
val endDate : Date = ... // when promo code should stop beign active
val promoCode = PromoCodeBuilder.createRandomCode()
    .withTimeLimit(startDate, endDate)
1
2
3
4
NSDate *startDate = ... ; // when promo code should start being active
NSDate *endDate = ... ; // when promo code should stop beign active
GetSocialPromoCodeBuilder *promoCode = [GetSocialPromoCodeBuilder withRandomCode];
[promoCode setTimeLimitWithStartDate:startDate endDate:endDate];
1
2
3
4
let startDate: Date = ... // when promo code should start being active
let endDate: Date = ... // when promo code should stop beign active
let promoCode = GetSocialPromoCodeBuilder.withRandomCode()
promoCode.setTimeLimitWithStart(startDate, end: endDate)
1
2
3
4
DateTime startDate = ... ; // when promo code should start being active
DateTime endDate = ... ; // when promo code should stop beign active
var promoCode = PromoCodeBuilder.CreateRandomCode()
    .WithTimeLimit(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:

1
2
3
int maxClaimCount = ... ; // your limitation
PromoCodeBuilder promoCode = PromoCodeBuilder.createRandomCode()
    .withMaxClaimCount(maxClaimCount);
1
2
3
val maxClaimCount : Int = ... // your limitation
val promoCode = PromoCodeBuilder.createRandomCode()
    .withMaxClaimCount(maxClaimCount)
1
2
3
uint maxClaimCount = ... ; // your limitation
GetSocialPromoCodeBuilder *promoCode = [GetSocialPromoCodeBuilder withRandomCode];
[promoCode setMaxClaimCount:maxClaimCount];
1
2
3
let maxClaimCount: uint = ... // your limitation
let promoCode = GetSocialPromoCodeBuilder.withRandomCode()
promoCode.setMaxClaimCount(maxClaimCount)
1
2
3
uint maxClaimCount = ... ; // your limitation
var promoCode = PromoCodeBuilder.CreateRandomCode()
    .WithMaxClaimCount(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.

1
2
3
4
Map<String, String> customData = ... ;
PromoCodeBuilder promoCode = PromoCodeBuilder.createRandomCode()
    .addData("key", "value") // you can attach single pair
    .addData(customData); // or entire map
1
2
3
4
val customData : Map<String, String> = ...
val promoCode = PromoCodeBuilder.createRandomCode()
    .addData("key", "value")  // you can attach single pair
    .addData(customData) // or entire map
1
2
3
GetSocialPromoCodeBuilder *promoCode = [GetSocialPromoCodeBuilder withRandomCode];
[promoCode addDataValue:@"value" forKey:@"key"]; // you can attach single pair
[promoCode addData:@{ @"key1", @"value1" }]; // or entire map
1
2
3
let promoCode = GetSocialPromoCodeBuilder.withRandomCode()
promoCode.addDataValue("value", forKey: "key") // you can attach single pair
promoCode.addData(["key1" : "value1"]) // or entire map
1
2
3
4
Dictionary<string, string> customData = ... ;
var promoCode = PromoCodeBuilder.CreateRandomCode()
    .AddData("key", "value") // you can attach single pair
    .AddData(customData); // or entire dictionary

Next steps

Give us your feedback! Was this article helpful?

😀 🙁