Record Transaction
Record a transaction for a customer account.
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 |
|
record_activity |
|
Required |
|
|
account_id |
|
1111222233334444 |
|
Required |
|
|
code or card_number |
|
1234567890123456
11112222 |
|
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 |
|
|
|
|
|
|
|
|
Fields for Points-Based Campaigns:
|
field |
|
Example |
|
Note |
|
campaign_id |
|
1111222233334444 |
|
Required |
|
amount |
|
9.95 or 9,95 |
|
Optional |
|
promo_id |
|
89 |
|
Do not include if none |
|
authorization |
|
Custom description |
|
Optional |
|
send_transaction_email |
|
Y |
|
Do not include
if none to be sent. |
|
custom_field_# |
|
Store 35 |
|
See Notes below. |
|
custom_field_# |
|
238479237t2t3 |
|
See Notes below. |
|
... |
|
|
|
|
|
|
|
|
|
|
Fields for Gift-Card Campaigns:
|
field |
|
Example |
|
Note |
|
campaign_id |
|
22223333444455555 |
|
Required |
|
amount |
|
9.95 or 9,95 |
|
Required |
|
authorization |
|
Custom description |
|
Optional |
|
send_transaction_email |
|
Y |
|
Do not include
if none to be sent. |
|
custom_field_# |
|
Store 35 |
|
See Notes below. |
|
custom_field_# |
|
238479237t2t3 |
|
See Notes below. |
|
... |
|
|
|
|
|
|
|
|
|
|
Fields for Buy-X-Get-One-Free / Membership Campaigns:
|
field |
|
Example |
|
Note |
|
campaign_id |
|
5555666677778888 |
|
Required |
|
service_product |
|
96
or
item_identifier
|
|
Required |
|
buyx_quantity |
|
10 |
|
Optional |
|
authorization |
|
Custom description |
|
Optional |
|
send_transaction_email |
|
Y |
|
Do not include
if none to be sent. |
|
custom_field_# |
|
Store 35 |
|
See Notes below. |
|
custom_field_# |
|
238479237t2t3 |
|
See Notes below. |
|
... |
|
|
|
|
|
|
|
|
|
|
Fields for Events (Visits) Based Campaigns:
|
field |
|
Example |
|
Note |
|
campaign_id |
|
3333444455556666 |
|
Required |
|
authorization |
|
Custom description |
|
Optional |
|
send_transaction_email |
|
Y |
|
Do not include
if none to be sent. |
|
custom_field_# |
|
Store 35 |
|
See Notes below. |
|
custom_field_# |
|
238479237t2t3 |
|
See Notes below. |
|
... |
|
|
|
|
|
|
|
|
|
|
Fields for Earn-per-Event (Visits) Campaigns:
|
field |
|
Example |
|
Note |
|
campaign_id |
|
4444555566667777 |
|
Required |
|
authorization |
|
Custom description |
|
Optional |
|
send_transaction_email |
|
Y |
|
Do not include
if none to be sent. |
|
custom_field_# |
|
Store 35 |
|
See Notes below. |
|
custom_field_# |
|
238479237t2t3 |
|
See Notes below. |
|
... |
|
|
|
|
|
|
|
|
|
|
Notes:
- 'When using this call and using the 'code' parameter to identify a customer,
the 'code' 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 when the customer account was created and returned to you
in the API response.
Otherwise, pass the customer's card number or memnbership identifier as the 'card_number'.
- If you don't know what either the code or card_number are,
you can search for a customer using any of their information (like phone #, or other
custom field marked as "searchable"
by using the customer_search or customer_find
API calls to retrieve the customer's code.
- New customer accounts are automatically created when a transaction is received and the account code is not in the system already. Requests that pass a card_number that cannot be located will return an error.
- The field values promo_id for Points campaigns and service_product for BuyX campaigns can be found by calling the Campaign Promotions and BuyX Campaign Items List API calls.
- 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).
- To know what the custom_field_# of a custom field is, issue the Transactions Fields - List API call to get a list of the current defined custom transaction fields.
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'] = 'record_activity';
- $data['account_id'] = 'greatwidgets';
- $data['code'] = '1234567890123456';
- $data['campaign_id'] = '1111222233334444';
- $data['amount'] = '9.95';
- $data['promo_id'] = '89';
- $data['authorization'] = 'Custom description';
- $data['custom_field_2'] = 'Store 35';
- $data['custom_field_5'] = 'Some other data';
- $data['send_transaction_email'] = 'Y';
Success XML Response for Points Campaign:
Note: The response XML will include information that can be used to print a receipt:
- <response status="success">
- <receipt>
- <account_name>Demo Business</account_name>
- <campaign>
- <id>1111222233334444</id>
- <name>Widget Rewards</name>
- </campaign>
- <customer>
- <first_name>John</first_name>
- <last_name>Smmith</last_name>
- <card_number>11112222</card_number>
- <phone>555-5555</phone>
- <email>jsmith@workemail.com</email>
- <custom_field>He likes cheese</custom_field>
- <custom_date>1970-07-14</custom_date>
- </customer>
- <transaction>
- <id>1234</id>
- <purchase>
- <amount>9.95</amount>
- <currency>USD</currency>
- </purchase>
- <promotion>
- <description>Double Points Tuesday</description>
- <operation>x</operation>
- <amount>2</amount>
- </promotion>
- <recorded>
- <points>1990</points>
- <description>Optional note here</description>
- </recorded>
- <balance>
- <points>4590</points>
- <monetary>4.75</monetary>
- <currency>USD</currency>
- </balance>
- <cumulative_balance>
- <points>78390</points>
- <monetary>43.50</monetary>
- <currency>USD</currency>
- </cumulative_balance>
- </transaction>
- </receipt>
- </response>
Notes:
- 'The operation in the promotion describes either a multiplication (x) or addition (+)
Success XML Response for Gift Card Campaign:
Note: The response XML will include information that can be used to print a receipt:
- <response status="success">
- <receipt>
- <account_name>Demo Business</account_name>
- <campaign>
- <id>2222333344445555</id>
- <name>Gift Card</name>
- </campaign>
- <customer>
- <first_name>John</first_name>
- <last_name>Smmith</last_name>
- <card_number>11112222</card_number>
- <phone>555-5555</phone>
- <email>jsmith@workemail.com</email>
- <custom_field>He likes cheese</custom_field>
- <custom_date>1970-07-14</custom_date>
- </customer>
- <transaction>
- <id>1234</id>
- <add>
- <amount>9.95</amount>
- <currency>USD</currency>
- <description>Optional note here</description>
- </add>
- <balance>
- <amount>48.75</amount>
- <currency>USD</currency>
- </balance>
- <cumulative_balance>
- <amount>413.50</amount>
- <currency>USD</currency>
- </cumulative_balance>
- </transaction>
- </receipt>
- </response>
Success XML Response for Events Campaign:
Note: The response XML will include information that can be used to print a receipt:
- <response status="success">
- <receipt>
- <account_name>Demo Business</account_name>
- <campaign>
- <id>3333444455556666</id>
- <name>Frequent Shopper</name>
- </campaign>
- <customer>
- <first_name>John</first_name>
- <last_name>Smmith</last_name>
- <card_number>11112222</card_number>
- <phone>555-5555</phone>
- <email>jsmith@workemail.com</email>
- <custom_field>He likes cheese</custom_field>
- <custom_date>1970-07-14</custom_date>
- </customer>
- <transaction>
- <id>1234</id>
- <event>
- <description>Optional note here</description>
- <amount>9.95</amount>
- </event>
- <balance>
- <events>12</events>
- </balance>
- <cumulative_balance>
- <events>25</events>
- </cumulative_balance>
- </transaction>
- </receipt>
- </response>
Success XML Response for Earn-per-Event Campaign:
Note: The response XML will include information that can be used to print a receipt:
- <response status="success">
- <receipt>
- <account_name>Demo Business</account_name>
- <campaign>
- <id>4444555566667777</id>
- <name>GateKeeper Rewards</name>
- </campaign>
- <customer>
- <first_name>John</first_name>
- <last_name>Smmith</last_name>
- <card_number>11112222</card_number>
- <phone>555-5555</phone>
- <email>jsmith@workemail.com</email>
- <custom_field>He likes cheese</custom_field>
- <custom_date>1970-07-14</custom_date>
- </customer>
- <transaction>
- <id>1234</id>
- <event>
- <description>Optional note here</description>
- </event>
- <earn>
- <amount>4.50</amount>
- <currency>USD</currency>
- </earn>
- <balance>
- <amount>22.50</amount>
- <currency>USD</currency>
- </balance>
- <cumulative_balance>
- <amount>45.00</amount>
- <currency>USD</currency>
- </cumulative_balance>
- </transaction>
- </receipt>
- </response>
Success XML Response for Buy-X-Get-One-Free Campaign:
Note: The response XML will include information that can be used to print a receipt:
- <response status="success">
- <receipt>
- <account_name>Demo Business</account_name>
- <campaign>
- <id>5555666677778888</id>
- <name>Widget Rewards</name>
- </campaign>
- <customer>
- <first_name>John</first_name>
- <last_name>Smmith</last_name>
- <card_number>11112222</card_number>
- <phone>555-5555</phone>
- <email>jsmith@workemail.com</email>
- <custom_field>He likes cheese</custom_field>
- <custom_date>1970-07-14</custom_date>
- </customer>
- <transaction>
- <id>1234</id>
- <purchase>
- <item>Books</item>
- <quantity>2</quantity>
- <description>Optional note here</description>
- </purchase>
- <balances>
- <item>
- <name>Books</name>
- <current>14</current>
- <cumulative>14</cumulative>
- </item>
- <item>
- <name>Coffees & Teas</name>
- <current>6</current>
- <cumulative>43</cumulative>
- </item>
- <item>
- <name>Cakes & Cookies</name>
- <current>2</current>
- <cumulative>12</cumulative>
- </item>
- ...
- </balances>
- </transaction>
- </receipt>
- </response>
Error XML Response:
- <response status="error">
- <error>Error message</error>
- </response>
|