API DOCUMENTATION Last Update: Apr 2022

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:

  1. $data['user_id'] = 'john1970';
  2. $data['user_password'] = '1959caadac9b13dcb3';
  3. $data['type'] = 'record_activity';
  4. $data['account_id'] = 'greatwidgets';
  5. $data['code'] = '1234567890123456';
  6. $data['campaign_id'] = '1111222233334444';
  7. $data['amount'] = '9.95';
  8. $data['promo_id'] = '89';
  9. $data['authorization'] = 'Custom description';
  10. $data['custom_field_2'] = 'Store 35';
  11. $data['custom_field_5'] = 'Some other data';
  12. $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:

  1. <response status="success">
  2. <receipt>
  3. <account_name>Demo Business</account_name>
  4. <campaign>
  5. <id>1111222233334444</id>
  6. <name>Widget Rewards</name>
  7. </campaign>
  8. <customer>
  9. <first_name>John</first_name>
  10. <last_name>Smmith</last_name>
  11. <card_number>11112222</card_number>
  12. <phone>555-5555</phone>
  13. <email>jsmith@workemail.com</email>
  14. <custom_field>He likes cheese</custom_field>
  15. <custom_date>1970-07-14</custom_date>
  16. </customer>
  17. <transaction>
  18. <id>1234</id>
  19. <purchase>
  20. <amount>9.95</amount>
  21. <currency>USD</currency>
  22. </purchase>
  23. <promotion>
  24. <description>Double Points Tuesday</description>
  25. <operation>x</operation>
  26. <amount>2</amount>
  27. </promotion>
  28. <recorded>
  29. <points>1990</points>
  30. <description>Optional note here</description>
  31. </recorded>
  32. <balance>
  33. <points>4590</points>
  34. <monetary>4.75</monetary>
  35. <currency>USD</currency>
  36. </balance>
  37. <cumulative_balance>
  38. <points>78390</points>
  39. <monetary>43.50</monetary>
  40. <currency>USD</currency>
  41. </cumulative_balance>
  42. </transaction>
  43. </receipt>
  44. </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:

  1. <response status="success">
  2. <receipt>
  3. <account_name>Demo Business</account_name>
  4. <campaign>
  5. <id>2222333344445555</id>
  6. <name>Gift Card</name>
  7. </campaign>
  8. <customer>
  9. <first_name>John</first_name>
  10. <last_name>Smmith</last_name>
  11. <card_number>11112222</card_number>
  12. <phone>555-5555</phone>
  13. <email>jsmith@workemail.com</email>
  14. <custom_field>He likes cheese</custom_field>
  15. <custom_date>1970-07-14</custom_date>
  16. </customer>
  17. <transaction>
  18. <id>1234</id>
  19. <add>
  20. <amount>9.95</amount>
  21. <currency>USD</currency>
  22. <description>Optional note here</description>
  23. </add>
  24. <balance>
  25. <amount>48.75</amount>
  26. <currency>USD</currency>
  27. </balance>
  28. <cumulative_balance>
  29. <amount>413.50</amount>
  30. <currency>USD</currency>
  31. </cumulative_balance>
  32. </transaction>
  33. </receipt>
  34. </response>

 

Success XML Response for Events Campaign:

Note: The response XML will include information that can be used to print a receipt:

  1. <response status="success">
  2. <receipt>
  3. <account_name>Demo Business</account_name>
  4. <campaign>
  5. <id>3333444455556666</id>
  6. <name>Frequent Shopper</name>
  7. </campaign>
  8. <customer>
  9. <first_name>John</first_name>
  10. <last_name>Smmith</last_name>
  11. <card_number>11112222</card_number>
  12. <phone>555-5555</phone>
  13. <email>jsmith@workemail.com</email>
  14. <custom_field>He likes cheese</custom_field>
  15. <custom_date>1970-07-14</custom_date>
  16. </customer>
  17. <transaction>
  18. <id>1234</id>
  19. <event>
  20. <description>Optional note here</description>
  21. <amount>9.95</amount>
  22. </event>
  23. <balance>
  24. <events>12</events>
  25. </balance>
  26. <cumulative_balance>
  27. <events>25</events>
  28. </cumulative_balance>
  29. </transaction>
  30. </receipt>
  31. </response>

 

Success XML Response for Earn-per-Event Campaign:

Note: The response XML will include information that can be used to print a receipt:

  1. <response status="success">
  2. <receipt>
  3. <account_name>Demo Business</account_name>
  4. <campaign>
  5. <id>4444555566667777</id>
  6. <name>GateKeeper Rewards</name>
  7. </campaign>
  8. <customer>
  9. <first_name>John</first_name>
  10. <last_name>Smmith</last_name>
  11. <card_number>11112222</card_number>
  12. <phone>555-5555</phone>
  13. <email>jsmith@workemail.com</email>
  14. <custom_field>He likes cheese</custom_field>
  15. <custom_date>1970-07-14</custom_date>
  16. </customer>
  17. <transaction>
  18. <id>1234</id>
  19. <event>
  20. <description>Optional note here</description>
  21. </event>
  22. <earn>
  23. <amount>4.50</amount>
  24. <currency>USD</currency>
  25. </earn>
  26. <balance>
  27. <amount>22.50</amount>
  28. <currency>USD</currency>
  29. </balance>
  30. <cumulative_balance>
  31. <amount>45.00</amount>
  32. <currency>USD</currency>
  33. </cumulative_balance>
  34. </transaction>
  35. </receipt>
  36. </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:

  1. <response status="success">
  2. <receipt>
  3. <account_name>Demo Business</account_name>
  4. <campaign>
  5. <id>5555666677778888</id>
  6. <name>Widget Rewards</name>
  7. </campaign>
  8. <customer>
  9. <first_name>John</first_name>
  10. <last_name>Smmith</last_name>
  11. <card_number>11112222</card_number>
  12. <phone>555-5555</phone>
  13. <email>jsmith@workemail.com</email>
  14. <custom_field>He likes cheese</custom_field>
  15. <custom_date>1970-07-14</custom_date>
  16. </customer>
  17. <transaction>
  18. <id>1234</id>
  19. <purchase>
  20. <item>Books</item>
  21. <quantity>2</quantity>
  22. <description>Optional note here</description>
  23. </purchase>
  24. <balances>
  25. <item>
  26. <name>Books</name>
  27. <current>14</current>
  28. <cumulative>14</cumulative>
  29. </item>
  30. <item>
  31. <name>Coffees & Teas</name>
  32. <current>6</current>
  33. <cumulative>43</cumulative>
  34. </item>
  35. <item>
  36. <name>Cakes & Cookies</name>
  37. <current>2</current>
  38. <cumulative>12</cumulative>
  39. </item>
  40. ...
  41. </balances>
  42. </transaction>
  43. </receipt>
  44. </response>

 

 

Error XML Response:

  1. <response status="error">
  2. <error>Error message</error>
  3. </response>