Batch Transactions
Record a batch of transactions for a customer account, including redemptions.
The data to be submitted to the API is composed of the following fields:
Fields common to all campaign types:
|
field |
|
Example |
|
Note |
|
|
user_id |
|
john1970 |
|
Required |
|
|
user_password |
|
1959caadac9b13dcb3 |
|
Required |
|
|
type |
|
batch_transactions |
|
Required |
|
|
account_id |
|
greatwidgets |
|
Required |
|
|
delimiter |
|
pipe or comma or tab |
|
Required |
|
|
apply_ratio |
|
yes |
|
Optional: 'yes' or don't include. |
|
|
no-undo |
|
yes |
|
Optional: 'yes' or don't include. |
|
|
send_transaction_email |
|
Y |
|
Optional: 'Y' 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 |
|
|
|
|
|
|
|
|
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
set value to none |
|
visits_header_5 |
|
date |
|
Required: if not used
set value to none |
|
visits_header_6 |
|
authorization |
|
Required: if not used
set value to none |
|
visits_header_7 |
|
none |
|
Required: if not used
set value to none |
|
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|03/15/2010|API test import 1
1111222233334444|12121|N|50|03/15/2010|API test import 2
1111222233334444|12121|N|34.67|03/15/2010|API test import 3
1111222233334444|12121|N|0,50|03/15/2010|API test import 4
1111222233334444|12121|N|.75|03/15/2010|API test import 5
1111222233334444|12121|N|2.00|03/15/2010|API test import 6
1111222233334444|12121|Y|1500|03/15/2010|API test redeem 1
|
|
|
|
|
|
|
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
set value to none |
|
visits_header_5 |
|
date |
|
Required: if not used
set value to none |
|
visits_header_6 |
|
authorization |
|
Required: if not used
set value to none |
|
visits_header_7 |
|
none |
|
Required: if not used
set value to none |
|
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|03/15/2010|API test import 1
1111222233334444|12121|N|34.67|03/15/2010|API test import 2
1111222233334444|12121|Y|49.62|03/15/2010|API test redeem 1
|
|
|
|
|
|
|
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
set value to none |
|
visits_header_6 |
|
date |
|
Required: if not used
set value to none |
|
visits_header_7 |
|
authorization |
|
Required: if not used
set value to none |
|
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|03/15/2010|API test import 1
1111222233334444|12121|N|Cakes|1|03/15/2010|API test import 2
1111222233334444|12121|Y|Coffees|1|03/15/2010|API test redeem 1
|
|
|
|
|
|
|
Notes:
- 'service_product' is not the "id" but the "description" returned by the BuyX Campaign Items List API call. This is because some clients import lists of transaction with items they did not pre-enter in the admin interface. Thus, the import does allows new (service_product) items to be used that have not been pre-defined.
- The caveat is that each service_product name must be exactly spelled and capitalized the same, usually not an issue when that information is taken from another database or output from a POS or inventory management system.
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
set value to none |
|
visits_header_5 |
|
authorization |
|
Required: if not used
set value to none |
|
visits_header_6 |
|
amount |
|
If redeemed = Y then Required
else set array key to none |
|
visits_header_7 |
|
none |
|
Required: if not used
set value to none |
|
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|03/15/2010|API add event
1111222233334444|12121|N|03/15/2010|API add event
|
|
Redemptions to be imported in batch: Single (text) field with <eol>s at end of each line: |
|
1111222233334444|12121|Y|03/15/2010|API redeem|2 |
|
|
|
|
|
|
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
set value to none |
|
visits_header_5 |
|
authorization |
|
Required: if not used
set value to none |
|
visits_header_6 |
|
amount |
|
If redeemed = Y then Required
else set array key to none |
|
visits_header_7 |
|
none |
|
Required: if not used
set value to none |
|
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|03/15/2010|API add event
1111222233334444|12121|N|03/15/2010|API add event
|
|
Redemptions to be imported in batch: single (text) field with <eol>s at end of each line: |
|
1111222233334444|12121|Y|03/15/2010|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.
- Unless there's a good reason, include the 'no-undo' = 'yes' directive, otherwise every batch will be listed in the Manage Customer Records section.
Example PHP Request for Points-Based Campaign:
If you are using PHP, the $data array would look like this:
- $data['user_id'] = 'john1970';
- $data['user_password'] = '1959caadac9b13dcb3';
- $data['type'] = 'batch_transactions';
- $data['account_id'] = 'greatwidgets';
- $data['delimiter'] = 'pipe';
- $data['apply_ratio'] = 'yes';
- $data['no-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'] = 'authorization';
- $data['visits_header_7'] = 'none';
- $data['Visits_Data'] = '
- 4638472975924871|12121|N|14,95|03/15/2010|API test import 1
- 4638472975924871|12121|N|50|03/15/2010|API test import 2
- 4638472975924871|12121|N|34.67|03/15/2010|API test import 3
- 4638472975924871|12121|N|0,50|03/15/2010|API test import 4
- 4638472975924871|12121|N|.75|03/15/2010|API test import 5
- 4638472975924871|12121|N|2.00|03/15/2010|API test import 6
- 4638472975924871|12121|Y|1500|03/15/2010|API test redeem 1
- ';
Success XML Response:
- <response status="success">
- <batch status="imported">
- <transactions>7</transactions>
- </batch>
- </response>
Error XML Response:
- <response status="error">
- <error>Error message</error>
- </response>
|