Promotional Codes
Below are the steps required to apply a promotional code on an order:
Step 1: Creating a promo code
The promo code needs to be setup in our system prior to being used. This can be done by contacting your account manager.
There are two types of promo codes that can be setup on our system.
- One-Time Use: This type can only be used once by a customer. Once the code is used, it will automatically be deactivated.
- Multi-Use: Can be used by any number of times over a certain date range.
Step 2: Validating the promo code
Prior to adding the promo code to the order, the front end system should validate that the promo code is valid. This can be done by passing in the promo code supplied by the user to the v9/promotions_code
endpoint.
Step 3: Applying the promo code
There are a few attributes that need to get pulled out from the JSON response:
value
details the amount that needs to get applied to determine the discount
percentage
identifies if the promo code is a flat dollar amount or a percentage of the ticket price. If this value is true
, then you need to treat the value as a percentage. If false
then just apply the value as the discount.
Once you have the value and percentage boolean, you need to create the discount calculated with the promo code.
For the following examples, lets assume a 12% promo code and the per ticket price is $50 and the customer is buying 2 tickets.
percentage = true
discount = (quantity * per_ticket_price) * (value/100)
discount = (2 * 50) * (12/100) = 12
When posting the order you will need to add the following attributes to the order post:
promo_code
discount
See Creating an Order - Request for the details.
Example request:
curl -i \
-X GET \
-H "X-Signature: TBeLVakySNIByymDM6ncPEMbbeyhVrlBGB+JGXCRGiI=" \
-H "X-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--url 'https://api.sandbox.ticketevolution.com/v9/promotion_codes?code=example_promo_code'
Example response for valid code:
{
"total_entries":1,
"current_page":1,
"per_page":100,
"promotion_codes":[
{
"id":208,
"url":"/promotion_codes/208",
"created_at":"2018-05-04T19:21:48Z",
"updated_at":"2018-05-04T19:21:48Z",
"value":12.0,
"percentage":true,
"name":"Example Promo Code",
"code":"example_promo_code",
"start_date":null,
"end_date":null,
"active":true,
"one_time_use":false
}
]
}
Example response for invalid code:
{
"total_entries":0,
"current_page":1,
"per_page":100,
"promotion_codes":[
]
}