Retrieve Customer Information
Retrieves a customer's information and campaigns' balances.
Headers
|
|
Key |
|
Value |
|
Note |
|
|
|
api_access_key |
|
user_api_key |
|
Optional |
|
   
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 if not included in the headers |
|
|
|
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 |
|
|
|
show_only_belong_to |
|
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:
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>NZ</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>NZ</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>
|