Simplify Node.js API Docs

API Docs for:
Show:

Customer Class

Defined in: simplify.js:764

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

Constructor

Customer

(
  • appKeys
)

Defined in simplify.js:764

Parameters:

  • appKeys Object

    Object containing the public & private API keys

Item Index

Methods

create

(
  • params
  • callback
)

Defined in simplify.js:790

Function to create a Customer object.

Parameters:

  • params Object

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

    Valid parameters include:

    • card.addressCity : City of the cardholder. (REQUIRED)
    • card.addressCountry : Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. (REQUIRED)
    • card.addressLine1 : Address of the cardholder (REQUIRED)
    • card.addressLine2 : Address of the cardholder if needed. (REQUIRED)
    • card.addressState : State of residence of the cardholder. State abbreviations should be used. (REQUIRED)
    • card.addressZip : Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. (REQUIRED)
    • card.cvc : CVC security code of the card. This is the code on the back of the card. Example: 123 (REQUIRED)
    • card.expMonth : Expiration month of the card. Format is MM. Example: January = 01 (REQUIRED)
    • card.expYear : Expiration year of the card. Format is YY. Example: 2013 = 13 (REQUIRED)
    • card.id : ID of card. Unused during customer create.
    • card.name : Name as appears on the card. (REQUIRED)
    • card.number : Card number as it appears on the card. [max length: 19, min length: 13]
    • email : Email address of the customer (REQUIRED)
    • name : Customer name [max length: 50, min length: 2] (REQUIRED)
    • reference : Reference field for external applications use.
    • subscriptions.amount : Amount of payment in the smallest unit of your currency. Example: 100 = $1.00
    • subscriptions.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]
    • subscriptions.billingCycleLimit : The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
    • subscriptions.coupon : Coupon associated with the subscription for the customer.
    • subscriptions.currency : Currency code (ISO-4217). Must match the currency associated with your account.
    • subscriptions.currentPeriodEnd : End date of subscription's current period
    • subscriptions.currentPeriodStart : Start date of subscription's current period
    • subscriptions.customer : The customer ID to create the subscription for. Do not supply this when creating a customer.
    • subscriptions.frequency : Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
    • subscriptions.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.
    • subscriptions.name : Name describing subscription [max length: 50]
    • subscriptions.plan : The plan ID that the subscription should be created from.
    • subscriptions.quantity : Quantity of the plan for the subscription. [min value: 1]
    • subscriptions.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.
    • subscriptions.source : Source of where subscription was created
    • token : If specified, card associated with card token will be used

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

Function to delete a Customer object.

Parameters:

  • A Object

    string ID of the Customer 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:892

Function to retrieve a Customer object from the API.

Parameters:

  • id String

    The ID of the Customer 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:863

Function to retrieve a list Customer objects.

Parameters:

  • params Object

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

    Valid parameters include:

    • filter :
      filter.idFilter by the customer Id
      filter.textCan use this to filter by the name, email or reference for the customer
      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

      *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
      • id
      • name
      • email
      • reference

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

Function to update a Customer object.

Parameters:

  • params Object

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

    Valid parameters include:

    • id : A string ID of the Customer object to update
    • card.addressCity : City of the cardholder. (REQUIRED)
    • card.addressCountry : Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. (REQUIRED)
    • card.addressLine1 : Address of the cardholder. (REQUIRED)
    • card.addressLine2 : Address of the cardholder if needed. (REQUIRED)
    • card.addressState : State of residence of the cardholder. State abbreviations should be used. (REQUIRED)
    • card.addressZip : Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters. (REQUIRED)
    • card.cvc : CVC security code of the card. This is the code on the back of the card. Example: 123 (REQUIRED)
    • card.expMonth : Expiration month of the card. Format is MM. Example: January = 01 (REQUIRED)
    • card.expYear : Expiration year of the card. Format is YY. Example: 2013 = 13 (REQUIRED)
    • card.id : ID of card. If present, card details for the customer will not be updated. If not present, the customer will be updated with the supplied card details.
    • card.name : Name as appears on the card. (REQUIRED)
    • card.number : Card number as it appears on the card. [max length: 19, min length: 13]
    • email : Email address of the customer (REQUIRED)
    • name : Customer name [max length: 50, min length: 2] (REQUIRED)
    • reference : Reference field for external applications use.
    • token : If specified, card associated with card token will be added to the customer

    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.