Simplify Node.js API Docs

API Docs for:
Show:

Coupon Class

Defined in: simplify.js:583

This is a Simplify domain object. In order to get access to a domain object, a client needs to be created. The client is then used to invoke the different methods e.g.

var client = Simplify.getClient({
                            publicKey: 'YOUR_PUBLIC_API_KEY',
                            privateKey: 'YOUR_PRIVATE_API_KEY'
                        });
                        
                        client.coupon.METHOD_NAME(params, function(error, data){
                            if(error){
                                // handle the error
                            }
                        
                            // Awesome...no error, handle the data
                        });
                        

Constructor

Coupon

(
  • appKeys
)

Defined in simplify.js:583

Parameters:

  • appKeys Object

    Object containing the public & private API keys

Item Index

Methods

create

(
  • params
  • callback
)

Defined in simplify.js:609

Function to create a Coupon object.

Parameters:

  • params Object

    A map of parameters in which to create the Coupon from.

    Valid parameters include:

    • amountOff : Amount off of the price of the product in the smallest units of the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00 [min value: 1]
    • couponCode : Code that identifies the coupon to be used. [max length: 25, min length: 3] (REQUIRED)
    • description : A brief section that describes the coupon. [max length: 1024]
    • durationInMonths : DEPRECATED - Duration in months that the coupon will be applied after it has first been selected. [min value: 1, max value: 9999]
    • endDate : Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone.
    • maxRedemptions : Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1, max value: 10000]
    • numTimesApplied : The number of times a coupon will be applied on a customer's subscription. [min value: 1, max value: 9999]
    • percentOff : Percentage off of the price of the product. While this field is optional, you must provide either amountOff or percentOff for a coupon. The percent off is a whole number. [min value: 1, max value: 100]
    • startDate : First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone. (REQUIRED)

    NOTE: Any parameters with a sub-parameter (e.g. param.subParam) need to be nested when passed as an argument in e.g.

    {
                                                        param: {
                                                        subParam1: 'value', 
                                                        subParam2: 'value'
                                                    }
                                                }
  • callback Function

    A function to handle success/error responses from the API.
    The function takes 2 parameters, the first is an error object. This is null if no error occurs. The second parameter is the response data. This is null if an error occurs.

delete

(
  • A
  • callback
)

Defined in simplify.js:643

Function to delete a Coupon object.

Parameters:

  • A Object

    string ID of the Coupon to delete.

  • callback Function

    A function to handle success/error responses from the API.
    The function takes 2 parameters, the first is an error object. This is null if no error occurs. The second parameter is the response data. This is null if an error occurs.

find

(
  • id
  • callback
)

Defined in simplify.js:689

Function to retrieve a Coupon object from the API.

Parameters:

  • id String

    The ID of the Coupon to retrieve

  • callback Function

    A function to handle success/error responses from the API.
    The function takes 2 parameters, the first is an error object. This is null if no error occurs. The second parameter is the response data. This is null if an error occurs.

list

(
  • params
  • callback
)

Defined in simplify.js:660

Function to retrieve a list Coupon objects.

Parameters:

  • params Object

    A map of parameters in which to define the Coupon list from.

    Valid parameters include:

    • filter :
      filter.idFilter by the coupon Id
      filter.textFilter by the coupon code
      filter.dateCreatedMinFilter by the minimum created date you are searching for - Date in UTC millis
      filter.dateCreatedMaxFilter by the maximum created date you are searching for - Date in UTC millis
      filter.startDateMinFilter by the minimum coupon start date you are searching for - Date in UTC millis
      filter.startDateMaxFilter by the maximum coupon start date you are searching for - Date in UTC millis
      filter.endDateMinFilter by the minimum coupon end date you are searching for - Date in UTC millis
      filter.endDateMaxFilter by the maximum coupon end date you are searching for - Date in UTC millis

      *Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates
    • max : Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
    • offset : Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
    • sorting : Allows for ascending or descending sorting of the list. The value maps properties to the sort direction (either 'asc' for ascending or 'desc' for descending).
      Sortable properties are:
      • dateCreated
      • maxRedemptions
      • timesRedeemed
      • id
      • startDate
      • endDate
      • percentOff
      • couponCode
      • durationInMonths
      • numTimesApplied
      • amountOff

    NOTE: Any parameters with a sub-parameter (e.g. param.subParam) need to be nested when passed as an argument in e.g.

    {
                                                        param: {
                                                        subParam1: 'value', 
                                                        subParam2: 'value'
                                                    }
                                                }
  • callback Function

    A function to handle success/error responses from the API.
    The function takes 2 parameters, the first is an error object. This is null if no error occurs. The second parameter is the response data. This is null if an error occurs.

update

(
  • params
  • callback
)

Defined in simplify.js:706

Function to update a Coupon object.

Parameters:

  • params Object

    A map of parameters on which to update the Coupon object.

    Valid parameters include:

    • id : A string ID of the Coupon object to update
    • endDate : The ending date in UTC millis for the coupon. This must be after the starting date of the coupon.
    • maxRedemptions : Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time. [min value: 1]

    NOTE: Any parameters with a sub-parameter (e.g. param.subParam) need to be nested when passed as an argument in e.g.

    {
                                                        param: {
                                                        subParam1: 'value', 
                                                        subParam2: 'value'
                                                    }
                                                }
  • callback Function

    A function to handle success/error responses from the API.
    The function takes 2 parameters, the first is an error object. This is null if no error occurs. The second parameter is the response data. This is null if an error occurs.