Record or Register a New Customer

Create a customer account; Returns a unique Account ID.

See more

Update Customer Information

Update a customer account with new information.

See more

Generate a New Customer Card Number

Creates a random card number of a given length and checks that this number is unique and not in use already in the account.

See more

Batch Import Customers

Import one or more customers at a time.

See more

Customer - Search

Search for a customer within each given field. As opposed to Customer - Find, which finds a customer across all fields.

See more

Customer - Find

Finds a customer across all fields. As opposed to Customer - Search which searches only inside each given fields.

See more

Retrieve Customer Information

Retrieves a customer's information and campaigns' balances.

See more

Customer Balance and Transaction History

Returns a customer's balance and transaction history for a particular campaign.

See more

Delete a Customer

Deletes a customer from the account PERMANENTLY.

See more

Customer Password Validation

Returns whether a customer's password is valid or not.

See more

Customer Card Replace

Updates a customer's card_number and/or unique code with new ones, based on partial customer data matching.

See more
Back to Top

Record or Register a New Customer

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type record_customer Required
customer_action new or register Required
account_id greatwidgets Required
campaign_id 1234567890123456

or

12344234,1234234,1234124

Optional
card_number 1212121212 Optional
card_number_generate (# of digits) Optional
code 89898989898989 Optional
new_code Yes Optional
first_name John Optional
last_name Doe Optional
phone 555-555-2455 Optional
email test@email.com Optional
street1 123 Main St. Optional
street2 Apt 3G Optional
city Anytown Optional
state ZZ Optional
postal_code 55555 Optional
country New Zealand Optional
custom_date 1970-07-14 Optional
custom_field John likes cheese. Optional
customer_username jdoe1970 Optional
customer_password ilovecheese Optional
customer_PIN 1234 Optional
custom_field_## 1kg Emental Cheese

or

2012.07.28 22:59:59

or

Gouda,Emental,Swiss

Optional
auto_add 1500 Optional
send_no_email true Optional or
don't include.
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • 'code' should be provided as the internal ID for the customer of the application that is sending the data.
  • If the application that is sending the data uses the 'card_number' as their unique Customer ID, then insert it as BOTH 'code' and 'card_number' entries.
  • If the application that is sending the data does not have an internal unique ID for a customer, do not include the 'code' entry:
    • If this is a "customer_action = new" call, the 'card_number' will be used as the 'code' and that's what will be returned in the API response. If you don't want that to happen, then include the code_new parameter set to Yes to force the generation of a 16-digit UID.
    • In either case, if your application can, record the 'code' transmitted back, and include it with all transactions associated with this customer. If not, don't worry. You can always query the API for the 'code' associated with a card_number for future transactions recording.
  • If you want the program to generate a random unique card number, then include the card_number_generate field with the number of digits for the card number to be generated.
  • All optional fields are optional individually, but at least ONE must be passed along.
  • If the customer_action tag is set to new and a customer record is sent that matches an existing record, an error will be generated.
  • If the customer_action tag is set to register, the card_number field must match an existing record in the database, and the customer_password field must not have been previously set (in the database). If both these conditions are true, and both a card_number and valid customer_password are given, then the user information is recorded and the status returned will be "registered". Otherwise, an error message will be returned saying that the card has already been registered.
  • The 'campaign_id' is optional, can be provided either singly or as a comma separated list.
    • If not given, a customer will be recorded into the system, but won't "belong" to any campaign (until a transaction is added for that customer to a campaign)
    • If only a single campaign ID is provided, the customer will be recorded and an "Activation" transaction recorded in the given campaign.
    • If a list of campaign_ids is given, then an "activation" transaction will be recorded for each campaign in the list.
  • Notes:
    • "Activation" transactions do not affect campaign balances.
    • A customer "belongs" to a campaign when they have any sort of transaction in that campaign.
  • The 'custom_date' must be in YYYY-MM-DD format. (Any other format cannot be resolved without further context. Ex: 04-03-2010 could be either April 3rd or 4th of March. Don't even get us started on inputs like 04-06-05... What the heck is THAT?. Also this format conforms to ISO-8601.)
  • The customer_username is an API-specific field made available for custom applications. It cannot be defined or edited in the web interface.
  • The customer_password field is made available for custom applications such as a customer"hotsite". It can be defined or edited in the web interface.
  • The customer_PIN is an API-specific field made available for custom applications such as a physical terminal. It cannot be defined or edited in the web interface.
  • To automatically add an amount to a customer's account in the campaign specified above, when using this call, the optional auto_add parameter lets you specify the amount of points, visits, dollars, or name of product or service, depending on the campaign type, to add. For example, as a thank-you bonus for signing-up, you would user auto_add = "25" (which will add 25 points to the customer's account balance.)
  • The send_no_email is an API-specific field that if included will suppress the normal email that is generated and sent to the account owner letting them know about the new customer and their information (for example to send a plastic card to.)
  • custom_field_## must be first defined by through the Custom Fields - Create API call, and can be listed by first calling the Custom Fields - List API call. The content of a custom field must match its type. So for example, if a custom field expects a date / time stamp, it will reject with an error anything but that format.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id']        = 'john1970';
              $data['user_password'] 	= '1959caadac9b13dcb3';	
              $data['type'] = 'record_customer';
              $data['customer_action'] = 'new';
              $data['account_id'] = 'greatwidgets';
              	$data['campaign_id']    = '1234567890123456';
              	$data['card_number']		  = '1212121212';
              or: $data['card_number_generate'] = 10; // for 10-digit number.
              	$data['code']			       	= '89898989898989';
              	$data['first_name']		   = 'John';
              	$data['last_name']			   = 'Doe';
              	$data['phone']			      	= '555-555-2455';
              	$data['email']			      	= 'test@yourdomain.com';
              	$data['custom_date']	  	= '1970-07-14';
              	$data['street1']	     		= '123 Main St.';
              	$data['street2']	     		= 'Apt 3G';
              	$data['city']			       	= 'Anytown';
              	$data['state']		      		= 'ZZ';
              	$data['postal_code']  		= '55555';
              	$data['country']	     		= 'New Zealand';
              $data['custom_field'] = 'John likes cheese.';
              $data['customer_username'] = 'jdoe1970';
              $data['customer_password'] = 'ilovecheese';
              $data['customer_PIN'] = '1234';
              $data['custom_field_2'] = 'Single';
          

Success XML Response (New Customer):


              <response status="success">
                  <customer status="new">
                      <code>1234567890123456</code>
                      //only when card_number_generate is set:
                      <card_number>1234567890</card_number>  
                  </customer>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Update Customer Information

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type record_customer Required
customer_action edit Required
account_id greatwidgets Required
code 89898989898989 Optional
new_code Yes Optional
card_number 1212121212 Optional
card_number_generate (# of digits) Optional
first_name John Optional
last_name Doe Optional
phone 555-555-2455 Optional
email test@email.com Optional
street1 123 Main St. Optional
street2 Apt 3G Optional
city Anytown Optional
state ZZ Optional
postal_code 55555 Optional
country New Zealand Optional
custom_date 1970-07-14 Optional
custom_field John likes cheese. Optional
customer_username jdoe1970 Optional
customer_password ilovecheese Optional
customer_PIN 1234 Optional
custom_field_## 1kg Emental Cheese

or

2012.07.28 22:59:59

or

Gouda,Emental,Swiss

Optional
send_no_email true Optional or
don't include.
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • 'code' is required to update an EXISTING customer as it is the internal ID for the customer.
  • If it is NOT included, a NEW customer will be created, and the API response will return a randomly generated 16-digit unique id as the 'code'.
  • If the code is given, but it matches NO existing customer, a NEW customer will be created with the information given.
  • In either case, if your application can, record the 'code' transmitted back, and include it with all transactions associated with this customer. If not, don't worry. You can always query the API for the 'code' associated with a card_number for future transactions recording.
  • If only a card_number is passed on an "edit" call, it will first try to match it to an existing card_number. If there's multiple matches, it will return an error. If there's a single match, it will assume that record to be the correct one, and proceed with the edit, and return the pre-existing "code" of the record that was matched and modified. If no matching card_number is found, it will attempt one last match at the "code", and if it finds a single "code" that matches the card_number, then it will update that record and return that "code". (In both cases, "edit" also means that whatever card_number existed will be replaced by the one used in this API call.) If there's no match, as mentioned above, it will create a new record and return a random 16-digit "code".
  • If you want the program to generate a random unique card number, then include the card_number_generate field with the number of digits for the card number to be generated.
  • All optional fields are optional individually, but at least ONE must be passed along.
  • If the customer_action tag is set to edit, and the customer data matches an existing record, the existing record will be updated with the new information and a status of "update" will be returned in the response. If instead, no match is found, a new customer will be created with the information passed, and the status returned will be "new"
  • The 'custom_date' must be in YYYY-MM-DD format. (Any other format cannot be resolved without further context. Ex: 04-03-2010 could be either April 3rd or 4th of March. Don't even get us started on inputs like 04-06-05... What the heck is THAT?. Also this format conforms to ISO-8601.)
  • The customer_username is an API-specific field made available for custom applications. It cannot be defined or edited in the web interface.
  • The customer_password field is made available for custom applications such as a customer"hotsite". It can be defined or edited in the web interface.
  • The customer_PIN is an API-specific field made available for custom applications such as a physical terminal. It cannot be defined or edited in the web interface.
  • To automatically add an amount to a customer's account in the campaign specified above, when using this call, the optional auto_add parameter lets you specify the amount of points, visits, dollars, or name of product or service, depending on the campaign type, to add. For example, as a thank-you bonus for signing-up, you would user auto_add = "25" (which will add 25 points to the customer's account balance.)
  • The send_no_email is an API-specific field that if included will suppress the normal email that is generated and sent to the account owner letting them know about the new customer and their information (for example to send a plastic card to.)
  • custom_field_## must be first defined by through the Custom Fields - Create API call, and can be listed by first calling the Custom Fields - List API call. The content of a custom field must match its type. So for example, if a custom field expects a date / time stamp, it will reject with an error anything but that format.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id']        = 'john1970';
              $data['user_password'] 	= '1959caadac9b13dcb3';	
              $data['type'] = 'record_customer';
              $data['customer_action'] = 'edit';
              $data['account_id'] = 'greatwidgets';
              	$data['code']			       	= '89898989898989';
              	$data['card_number']		  = '1212121212';
              or: $data['card_number_generate'] = 10; // for 10-digit number.
              	$data['first_name']		   = 'John';
              	$data['last_name']			   = 'Doe';
              	$data['phone']			      	= '555-555-2455';
              	$data['email']			      	= 'test@yourdomain.com';
              	$data['custom_date']	  	= '1970-07-14';
              	$data['street1']	     		= '123 Main St.';
              	$data['street2']	     		= 'Apt 3G';
              	$data['city']			       	= 'Anytown';
              	$data['state']		      		= 'ZZ';
              	$data['postal_code']  		= '55555';
              	$data['country']	     		= 'New Zealand';
              $data['customer_username'] = 'jdoe1970';
              $data['customer_password'] = 'ilovecheese';
              $data['customer_PIN'] = '1234';
              $data['custom_field_2'] = 'Single';
          

Success XML Response (Update Customer):


              <response status="success">
                  <customer status="update">
                      <code>1234567890123456</code>
                      //only when card_number_generate is set:
                      <card_number>1234567890</card_number>
                  </customer>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Generate a New Customer Card Number

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
account_id greatwidgets Required
type generate_card_number Required
how_many_digits (# of digits) Optional
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output


Notes:

  • The how_many_digits parameter is optional: if it is not given, it will default to 16 digits.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id']        = 'john1970';
              $data['user_password'] 	= '1959caadac9b13dcb3';	
              $data['account_id'] = 'greatwidgets';
              $data['type'] = 'generate_card_number';
              or: $data['how_many_digits'] = 10; // for 10-digit number.

          

Success XML Response:


              <response status="success">
                  <customer>
                    <card_number>1234567890</card_number> 
                  </customer>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Batch Import Customers

The data to be submitted to the API is composed of the following fields:

field Example Note
API 1.5 Required
user_id john1970 Required
user_api_key 1959caadac9b13dcb3 Required
account_id greatwidgets Required
type customers_batch Required
delimiter pipe or comma or tab Required
overwrite_duplicates yes or update or ignore See Note
allow_undo yes Optional: 'yes'
or don't include.
card_number_generate (# of digits) Optional - See Note
campaigns_to_include 89898989989
or
aaaa,bbbb, cccc
At least one is required. If more than one, separate by comma.
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Headers:

Determines the order of the fields, separated by the delimiter, given in the data:

field Example Note
profiles_header_1 card_number At least one is required

profiles_header_2 code (customer UID)
profiles_header_3 first_name
etc... last_name
email
phone
custom_date
street1
street2
city
state
postal_code
country
customer_username
customer_password
customer_PIN
auto_add
custom_field_1 Note:

Use the Customer Fields - List
API call to determine the name (custom_field_##) of any added custom fields.

custom_field_2
custom_field_3
etc...

Import data:

field Example Note
profiles_data (see below)
Data to be imported in batch:
One single (text) field with "end-of-lines" (ex: \n and/or \r) at the end of each line:

11223344|11223344|jane|doe|1970-07-14|555-5555

22334455|22334455|jim|mcdoe|1966-07-28|555-5556

33445566|33445566|larry|smith|1980-02-05|555-5557

Notes:

  • Number the profiles_header_## fields in increasing order. Do not skip more than one!
  • You can change the order of the fields, just keep the profiles_header_## numbering from 1 to the number of fields you are using.
  • The difference in the settings for overwrite_duplicates is:
    • yes (overwrite): In case of a match, this option will blank out all existing fields/data for that customer, and replace with the data given.
    • update: In case of a match, this option will only change the fields that are given, leaving any customer fields that are not part of the import untouched.
    • ignore (skip): In case of a match, the existing data will be left untouched and the data row from the import data will be ignored.
  • no_undo: When set to yes, an undo state will not be recorded (ie: you can't undo the import). By default, if this parameter is not included, an undo state will be saved. When first importing, until you know that the data structure is consistenly correct, do not include this parameter. Once the process is tested and automated, include and set the no-undo parameter to limit the list of undo states in the admin interface.
  • card_number_generate: When included, random card numbers will be generated (all numeric, of the given length) if a card_number is not included or is blank.
  • code' should be provided as the internal ID for the customer of the application that is sending the data.
    • If the application that is sending the data uses the 'card_number' as their unique Customer ID, then insert it as BOTH 'code' and 'card_number' entries.
    • If the application that is sending the data does not have an internal unique ID for a customer, do not include the 'code' entry. The API response will include our internally generated 16-digit unique id as part of the response to be recorded into your system to be transmitted back with all transactions associated with this customer.
    • If instead, you want the program to generate a random unique card number, then include the card_number_generate field with the number of digits for the card number to be generated.
  • The 'custom_date' must be in YYYY-MM-DD format. (Any other format cannot be resolved without further context. Ex: 04-03-2010 could be either April 3rd or 4th of March. Don't even get us started on inputs like 04-06-05... What the heck is THAT?)
  • The customer_username is an API-specific field made available for custom applications. It cannot be defined or edited in the web interface.
  • The customer_password field is made available for custom applications such as a customer"hotsite". It can be defined or edited in the web interface.
  • The customer_PIN is an API-specific field made available for custom applications such as a physical terminal. It cannot be defined or edited in the web interface.
  • To automatically add an amount to the FIRST campaign specified above, use the optional auto_add parameter which lets you specify the amount of points, visits, dollars, or name of product or service, depending on the campaign type, to add. For example, as a thank-you bonus for signing-up, you would specify 25 as the data in the auto_add field for that customer (which will add 25 points to the customer's account balance.)

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['API']        = '1.5';
              $data['user_id']        = 'john1970';
              $data['user_api_key'] 	= '1959caadac9b13dcb3';	
              $data['account_id'] = 'greatwidgets';
              $data['type'] = 'customers_batch';
              $data['delimiter'] = 'pipe';
              $data['overwrite_duplicates'] = 'update';
              or: $data['card_number_generate'] = 10; // for 10-digit number.

              $data['campaigns_to_include'] = '898989889|,|13234545|,|34534554';
              $data['profiles_header_1'] = 'code';
              $data['profiles_header_2'] = 'card_number';
              $data['profiles_header_3'] = 'first_name';
              $data['profiles_header_4'] = 'last_name';
              $data['profiles_header_5'] = 'custome_date';
              $data['profiles_header_6'] = 'phone';
              $data['Profiles_Data'] = '
              11223344|11223344|jane|doe|1970-07-14|555-5555
              22334455|22334455|jim|mcdoe|1966-07-28|555-5556
              33445566|33445566|larry|smith|1980-02-05|555-5557
              ';
          

Success XML Response:


              <response status="success">
                  <batch status="imported">
                      <customers>
                          <new>2<new>
                          <updated>1<updated>
                      <customers>
                  </batch>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Customer - Search

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type customer_search Required
exact_match sensitive or
insensitive
Do not include for
partial matching.
account_id greatwidgets Required
card_number 1234 Optional
first_name John Optional
last_name Doe Optional
phone 555-5555 Optional
email jdoe@email.com Optional
city Anytown Optional
state ONT Optional
postal_code 55555 Optional
custom_date 1970-07-14 Optional
custom_field baltimore Optional
customer_username jdoe1970 Optional
customer_password pa$$w0rd Optional
customer_PIN 1234 Optional
custom_field_# Married Option
include_balances Y Do not include
if not wanted.
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • At least one of the optional fields must be provided, otherwise, the whole customer list will be returned.
  • If multiple matches result, then a list of those matching customers will be returned, with each customer's information.
  • The custom_date field must be given in YYYY-MM-DD format
  • Text-based matches are not case-sensitive.
  • The search will return partial matches. For example: Searching for the first name "John" will return any record whose first name is also "Johnny". Searching for a partial card number will return all the customers whose card number includes the segment given.
  • If the exact_match parameter is not included, the search will include partial matches and be case-insensitive (ex: searching for "smith" will also return "Smithson" or "O'Smithy".)
  • If the exact_match parameter is included, using "sensitive" will match capitalization (ex: searching for "smith" will not return "Smith") and will not include partial matches.
  • If the exact_match parameter is included, using "insensitive" will include any capitalization (ex: searching for "smith" will return "Smith") but will not include partial matches.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id']        = 'john1970';
              $data['user_password'] 	= '1959caadac9b13dcb3';	
              $data['type'] = 'customer_search';
              $data['account_id'] = 'greatwidgets';
              $data['last_name'] = 'Doe';
              $data['phone'] = 555-5555;
          

Success XML Response with single match:


              <response status="success">
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number>  
                      <first_name>John</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-5555</phone> 
                      <email>john@email.com</email> 
                      <street1>123 Main St.</street1> 
                      <street2>Apt 3G</street2> 
                      <city>Anytown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1970-07-14</custom_date> 
                      <custom_field>He Likes Cheese</custom_field> 
                      <customer_username>jdoe1970</customer_username> 
                  </customer>
              </response>
          

Success XML Response with multiple matches:


              <response status="success">
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number> 
                      <first_name>John</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-5555</phone> 
                      <email>john@email.com</email> 
                      <street1>123 Main St.</street1> 
                      <street2>Apt 3G</street2> 
                      <city>Anytown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1970-07-14</custom_date> 
                      <custom_field>He Likes Cheese</custom_field> 
                      <customer_username>jdoe1970</customer_username> 
                      </customer>
                      <customer>
                      <code>1234567890123456</code>
                      <card_number>1313131313</card_number> 
                      <first_name>Jane</first_name> 
                      <last_name>Smith</last_name> 
                      <phone>555-6666</phone> 
                      <email>j.smith@workemail.com</email> 
                      <street1>321 Side St.</street1> 
                      <street2></street2> 
                      <city>Bigtown</city> 
                      <state>CA</state> 
                      <postal_code>55555</postal_code> 
                      <country></country> 
                      <custom_date>1966-07-28</custom_date> 
                      <custom_field></custom_field> 
                      <customer_username>janesmith222</customer_username> 
                  </customer>
              </response>
          

Success XML Response with "include_balances = Y":


              <response status="success">
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number> 
                      <first_name>John</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-5555</phone> 
                      <email>john@email.com</email> 
                      <street1>123 Main St.</street1> 
                      <street2>Apt 3G</street2> 
                      <city>Anytown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1970-07-14</custom_date> 
                      <custom_field>He Likes Cheese</custom_field> 
                      <customer_username>jdoe1970</customer_username> 
                      <campaigns>
                          <campaign>
                              <id>1234567890123456</id>
                              <name>Widget Rewards</name>
                              <type>points</type>
                              <balance>1500</balance>
                              <cumulative>4750</cumulative>
                              <last_transaction>2011-12-31</last_transaction>
                          </campaign>
                          ...
                      </campaigns>
                  </customer>
                  ...
              </response>
          

XML Response if no customer matches fields given:


              <response status="no_match">
                <message>Language-specific "No Customers Match Criteria"</message>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Customer - Find

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type customer_find Required
account_id greatwidgets Required
find_customer Amy Acker, 1234 Main St Required
include_balances Y Do not include
if not wanted.
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • The search phrase is logic based:
    • Spaces (" ") are considered logical "AND"
    • Commas (",") are considered logical "OR"
    • Spaces take precedence over commas (ANDs are evaluated before ORs)
  • In the example above, the search phrase is equivalent to:
    • ("Amy" AND "Acker") OR ("1234" AND "Main" AND "St")
    • In english, this means: Find customer(s) which have either "Amy" and "Acker" -- or -- "1234" and "Main" and "St" in their record.
  • If multiple matches result, then a list of those matching customers will be returned, with each customer's information.
  • Matches are not case-sensitive.
  • The search will return partial matches. For example: Searching for the first name "John" will return any record whose first name is also "Johnny". Searching for a partial card number will return all the customers whose card number includes the segment given.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id']        = 'john1970';
              $data['user_password'] 	= '1959caadac9b13dcb3';	
              $data['type'] = 'customer_find';
              $data['account_id'] = 'greatwidgets';
              $data['find_customer'] = 'Amy Acker, 1234 Main St';
          

Success XML Response with single match:


              <response status="success">
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number>  
                      <first_name>Amy</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-5555</phone> 
                      <email>adoe@email.com</email> 
                      <street1>123 Acker St.</street1> 
                      <street2>Apt 3G</street2> 
                      <city>Anytown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1970-07-14</custom_date> 
                      <custom_field>She Likes Cheese</custom_field> 
                      <customer_username>adoe1970</customer_username> 
                  </customer>
              </response>
          

Success XML Response with multiple matches:


              <response status="success">
                  <customer>
                      <code>1234567890123456</code>
                      <card_number>1313131313</card_number> 
                      <first_name>John</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-1234</phone> 
                      <email>john@email.com</email> 
                      <street1>434 Great St.</street1> 
                      <street2></street2> 
                      <city>Maintown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1966-07-28</custom_date> 
                      <custom_field></custom_field> 
                    <customer_username>jdoe1966</customer_username> 
                  </customer>
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number> 
                      <first_name>Amy</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-5555</phone> 
                      <email>adoe@email.com</email> 
                      <street1>123 Acker St.</street1> 
                      <street2>Apt 3G</street2> 
                      <city>Anytown</city> 
                      <state>ONT</state> 
                      <postal_code>M5A-5A5</postal_code> 
                      <country></country> 
                      <custom_date>1970-07-14</custom_date> 
                      <custom_field>She Likes Cheese</custom_field> 
                      <customer_username>adoe1970</customer_username> 
                  </customer>
              </response>
          

Success XML Response with "include_balances = Y":


              <response status="success">
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number> 
                      <first_name>John</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-1234</phone> 
                      <email>john@email.com</email> 
                      <street1>434 Great St.</street1> 
                      <street2></street2> 
                      <city>Maintown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1966-07-28</custom_date> 
                      <custom_field></custom_field> 
                      <customer_username>jdoe1966</customer_username> 
                      <campaigns>
                          <campaign>
                              <id>1234567890123456</id>
                              <name>Widget Rewards</name>
                              <type>points</type>
                              <balance>1500</balance>
                              <cumulative>4750</cumulative>
                              <last_transaction>2011-12-31</last_transaction>
                          </campaign>
                          ...
                      </campaigns>
                  </customer>
                  ...
              </response>
          

XML Response if no customer matches fields given:


              <response status="no_match">
                <message>Language-specific "No Customers Match Criteria"</message>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Retrieve Customer Information

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type customer_info Required
account_id greatwidgets Required
card_number 1212121212 See Notes
code 89898989898989 See Notes
include_balances N Optional
campaign_id 12345667890123456 Optional
hide_custom_field Y Optional
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • Either 'code' or 'card_number' must be passed.
  • If the parameter 'hide_custom_field' is not given, the custom_field ("custom1") will be returned. There is no need to pass on a value equivalent to "hide_custom_field = N".
  • For coalition accounts, the balance for each campaign will be the coalition balance, not the individual campaign balance. Hence the totals of the transactions for each campaign may not add up to the coalition balance, since the customer may have multiple transactions in multiple campaign(s).
  • All fields are returned on this call, even if they have been "turned off" in the web interface. This is to allow different interfaces to show / access different fields, and thus to allow maximum customization by you.
  • To restrict the return XML to JUST the customer info, and not include campaign balances and rewards available per customer, add the include_balances parameter set to N.
  • To instead restrict the return XML to just a single campaign's balance and available rewards, add the campaign_id parameter.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id']        = 'john1970';
              $data['user_password'] 	= '1959caadac9b13dcb3';	
              $data['type'] = 'customer_info';
              $data['account_id'] = 'greatwidgets';
              $data['code'] = '89898989898989';
              or: $data['card_number'] = 1212121212;
          

Success XML Response:


              <response status="success">
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number> 
                      <first_name>John</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-5555</phone> 
                      <email>john@email.com</email> 
                      <street1>123 Main St.</street1> 
                      <street2>Apt 3G</street2> 
                      <city>Anytown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1970-07-14</custom_date> 
                      <custom_field>He Likes Cheese</custom_field>
                      <customer_username>jdoe1970</customer_username>
                      <registered>Y</registered>
                      <custom_field_2>
                      <label>Marital Status</label>
                      <data>Single</data>
                      </custom_field_2>
                      ...
                  </customer>
                  <campaigns>
                      <campaign>
                          <id>1234567890123456</id>
                          <name>Widget Rewards</name>
                          <type>points</type>
                          <balance>1500</balance>
                          <cumulative>4500</cumulative>
                          <monetary_balance>10.00</monetary_balance>
                          <currency>EUR</currency>
                          <glyph></glyph>
                          <last_transaction>2011-12-31</last_transaction>
                          <available_rewards>
                              <reward>
                                  <id>678</id>
                                  <description>Free Widget</description>
                                  <needed_to_redeem>1000</needed_to_redeem>
                                  <reward_id>A-345678</reward_id>
                              </reward>
                              <reward>
                                  <id>753</id>
                                  <description>Free bigger widget</description>
                                  <needed_to_redeem>2500</needed_to_redeem>
                              </reward>
                          </available_rewards>
                      </campaign>
                      <campaign>
                          <id>2345678901234567</id>
                          <name>Employee Rewards</name>
                          <type>earned</type>
                          <balance>16.50</balance>
                          <currency>EUR</currency>
                          <cumulative>59.95</cumulative>
                          <last_transaction>2011-12-31</last_transaction>
                      </campaign>
                      <campaign>
                          <id>3456789012345678</id>
                          <name>Frequent Buyer</name>
                          <type>buyx</type>
                          <balances>
                              <item>
                                  <name>Coffees</name>
                                  <item_id>96</item_id>
                                  <balance>14</balance>
                                  <earned>1</earned>
                                  <cumulative>24</cumulative>
                                  <redeemed>1</redeemed>
                                  <earn_ratio>10</earn_ratio>
                              </item>
                              <item>
                                  <name>Cakes</name>
                                  <item_id>107</item_id>
                                  <balance>11</balance>
                                  <earned>1</earned>
                                  <cumulative>21</cumulative>
                                  <redeemed>1</redeemed>
                                  <earn_ratio>10</earn_ratio>
                              </item>
                              <item>
                                  <name>Books</name>
                                  <balance>2</balance>
                                  <earned>0</earned>
                                  <cumulative>2</cumulative>
                                  <redeemed>0</redeemed>
                                  <earn_ratio>5</earn_ratio>
                            </item>
                          </balances>
                          <last_transaction>2011-12-31</last_transaction>
                          <available_rewards>
                            <reward>
                                  <item_id>96</item_id>
                                  <name>Coffees</name>
                                  <earn_ratio>10</earn_ratio>
                                  <reward_id>A-345678</reward_id>
                            </reward>
                            <reward>
                                  <item_id>107</item_id>
                                  <name>Cakes</name>
                                  <earn_ratio>10</earn_ratio>
                            </reward>
                          </available_rewards>
                      </campaign>
                  </campaigns>
              </response>
          

Notes:

  • The <registered> tag is returned as 'Y' is the customer has a password defined in their record.
  • For BuyX Campaigns:
    • The <balance> is the amount of purchases that have accumulated and that count towards earning a free item.
    • The <earned> is the amount of items that the customer has earned based on the <balance> of items purchased.
    • The <cumulative> balance is the number of purchases by the customer over their lifetime participating in the campaign. This includes purchases that counted towards a redemption.
    • The <redeemed> balance is the number of free items that the customer has gotten over their lifetime participation in the campaign.
    • When an <earned> item is redeemed, the amount of items that were needed to earn it are deducted from the <balance> and the <redeemed> balance is incremented by 1.
    • For example: A campaign allows customers to earn 1 free coffee per 10 purchased (this ratio is defined when a campaign is created or updated and is also reported in the Campaign - List BuyX Items API call for ALL the tiems, as well as in the <available_rewards> for the items that the customer has earned at least one of.) Now imagine that a customer purchases 14 coffees over a few days. This this means that they have:
      • A <balance> of 14
      • <earned> 1 free Coffee
      • A lifetime <cumulative> balance of 14
      • Not <redeemed> any yet ( 0 )
    • They then redeem a free coffee. This means that they now have:
      • A <balance> of 4 (14-10=4)
      • An <earned> balance of 0 (a balance of 4 is not enough to earn a free coffee.)
      • A lifetime <cumulative> balance of 14
      • A <redeemed> balance of 1

Success XML Response for a Coaltion campaign:


              <response status="success">
                  <customer>
                      <code>89898989898989</code>
                      <card_number>1212121212</card_number> 
                      <first_name>John</first_name> 
                      <last_name>Doe</last_name> 
                      <phone>555-5555</phone> 
                      <email>john@email.com</email> 
                      <street1>123 Main St.</street1> 
                      <street2>Apt 3G</street2> 
                      <city>Anytown</city> 
                      <state>ONT</state> 
                      <postal_code>55555</postal_code> 
                      <country>New Zealand</country> 
                      <custom_date>1970-07-14</custom_date> 
                      <custom_field>He Likes Cheese</custom_field>
                      <customer_username>jdoe1970</customer_username>
                      <registered>Y</registered>
                      <custom_field_2>
                          <label>Marital Status</label>
                          <data>Single</data>
                      </custom_field_2>
                      ...
                  </customer>
                  <campaigns>
                      <campaign>
                          <id>1234567890123456</id>
                          <name>Widget Rewards</name>
                          <type>points</type>
                          <balance>1500</balance>
                          <cumulative>0</cumulative>
                          <last_transaction>2011-12-31</last_transaction>
                          <balance_coalition>1500</balance_coalition>
                          <cumulative_coalition>8350</cumulative_coalition>
                          <available_rewards>
                              <reward>
                                  <id>678</id>
                                  <description>Free Widget</description>
                                  <needed_to_redeem>1000</needed_to_redeem>
                                  <reward_id>A-345678</reward_id>
                              </reward>
                              <reward>
                                  <id>753</id>
                                  <description>Free bigger widget</description>
                                  <needed_to_redeem>2500</needed_to_redeem>
                              </reward>
                          </available_rewards>
                      </campaign>
                      <campaign>
                          <id>0123456123456789</id>
                          <name>ACME Rewards</name>
                          <type>points</type>
                          <balance>1500</balance>
                          <cumulative>4500</cumulative>
                          <last_transaction>2011-12-31</last_transaction>
                          <balance_coalition>1500</balance_coalition>
                          <cumulative_coalition>8350</cumulative_coalition>
                          <available_rewards>
                              <reward>
                                  <id>678</id>
                                  <description>Free Widget</description>
                                  <needed_to_redeem>1000</needed_to_redeem>
                                  <reward_id>A-345678</reward_id>
                              </reward>
                              <reward>
                                  <id>753</id>
                                  <description>Free bigger widget</description>
                                  <needed_to_redeem>2500</needed_to_redeem>
                              </reward>
                          </available_rewards>
                      </campaign>
                  </campaigns>
              </response>
          

Notes:

  • ALL campaigns that belong to a coalition will show the SAME balance. In the example above, both campaigns (stores) show the same <balance> however, the <cumulative_balance> at a store might be 0 (zero) if the points were earned in another store.

XML Response if no customer matches code or card_number given:


              <response status="no_match">
                <message>Language-specific "No Customers Match Criteria"</message>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Customer Balance and Transaction History

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type customer_balance Required
account_id greatwidgets Required
campaign_id 1111222233334444 Required
code
or
card_number
1234567890123456
or
234566
Required
transactions_number 0 for none

1 to 9999...

Optional
across_campaigns Yes Optional
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • When using this call with 'code', it must be the unique Customer ID that was either passed as 'code' by your program when the customer record was created previously, or the 16-digit number that was generated by us and returned to you in the API response.
  • The transactions_number field lets you specify how many transactions to return along with the balance:
    • A value of "0" means none will be returned.
    • Anything above "0" will return the number of transactions specified.
    • Not providing this field returns ALL transactions.
    • For coalition accounts, the balance will be the coalition balance, not the individual campaign balance. Hence the totals of the transactions may not add up to the coalition balance, since the customer may have other transactions in other campaign(s). Only the transactions for this campaign will be listed.
    • To have the customer history of the customer's transactions in a coalition account (only) include all the transactions in all the campaigns that resulted in the balance, include the parameter across_campaigns set to Yes.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id'] = 'john1970';
              $data['user_password'] = '1959caadac9b13dcb3'; 
              $data['type'] = 'customer_balance';
              $data['account_id'] = 'greatwidgets';
              $data['campaign_id'] = 'Store Rewards';
              $data['code'] = '1234567890123456';
              or
              $data['card_number'] = '29374856';
          

Success XML Response (Points-Based Campaign):


              <response status="success">
                  <campaign>
                      <campaign_id>4857302875023023</campaign_id>
                      <campaign_type>points</campaign_type>
                      <campaign_name>Store_Rewards</campaign_name>
                      <customer>
                          <code>1234567890123456</code>
                          <balance>1500</balance>
                          <last_transaction>2011-12-15</last_transaction>
                          <last_redemption>2011-12-31</last_redemption>
                          <transactions>
                              <transaction>
                                  <id>4056</id>
                                  <date>2011-12-15</date>
                                  <amount>20000</amount>
                                  <orig_amount>200</orig_amount>
                                  <redeemed>N</redeemed>
                                  <authorization>Purchased Item</authorization>
                                  <user_name>employee1</user_name>
                              </transaction>
                              <transaction>
                                  <id>4097</id>
                                  <date>2011-21-31</date>
                                  <amount>-15000</amount>
                                  <redeemed>Y</redeemed>
                                  <authorization>Redeemed Item</authorization>
                                  <user_name>employee2</user_name>
                              </transaction>
                              ...
                          </transactions>
                      </customer>
                  </campaign>
              </response>
          

Success XML Response (Points-Based Campaign with Spend-to-Reward ratio set):


              <response status="success">
                  <campaign>
                      <campaign_id>4857302875023023</campaign_id>
                      <campaign_type>points</campaign_type>
                      <campaign_name>Store_Rewards</campaign_name>
                      <reward_ratio>10</reward_ratio>
                      <customer>
                          <code>1234567890123456</code>
                          <balance>1500</balance>
                          <equivalent_cash_balance>1.50</equivalent_cash_balance>
                          <equivalent_cash_currency>Euro</equivalent_cash_currency>
                          <equivalent_cash_glyph>&euro;</equivalent_cash_glyph>
                          <last_transaction>2011-12-15</last_transaction>
                          <last_redemption>2011-12-31</last_redemption>
                          <transactions>
                              <transaction>
                                  <id>4056</id>
                                  <date>2011-03-15</date>
                                  <amount>20000</amount>
                                  <orig_amount>200</orig_amount>
                                  <redeemed>N</redeemed>
                                  <authorization>Purchased Item</authorization>
                                  <user_name>employee1</user_name>
                              </transaction>
                              <transaction>
                                  <id>4097</id>
                                  <date>2011-12-31</date>
                                  <amount>-50-0</amount>
                                  <equivalent_cash_amount>-5.00</equivalent_cash_amount>
                                  <redeemed>Y</redeemed>
                                  <authorization>Redeemed Item</authorization>
                                  <user_name>employee2</user_name>
                              </transaction>
                              ...
                          </transactions>
                      </customer>
                  </campaign>
              </response>
          

Success XML Response (Points-Based Campaign with Custom Fields):


              <response status="success">
                  <campaign>
                      <campaign_id>4857302875023023</campaign_id>
                      <campaign_type>points</campaign_type>
                      <campaign_name>Store_Rewards</campaign_name>
                      <customer>
                          <code>1234567890123456</code>
                          <balance>1500</balance>
                          <equivalent_cash_balance>1.50</equivalent_cash_balance>
                          <equivalent_cash_currency>Euro</equivalent_cash_currency>
                          <equivalent_cash_glyph>&euro;</equivalent_cash_glyph>
                          <last_transaction>2011-12-15</last_transaction>
                          <last_redemption>2011-12-31</last_redemption>
                          <transactions>
                              <transaction>
                                  <id>4056</id>
                                  <date>2011-12-15</date>
                                  <amount>20000</amount>
                                  <orig_amount>200.00</orig_amount>
                                  <redeemed>N</redeemed>
                                  <authorization>Purchased Item</authorization>
                                  <user_name>employee1</user_name>
                                  <custom_field_2>
                                      <label>quantity</label>
                                      <data>2</data>
                                  </custom_field_2>
                              </transaction>
                              <transaction>
                                  <id>4097</id>
                                  <date>2011-12-31</date>
                                  <amount>-5000</amount>
                                  <redeemed>Y</redeemed>
                                  <authorization>Redeemed Item</authorization>
                                  <user_name>employee2</user_name>
                                  <custom_field_2>
                                      <label>quantity</label>
                                      <data>1</data>
                                  </custom_field_2>
                              </transaction>
                          ...
                          </transactions>
                      </customer>
                  </campaign>
              </response>
          

Success XML Response (Gift Card Campaign):


              <response status="success">
                  <campaign>
                      <campaign_id>57203576293875493</campaign_id>
                      <campaign_type>giftcard</campaign_type>
                      <campaign_name>Gift Basket</campaign_name>
                      <customer>
                          <code>1234567890123456</code>
                          <balance>36.75</balance>
                          <last_transaction>2011-12-15</last_transaction>
                          <last_redemption>2011-12-31</last_redemption>
                          <transactions>
                              <transaction>
                                  <id>4056</id>
                                  <date>2011-12-15</date>
                                  <amount>40</amount>
                                  <redeemed>N</redeemed>
                                  <authorization>Cash Added</authorization>
                                  <user_name>employee2</user_name>
                              </transaction>
                              <transaction>
                                  <id>4097</id>
                                  <date>2011-12-31</date>
                                  <amount>-3.25</amount>
                                  <redeemed>Y</redeemed>
                                  <authorization>Cash Redeemed</authorization>
                                  <user_name>employee2</user_name>
                              </transaction>
                              ...
                          </transactions>
                      </customer>
                  </campaign>
              </response>
          

Success XML Response (Buy-X-Get_One-Free / Membership Campaign):


              <response status="success">
                  <campaign>
                      <campaign_id>53485702387562034</campaign_id>
                      <campaign_type>buyx</campaign_type>
                      <campaign_name>Club Fantastic</campaign_name>
                      <customer>
                          <code>1234567890123456</code>
                          <balances>
                              <item>
                                  <name>Coffees</name>
                                  <balance>14</balance>
                                  <earned>1</earned>
                              </item>
                              <item>
                                  <name>Cakes</name>
                                  <balance>7</balance>
                                  <earned>0</earned>
                              </item>
                              <item>
                                  <name>Books</name>
                                  <balance>2</balance>
                                  <earned>0</earned>
                              </item>
                          </balances>
                          <last_transaction>2011-12-15</last_transaction>
                          <last_redemption>2011-12-31</last_redemption>
                          <transactions>
                              <transaction>
                                  <id>4056</id>
                                  <date>2011-12-15</date>
                                  <service_product>Coffees</service_product>
                                  <amount>12</amount>
                                  <redeemed>N</redeemed>
                                  <authorization>Purchased Items</authorization>
                                  <user_name>employee1</user_name>
                              </transaction>
                              <transaction>
                                  <id>4097</id>
                                  <date>2011-12-31</date>
                                  <service_product>Cakes</service_product>
                                  <amount>1</amount>
                                  <redeemed>Y</redeemed>
                                  <authorization>Redeemed Items</authorization>
                                  <user_name>employee1</user_name>
                              </transaction>
                              ...
                          </transactions>
                      </customer>
                  </campaign>
              </response>
          

NOTES:

  • The <balance> is the amount of purchases that have accumulated
  • The <earned> is the amount of items that the customer has earned based on the <balance> of items purchased.
  • The <balance> is not a cumulative balance -- It is the current balance of purchases that count towards the calculation of <earned> items.
  • When an <earned> item is redeemed, the amount of items that were needed to earn it are deducted from the <balance>
  • For example: A customer purchases 14 coffees. They earn 1 free coffee per 10 purchased (this ratio is defined when a campaign is created or updated and is also reported in the Campaign - List BuyX Items API call). This this means that with a <balance> of 14 they have <earned> 1 free Coffee. They then redeem it (get a free one) and their <balance> is now 4 (14-10=4) and with only 4 they have now <earned> 0 (have not yet earned any.)

Success XML Response (Events (Visits) Based Campaign):


              <response status="success">
                  <campaign>
                      <campaign_id>683979284679238</campaign_id>
                      <campaign_type>events</campaign_type>
                      <campaign_name>Frequent Shopper</campaign_name>
                      <customer>
                          <code>1234567890123456</code>
                          <balance>23</balance>
                          <last_transaction>2011-12-15</last_transaction>
                          <last_redemption>2011-12-31</last_redemption>
                          <transactions>
                              <transaction>
                                  <id>4056</id>
                                  <date>2011-12-15</date>
                                  <amount>1</amount>
                                  <redeemed>N</redeemed>
                                  <authorization>Visit Note</authorization>
                                  <user_name>employee1</user_name>
                              <transaction>
                              </transaction>
                                  <id>4097</id>
                                  <date>2011-12-31</date>
                                  <amount>-10</amount>
                                  <redeemed>Y</redeemed>
                                  <authorization>Redeemed Reward</authorization>
                                  <user_name>employee2</user_name>
                              </transaction>
                              ...
                          </transactions>
                      </customer>
                  </campaign>
              </response>
          

Success XML Response (Earn-per-Event Based Campaign):


              <response status="success">
                  <campaign>
                      <campaign_id>325702938572039</campaign_id>
                      <campaign_type>earned</campaign_type>
                      <campaign_name>Referral Rewards</campaign_name>
                      <customer>
                          <code>1234567890123456</code>
                          <balance>105.00</balance>
                          <last_transaction>2011-12-15</last_transaction>
                          <last_redemption>2011-12-31</last_redemption>
                          <transactions>
                              <transaction>
                                  <id>4056</id>
                                  <date>2011-12-15</date>
                                  <amount>4.50</amount>
                                  <redeemed>N</redeemed>
                                  <authorization>Event Earning</authorization>
                                  <user_name>employee1</user_name>
                              </transaction>
                              <transaction>
                                  <id>4097</id>
                                  <date>2011-12-31</date>
                                  <amount>-29.95</amount>
                                  <redeemed>Y</redeemed>
                                  <authorization>Redeemed reward</authorization>
                                  <user_name>employee1</user_name>
                              </transaction>
                              ...
                          </transactions>
                      </customer>
                  </campaign>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Delete a Customer

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type customer_delete Required
account_id greatwidgets Required
code 1234567890123456 Required
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

WARNING: THIS IS A PERMANENT DELETE. THERE IS NO UNDO!
This call deletes ALL information related to that customer:

  • Removes ALL customer data such as name, card number, etc.
  • Removes ALL customer transactions in ALL account campaigns.
  • Remoces ONLY one customer at a time to avoid accidentally wiping the whole database.

Notes:

If you want to remove more than one customer at a time, implement a loop in your code that makes this call for each customer that you want removed. This way, if the whole customer database gets erased accidentally, the fault lies with your code, not ours. :)

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id']        = 'john1970';
              $data['user_password'] 	= '1959caadac9b13dcb3';	
              $data['type'] = 'customer_delete';
              $data['account_id'] = 'greatwidgets';
              $data['code'] = '1234567890123456';
          

Success XML Response:


              <response status="success">
                  <customer status="deleted">
                    <code>1234567890123456</code>
                  </customer>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Customer Password Validation

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type validate_customer_password Required
account_id greatwidgets Required
card_number 1212121212 See Notes
code 1234567890123456 See Notes
customer_username jdoe1970 See Notes
customer_password pa$$w0rd See Notes
customer_PIN 1234 See Notes
phone 5551115555
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • Either the card_number, customer code, or customer_username is REQUIRED.
  • Either the customer_password or customer_PIN is REQUIRED
  • Use any combination of parameters. Success will only be returned if ALL passed parameters are matched. (ie. you can validate on card_number + customer_password or customer_username + customer_PIN or card_number + code + customer_PIN or on all 5 parameters.)
  • If passing the customer code, this MUST be the unique Customer ID that was either
    • passed as 'code' by your program when the customer record was created previously, or
    • the 16-digit number that was generated by us and returned to you in the API response.

Example PHP Request:

If you are using PHP, the $data array would look like this:


              $data['user_id'] = 'john1970';
              $data['user_password'] = '1959caadac9b13dcb3'; 
              $data['type'] = 'validate_customer_password';
              $data['account_id'] = 'greatwidgets';
              $data['card_number'] = '121212121212';
              $data['customer_password'] = 'pa$$w0rd';
          

Success XML Response (password matches the one on record):


              <response status="success">
              </response>
          

Error XML Response (password does not match the one on record):


              <response status="error">
                <error>Error message</error>
              </response>
          
Back to Top

Customer Card Replace

The data to be submitted to the API is composed of the following fields:

field Example Note
user_id john1970 Required
user_password 1959caadac9b13dcb3 Required
type card_replace Required
account_id greatwidgets Required
previous_code 0123456789012345 See notes
previous_card 121212 See notes
new_code 1234567890123456 See notes
new_card_number 131313 See notes
card_number_generate (# of digits) See notes
profile_uid 395 See notes
check_override Y See notes
keep_which matched or duplicate See notes
first_name Jane Optional
last_name Doe Optional
phone 555-5555 Optional
email jdoe@email.com Optional
street1 123 Main St.
street2 Suite 3G
city Anytown Optional
state ONT Optional
postal_code 55555 Optional
country Canada
custom_date 1970-07-14 Optional
custom_field baltimore Optional
customer_password pa$$w0rd Optional
customer_PIN 1234 Optional
customer_username janedoe123 Optional
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

Notes:

  • For this call to work, you must provide a "new_code", a "new_card_number" or the field "card_number_generate". It can also be a combination of new_code and either new_card_number or card_number generate.
  • The card_number_generate field is should be included only if you want the program to generate a random unique card number. It takes as an argument the number of digits to be generated.
  • If both "previous_code" and "previous_card" are given, "previous_code" is given priority and used to identify the old card.
  • If neither "previous_code" and "previous_card" are given, the "new_code" and/or "new_card_number" will be applied only if there is a single resulting customer that matches ALL of whichever information fields were given (phone, email, etc.).
  • If multiple matches result, then a list of those matching customers will be returned, with each customer's information, including a "profile_uid" field to be used when one of the customers is selected as the one to update:
  • With a "profile_uid" field provided, only the new_code and/or new_card_number fields need to be given back through the API call: All other optional fields, if given, will be ignored.
  • The program will check before replacing any card if the given new_code or new_card_number already exist in the system -- if they do, an error code will be generated. In case this is not what you want,set the check_override parameter to "Y"and it will not perform this check.
  • Setting the check_override really only makes sense if you expect duplicate records to result from the card_replace API call. However, although card_numbers can be duplicates for esoteric reasons, card codes must be unique. If there is an existing (duplicate) card code that matches the new_code provided, for example, if joining two customer accounts together or if replacing a lost card with a "new" card when all cards are already pre-loaded into the system, you need to set the check_override parameter to "Y" AND select which of the two record to keep with the keep_which parameter:
    • Selecting "matched" will keep the customer information in the "matched" (or "old" or "lost") card, replace its code and/or card number with the new one(s), delete the "duplicate" existing account that matches the new_code provided, and move any existing transactions associated with the now deleted "duplicate" account to the newly updated "matched" one.
    • Selecting "duplicate" will keep the customer information in the existing account whose code matches the given new_code, replace the existing card_number of that account if a new_card_number is given (or card_number_generate), delete the "old" (or "lost") account, and move any transaction associated with the "old" (or "lost") account to the new one.
  • The custom_date field must be given in YYYY-MM-DD format
  • Text-based matches on the optional fields are not case-sensitive.

Example PHP Requests:

To replace the card number and/or code of a known card, by previous_code or by previous_card:


              $data['user_id'] = 'john1970';
              $data['user_password'] = '1959caadac9b13dcb3'; 
              $data['type'] = 'card_replace';
              $data['account_id'] = 'greatwidgets';
              $data['previous_code'] = '012345678912345';
              $data['new_card_number'] = '1231313';
          

To replace the card number and/or code knowing only certain data:


              $data['user_id'] = 'john1970';
              $data['user_password'] = '1959caadac9b13dcb3'; 
              $data['type'] = 'card_replace';
              $data['account_id'] = 'greatwidgets';
              $data['last_name'] = 'Doe';
              $data['phone'] = '555-55555';
              $data['customer_password'] = '1234';
          

To replace the card number and/or code after selecting a customer from multiple matches:


              $data['user_id'] = 'john1970';
              $data['user_password'] = '1959caadac9b13dcb3'; 
              $data['type'] = 'card_replace';
              $data['account_id'] = 'greatwidgets';
              $data['profile_uid'] = '365';
              $data['new_code'] = '1234567890123456';
              $data['new_card_number'] = '131313';
          

Success XML Response for a successful card number/code replacement:


              <response status="success">
                  <customer>
                    <code>1234567890123456</code>
                  </customer>
              </response>
          

Success XML Response for multiple matches:


              <response status="multiple_matches">
                  <customers>
                      <customer>
                          <profile_uid>365</profile_uid>
                          <code>0123456789012345</code>
                          <card_number>121212</card_number>
                          <first_name>John</first_name>
                          <last_name>Doe</last_name>
                          <phone>555-5555</phone>
                          <email>jdoe@email.com</email>
                          <street1>123 Main St</street1>
                          <street2>Apt 3G</street2>
                          <city>Anytown</city>
                          <state>ONT</state>
                          <postal_code>55555</postal_code>
                          <country>Australia</country>
                          <custom_date>1970-07-14</custom_date>
                          <custom_field>Baltimore</custom_field>
                      </customer>
                      <customer>
                          <profile_uid>1267</profile_uid>
                          <code>2345678901234567</code>
                          <card_number>343435</card_number>
                          <first_name>John</first_name>
                          <last_name>Doe</last_name>
                          <phone>555-7777</phone>
                          <email>john.doe@workemail.com</email>
                          <street1>78 Side St</street1><street2>Apt 3G
                          <street2></street2>
                          <city>Bigtown</city>
                          <state>CA</state>
                          <postal_code>MX5-4F6</postal_code>
                          <country>Oceania</country>
                          <custom_date>1985-06-18</custom_date>
                          <custom_field></custom_field>
                      </customer>
                      ...
                  </campaign>
              </response>
          

XML Response if no customers matched:


              <response status="no_match">
                <message>Language-specific "No Customers Match Criteria"</message>
              </response>
          

Error XML Response:


              <response status="error">
                <error>Error message</error>
              </response>