Wildfire APIs

Coupon Data JSON Structure

7min

Introduction

This document provides an overview of the JSON structure used to store coupon data for various merchant websites. The JSON file contains information about coupon codes and CSS selectors used for auto-applying coupons on specific merchant websites.

Usage

The JSON data is used to facilitate Wildfire Partners to deliver custom coupon codes to our extensions. The extension will retrieve this data on a regular cadence in order to include your custom coupon codes and targets into your extension. The Codes section provides a list of available coupon codes, while the Targets section provides CSS selectors for automating coupon application on websites that are not yet supported.

JSON Structure

The JSON file is organized into an object where each key represents a merchant website's domain name. The structure consists of two primary sections:

  1. Codes: This section contains an array of coupon codes associated with the merchant website.
  2. Targets (optional): This section contains an array of CSS selectors that are used to automatically apply coupons on the merchant website. The targets object is only needed if wildfire doesn’t already support this domain and auto coupon application is desired.

Example

Below is an example of the JSON structure:

JSON


Code Section

The Codes section for each merchant domain contains an array of coupon objects. Each coupon object consists of:

  • ID: A unique identifier for the coupon.
  • Code: The actual coupon code.

Targets Section

The Targets section for each merchant domain contains an array of target objects. Each target object consists of CSS selectors used for specific actions:

  • Input: The selector for the coupon input field (i.e. a text input element).
  • Price: The selector for the price or total amount on the webpage. Note: this should be the total including the tax and shipping as some coupons will result in free shipping.
  • Submit: The selector for the submit button to apply the coupon.
  • Remove: The selector for the remove or cancel button to remove the coupon (if present, some merchants don’t include this functionality, in which case this value should remain empty).
  • Error: The selector for any error messages that may appear (i.e. to describe a code as invalid for the contents of a specific shopping cart).
  • Before: This is an optional selector for when the user must interact with an element to make the coupon input field visible.

Note

  • This JSON structure is adaptable and can be extended to accommodate additional merchant domains as needed.
  • It is essential to keep this JSON file updated with the latest coupon codes and target selectors to ensure proper functionality across various merchant websites.