Coupon codes
You can generate unique coupon codes as part of defining a coupon. The coupon codes can be imported from an external system and can be exported to an external system. The coupon codes can be optionally assigned to individual customers.
To generate unique coupon codes, you must define the character sets along with the format. After you define the character sets, you must assign them to a single character abbreviation. This abbreviation is used (for each character position in the generated coupon code) when defining format of the codes to generate as part of a coupon definition. These character sets can be assigned to each position of generated string.
- ABC → a
- ABCXYZ → A
- 电双医国宝德 → c
- 1234567890 → d
- aA1bB2cC3 → m
In addition, you also need to define the coupon policy. Coupon policy defines the length of the coupon code, at what position and how many characters of Coupon Id must be part of the generated coupon code. There must be one coupon policy per pricing organization.
- Number of unique coupon codes to generate.
- Format of the coupon codes to generate.
- CouponID Prefix – First N characters of CouponID are included as part of the generated coupon code. The CouponID can appear as the Prefix, Suffix or can be inserted at a defined position in the code string.
For example, DADD-xxxx-MMMMM is a generated coupon code, where D, A, x, M are character set abbreviations for each position. Each position in the generated coupon code can be specified by using a character, which represents a character set. Some sample character sets are provided with the application. Administrators can also define their own character sets.
The full code string in the generated coupon code is a combination of the CouponID and the CodeFormat string. For example, if the coupon policy defines that the first 4 characters of the CouponID must be used and the CouponID must be inserted a position 0, with a CodeFormat of 'DDD-XXX' and a CouponID=Coupon1, the coupon codes that are generated are: Coup393-HKE, Coup839-UDK and Coup424-HWC.
Unique coupon codes are generated and stored in a temporary CSV file to export. Once a coupon is set up, the application can validate from any given unique coupon code, whether it falls under the current coupon definition or not.
Redeemed coupons are stored in the promotion usage so that they can be validated when user tries to use them again.
For more information about implementing coupon codes, see Javadoc.
Coupon code validation
The validateCoupon API accepts multiple coupon codes against a coupon definition to validate. Coupon codes are passed as references. References can be external or internal. These references are validated against generated or imported coupon codes if ValidateReferences is passed as Y. CouponID is derived from first reference in the input.