Coupon Webhook
This article describes how you can integrate coupon webhooks to receive coupon creation requests generated from Growlytics.
Introduction
You can use webhook subscriptions to receive coupon creation notifications when coupon is generated for a given customer by Growlytics. After you've subscribed to coupon creation webhook, you can let your app execute code immediately after for given coupon.
Considerations
Coupon webhook is a POST request. All the data will be passed in JSON format in the HTTP post body.
With each webhook request, you will receive customer id, coupon id (of Growlytics), and discount rules that you have specified in Growlytics dashboard.
Webhook Property
Data Type
Description
id
string
Growlytics Coupon id
customerId
string
Customer id of your system, if customer is identified. If coupon is sent and customer is not identified, this field will remain null.
code
string
Coupon code sent to customer.
name
string
Coupon name specified in growlytics.
couponType
string
'fixedAmount' or 'percentage' or 'freeShipping'
discountValue
number
If coupon type is "fixedAmount", then this value represents amount of discount. If coupon type is "percentage", this value will be percentage of discount. If coupon type is "freeShipping", you can ignore this field.
applicableOn
string
"Order" if discount is on entire order. "product" if discount to be applied on specific products. "collection" if discount to be applied on specific collections.
applicableFilters
Array Of String
If applicableOn is "product", this field will be array of products. If applicableOn is "collection", this field will be array of collections. For rest, you can ignore this field.
minOrderAmount
number
Minimum order amount for discount to be applicable.
usageLimitType
string
"once" or "multiple"
expiryType
string
"relative" or "date". Right now only relative is supported by Growlytics. "date" is coming soon.
expiryUnit
string
Unit of expiry. It will be one of "hour" or "day".
expiryValue
number
number of hours or days. Depending on expiryUnit specified.
Webhook Examples
Let's take a few examples and understand what input you will get in http call for different scenarios.
Example 1: $100 off on entire order, if order amount is greater than $1500, coupon expires in 15 days
Example 2: 10% OFF on selected products, If order amount is greater than 10k, coupon expires in 48 hours
Example 3: Free Shipping, If order amount is greater than 10k and shipping amount is more than $500, coupon expires in 48 hours
Last updated