Batch Transactions
Record a batch of transactions for a customer account, including redemptions.
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:
Fields common to all campaign types:
|
field |
|
Example |
|
Note |
|
|
API |
|
1.5 |
|
|
|
|
user_id |
|
john1970 |
|
Required |
|
|
user_api_key |
|
1959caadac9b13dcb3 |
|
Required if not included in the headers |
|
|
account_id |
|
greatwidgets |
|
Required |
|
|
type |
|
batch_transactions |
|
Required |
|
|
|
|
|
|
Required |
|
|
delimiter |
|
pipe or comma or tab |
|
Required |
|
|
apply_ratio |
|
yes or no |
|
Optional: See Notes |
|
|
allow-undo |
|
yes |
|
Optional: 'yes' or don't include. |
|
|
send_transaction_email |
|
Y |
|
Optional: 'Y' or don't include. |
|
|
create_new_customers |
|
Y or N |
|
Optional: Auto-create customer records for unknown customers in the transaction batch |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
General Notes:
- If apply_ratio is not given or is set to "no":
- Points Campaigns:
- Add transaction: amount = points
- Redemptions: amount = points
- Giftcard Campaigns:
- Add transaction: amount = monetary value.
- Redemptions: amount = monetary value.
- Events Campaigns:
- Add transaction: amount = number of events.
- Redemptions: amount = number of events.
- Earned Campaigns:
- Add transaction: amount = monetary value.
- Redemptions: amount = monetary value.
- BuyX Campaings:
- Add transaction: amount = number of items purchased
- Redemptions: amount = accumulated items to deduct, NOT: number of items redeemed.
- If apply_ratio is given as "yes":
- Points Campaigns:
- Add transaction: amount = monetary value (which will be converted into points)
- Redemptions: amount = reward unique_id or reward_id (which will be converted into points)
- Giftcard Campaigns:
- (apply_ratio not applicable.)
- Event Campaigns:
- Add transaction: amount = number of events.
- Redemptions: amount = reward unique_id or reward_id (which will be converted into accumulated events to be deducted)
- Earned Campaigns:
- Add transaction: amount = events (which will be converted into monetary value)
- Redemptions: amount = monetary value.
- BuyX Campaings: amount given will be assumed to be:
- Purchases: amount = number of items purchased
- Redemptions: amount = number of items redeemed (which will be converted into accumulated items to be deducted)
- Unless there's a good reason, don't include the 'allow-undo' = 'yes' directive, otherwise every batch will be listed as an "undo-able" entry in the Manage Customer Records section of the Dashboard.
- Dates should be provided in ISO format: YYYY-MM-DD (ISO-8601)
Fields for Points-Based Campaigns:
|
field |
|
Example |
|
Note |
|
visits_header_1 |
|
campaign_id |
|
Required |
|
visits_header_2 |
|
code |
|
Required |
|
visits_header_3 |
|
redeemed |
|
Required: Y | N |
|
visits_header_4 |
|
amount |
|
Required: if not used,
leave blank (empty) |
|
visits_header_5 |
|
date |
|
Required: if not used,
leave blank (empty) |
|
visits_header_6 |
|
authorization |
|
Required: if not used,
leave blank (empty) |
|
visits_header_7 |
|
promo_id |
|
Required: if not used,
leave blank (empty) |
|
Visits_Data |
|
(see below) |
|
|
|
Data to be imported in batch: single (text) field with <eol>s at the end of each line: |
|
1111222233334444|12121|N|14,95|2013-0315|API test import 1|123
1111222233334444|12121|N|50|2010-03-15|API test import 2|345,345,354
1111222233334444|12121|N|34.67|2010-03-15|API test import 3
1111222233334444|12121|N|0,50|2010-03-15|API test import 4
1111222233334444|12121|N|.75|2010-03-15|API test import 5
1111222233334444|12121|N|2.00|2010-03-15|API test import 6
1111222233334444|12121|Y|1500|2010-03-15|API test redeem 1
|
|
|
|
|
|
|
Notes:
- 'code' is either
- the unique Customer ID recored in the 'code' field when the customer account was first created AND there was no 'card_number'), or
- the 'card_number' of the customer.
- If date is not given, today's date will be used.
- If promo_id is used, and multiple given and separated by commas, DO NOT USE comma as delimiter (duh!)
Fields for Gift-Card Campaigns:
|
field |
|
Example |
|
Note |
|
visits_header_1 |
|
campaign_id |
|
Required |
|
visits_header_2 |
|
code |
|
Required |
|
visits_header_3 |
|
redeemed |
|
Required: Y | N |
|
visits_header_4 |
|
amount |
|
Required: if not used,
leave blank (empty) |
|
visits_header_5 |
|
date |
|
Required: if not used,
leave blank (empty) |
|
visits_header_6 |
|
authorization |
|
Required: if not used,
leave blank (empty) |
|
Visits_Data |
|
(see below) |
|
|
|
Data to be imported in batch: single (text) field with <eol>s at the end of each line: |
|
1111222233334444|12121|N|14,95|2010-03-15|API test import 1
1111222233334444|12121|N|34.67|2010-03-15|API test import 2
1111222233334444|12121|Y|49.62|2010-03-15|API test redeem 1
|
|
|
|
|
|
|
Notes:
- 'code' is either
- the unique Customer ID recored in the 'code' field when the customer account was first created AND there was no 'card_number'), or
- the 'card_number' of the customer.
- If date is not given, today's date will be used.
Fields for Buy-X-Get-One-Free / Membership Campaigns:
|
field |
|
Example |
|
Note |
|
visits_header_1 |
|
campaign_id |
|
Required |
|
visits_header_2 |
|
code |
|
Required |
|
visits_header_3 |
|
redeemed |
|
Required: Y | N |
|
visits_header_4 |
|
service_product |
|
Required |
|
visits_header_5 |
|
amount |
|
Required: if not used,
leave blank (empty) |
|
visits_header_6 |
|
date |
|
Required: if not used,
leave blank (empty) |
|
visits_header_7 |
|
authorization |
|
Required: if not used,
leave blank (empty) |
|
Visits_Data |
|
(see below) |
|
|
|
Data to be imported in batch: single (text) field with <eol>s at the end of each line: |
|
1111222233334444|12121|N|Coffees|3|2010-03-15|API test import 1
1111222233334444|12121|N|Cakes|1|2010-03-15|API test import 2
1111222233334444|12121|Y|Coffees|1|2010-03-15|API test redeem 1
|
|
|
|
|
|
|
Notes:
Fields for Events (Visits) Based Campaigns:
|
field |
|
Example |
|
Note |
|
visits_header_1 |
|
campaign_id |
|
Required |
|
visits_header_2 |
|
code |
|
Required |
|
visits_header_3 |
|
redeemed |
|
Required: Y | N |
|
visits_header_4 |
|
date |
|
Required: if not used,
leave blank (empty) |
|
visits_header_5 |
|
authorization |
|
<Required: if not used,
leave blank (empty) |
|
visits_header_6 |
|
amount |
|
If redeemed = Y, otherwise
leave blank (empty)
|
|
Visits_Data |
|
(see below) |
|
|
|
Events to be imported in batch: single (text) field with <eol>s at the end of each line: |
|
1111222233334444|12121|N|2010-03-15|API add event
1111222233334444|12121|N|2010-03-15|API add event
|
|
Redemptions to be imported in batch: Single (text) field with <eol>s at end of each line: |
|
1111222233334444|12121|Y|2010-03-15|API redeem|2 |
|
|
|
|
|
|
Notes:
- 'code' is either
- the unique Customer ID recored in the 'code' field when the customer account was first created AND there was no 'card_number'), or
- the 'card_number' of the customer.
- If date is not given, today's date will be used.
Fields for Earn-per-Event (Visits) Campaigns:
|
field |
|
Example |
|
Note |
|
visits_header_1 |
|
campaign_id |
|
Required |
|
visits_header_2 |
|
code |
|
Required |
|
visits_header_3 |
|
redeemed |
|
Required: Y | N |
|
visits_header_4 |
|
date |
|
Required: if not used,
leave blank (empty) |
|
visits_header_5 |
|
authorization |
|
Required: if not used,
leave blank (empty) |
|
visits_header_6 |
|
amount |
|
If redeemed = Y, otherwise
leave blank (empty)
|
|
Visits_Data |
|
(see below) |
|
|
|
Events to be imported in batch: single (text) field with <eol>s at the end of each line: |
|
1111222233334444|12121|N|2010-03-15|API add event
1111222233334444|12121|N|2010-03-15|API add event
|
|
Redemptions to be imported in batch: single (text) field with <eol>s at end of each line: |
|
1111222233334444|12121|Y|2010-03-15|API redeem|46.95 |
|
|
|
|
|
|
Notes:
- 'code' is either
- the unique Customer ID recored in the 'code' field when the customer account was first created AND there was no 'card_number'), or
- the 'card_number' of the customer.
- If date is not given, today's date will be used.
Example PHP Request for Points-Based Campaign:
If you are using PHP, the $data array would look like this:
- $data['API'] = '1.5';
- $data['user_id'] = 'john1970';
- $data['user_api_key'] = '1959caadac9a8f7e42938a7b13dcb3';
- $data['account_id'] = 'greatwidgets';
- $data['type'] = 'batch_transactions';
- $data['delimiter'] = 'pipe';
- $data['apply_ratio'] = 'yes';
- $data['allow-undo'] = 'yes';
- $data['visits_header_1'] = 'campaign_id';
- $data['visits_header_2'] = 'code';
- $data['visits_header_3'] = 'redeemed';
- $data['visits_header_4'] = 'amount';
- $data['visits_header_5'] = 'date';
- $data['visits_header_6'] = 'custom_field_3';
- $data['Visits_Data'] = '
- 4638472975924871|12121|N|14,95|2010-03-15|API test import 1
- 4638472975924871|12121|N|50|2010-03-15|API test import 2
- 4638472975924871|12121|N|34.67|2010-03-15|API test import 3
- 4638472975924871|12121|N|0,50|2010-03-15|API test import 4
- 4638472975924871|12121|N|.75|2010-03-15|API test import 5
- 4638472975924871|12121|N|2.00|2010-03-15|API test import 6
- 4638472975924871|12121|Y|1500|2010-03-15|API test redeem 1
- ';
Success XML Response:
- <response status="success">
- <batch status="all_imported">
- <transactions>7</transactions>
- </batch>
- </response>
Error XML Response:
- <response status="error">
- <error>Error message</error>
- </response>
|