Simplify Node.js API Docs

API Docs for:
Show:

Plan Class

Defined in: simplify.js:1783

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.plan.METHOD_NAME(params, function(error, data){
                            if(error){
                                // handle the error
                            }
                        
                            // Awesome...no error, handle the data
                        });
                        

Constructor

Plan

(
  • appKeys
)

Defined in simplify.js:1783

Parameters:

  • appKeys Object

    Object containing the public & private API keys

Item Index

Methods

create

(
  • params
  • callback
)

Defined in simplify.js:1809

Function to create a Plan object.

Parameters:

  • params Object

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

    Valid parameters include:

    • amount : Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00 (REQUIRED)
    • billingCycle : How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles). [default: AUTO]
    • billingCycleLimit : The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
    • currency : Currency code (ISO-4217) for the plan. Must match the currency associated with your account. [default: USD] (REQUIRED)
    • frequency : Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". [default: MONTHLY] (REQUIRED)
    • frequencyPeriod : Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly. [min value: 1, default: 1] (REQUIRED)
    • name : Name of the plan [max length: 50, min length: 2] (REQUIRED)
    • renewalReminderLeadDays : If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
    • trialPeriod : Plan free trial period selection. Must be Days, Weeks, or Month [default: NONE] (REQUIRED)
    • trialPeriodQuantity : Quantity of the trial period. Must be greater than 0 and a whole number. [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.

delete

(
  • A
  • callback
)

Defined in simplify.js:1844

Function to delete a Plan object.

Parameters:

  • A Object

    string ID of the Plan 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:1890

Function to retrieve a Plan object from the API.

Parameters:

  • id String

    The ID of the Plan 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:1861

Function to retrieve a list Plan objects.

Parameters:

  • params Object

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

    Valid parameters include:

    • filter :
      filter.idFilter by the plan Id
      filter.textFilter by the name of the plan
      filter.frequencyFilter by the frequency of the plan
      filter.amountMin & filter.amountMaxThe filter amountMin must be used with amountMax to find plans with plan values between the min and max figures
      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.qYou can use this to filter by the Id, the name or the amount of the plan

      *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
      • amount
      • frequency
      • name
      • id

    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:1907

Function to update a Plan object.

Parameters:

  • params Object

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

    Valid parameters include:

    • id : A string ID of the Plan object to update
    • name : Name of the plan. [min length: 2] (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.