Record or Register a New Customer
Create a customer account; Returns a unique Account ID.
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 |
|
|
|
card_number_prefix |
|
(any digits) |
|
Optional |
|
|
|
card_number_suffix |
|
(any 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 |
|
NZ |
|
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. The parameters card_number_prefix and card_number_suffix are only applicable when the card_number_generate is passed.
- 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'] = 'NZ';
- $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>
|