Integrate your coupon system
Integrating Coupon system with Gameball
For Gameball to be able to communicate with your coupon system successfully, we need to know some information about your coupon system. Specifically, we require the endpoint responsible for creating coupons.
We refer to this information as configurations, which you can set up from your dashboard. In this guide, we will provide an in-depth explanation of these configurations and help you choose the configuration example that matches your case, so you can complete the necessary configuration.
Coupon system Configurations
We will start by defining the configurations needed to integrate your coupon system with Gameball. To start Integrating you have to define the following in your dashboard :
The URL/Endpoint in your coupon system responsible for creating coupons, for example in WooCommerce Integration example the URL is https://example.com/wp-json/wc/v3/coupons.
The type of the HTTP method, usually it is of type POST
The authentication required to talk with this URL/endpoint, for example, WooCommerce endpoint Authentication method is OAuth1.0, so you have to define in the headers body in configuration the consumer key and consumer secret.
The query parameters need to passed to the URL.
The payload(data) sent in the request body, it contains data related to the coupon, for example, the code, expiryDate, etc..
To know more details about configuration visit this index.
Now we will go deeper on the payload configuration, payload represents structure of the json body of the HTTP request which is going to be send to the endpoint responsible for creating coupons at your coupon system, since different coupon systems can have different payload structure and param names.
Each client can define his own payload using variables to be replaced by Gameball during request creation, for example, if your coupon system API requires the following attributes in the body of create coupon request :
code(required)
amount(required)
playerEmail(optional)
the payload configuration should looks like this
The attribute names inside curly brackets represents coupon attributes in Gameball, these names are fixed, these name are mapped to their respective attributes in your coupon system, for example, if a customer in your system with email (test@gameball.co) wants to redeem a coupon with value of 50EGP and the code is 50EGP0FF, Gameball backend will replace the keys inside each curly brackets {{}} with actual values so the payload sent after replacing attribute values based each attribute name should looks like :
If you changed the name of 'playerEmail' attribute to email, then the payload configuration should updated and look like this
To view more attributes, you can look at the payload table above.
Payload attributes are optional, you should send attributes based on your preferences or in case of integrating an e-commerce CMS coupon system you will send attributes marked as required in the CMS coupon system documentation.
Most of the payload attributes are optional, deciding whether to add an attribute or not depends on your coupon system itself, if you are using an existing coupon system like the WooCommerce example then you will find that code attribute is required so the body should at-least looks like this
If you want integrate with a CMS or web-builder coupon system and utilize their coupon API you should go through this guide :
If you want to create/use your own custom coupon API you should go through this guide :
Last updated