Skip to content

Commit

Permalink
[PR-18923] Add coupon validation information (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-si-m authored Jan 19, 2023
1 parent 801a999 commit d17fa45
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/advanced_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ each with links to integration details.
:widths: 35 65

* - :ref:`Automatic Coupon Creation <advanced_features/coupons>`
- Issue single and multi-use coupons automatically for your campaigns
- Issue single and multi-use coupons for your campaigns

* - :ref:`Shopify Coupon auto-sync <advanced_features/shopify_coupons_auto_sync>`
- Issue coupons automatically for your Shopify store
Expand Down
34 changes: 30 additions & 4 deletions source/advanced_features/coupons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
.. meta::
:description: You can reward Advocate and their Friend with coupons. Talkable supports both one-time-use coupons as well as multi-use coupons.

Automatic Coupon Creation
=========================
Coupons
=======

You can reward |advocate| and their |friend| with coupons. Talkable supports both
one-time-use coupons as well as multi-use coupons. If you are using one-time-use
Expand All @@ -28,8 +28,8 @@ In this case each, customer will receive unique coupon code from the pool availa

There are several steps that need to be taken for this scenario:

1. Create a coupon list at "Manage Coupon Lists" page
2. Generate a list of coupons on the merchant site using mass coupon generation tool
1. Create a coupon list at ``All reports → Coupon Lists`` page
2. Generate a list of coupons on the merchant site using mass coupon generation tool. Check the `Requirements`_ section before generating coupons.
3. Upload generated coupons to coupon list
4. Use a coupon list in the Incentive with "Coupon Code" reward type

Expand All @@ -43,3 +43,29 @@ Read :ref:`Create Coupon Webhook Documentation <web_hooks/create_coupon>` for im
.. container:: hidden

.. toctree::

Requirements
------------

Coupons should be unique and 3 to 255 characters long.
All coupons would be converted to uppercase, consider that during code generation, ``fr_coupon`` and ``FR_COUPON`` would be equal.

Only the following characters are allowed in a coupon code:

.. code-block:: text
A-Z 0-9 - _ / . % : * + @ & #
.. note::
Spaces are forbidden.

Try to avoid ambiguous characters. This simple solution generates a string of easily readable characters for activation codes.
We do not want people confusing 8 with B, 1 with I, 0 with O, L with 1, etc.

.. code-block:: ruby
# Generates a random string from a set of easily readable characters
def generate_activation_code(size = 6)
charset = ["2", "3", "4", "6", "7", "9", "A", "C", "D", "E", "F", "G", "H", "J", "K", "M", "N", "P", "Q", "R", "T", "V", "W", "X", "Y", "Z"]
(0...size).map { charset[rand(charset.size)] }.join
end

0 comments on commit d17fa45

Please sign in to comment.