Tiago Soromenho
posted this on October 29, 2008 04:17 pm
NOTE: THIS IS AN OLD ARTICLE. OUR FULL API CAN BE FOUND AT HTTP://API.CLIENTTOOLBOX.COM
QUESTION
I have an e-commerce site where I want to offer a rewards program. Is there a way to have it automatically update with the customer purchases from my site?
SOLUTION
Although the official answer is "no", technically, there are ways this can be achieved, depending on a few factors.
The program is made for manual entry, but we are working very hard on an "API" that will standardize this type of link with a REST-type of framework through XML.
That said, there are two way around the problem right now:
1) You can send us files to be batch-uploaded periodically. You can read more about this at: http://support.stickystreet.com/forums/16257/entries/10077
2) We have a sort of Quasi-API that can do some basic transaction recording -- with the caveat that its implementation will become obsolete when the new API is implemented. If you are able to send a GET request to a URL and ignore/throw away the output (in PHP, using "curl" and sending the resulting output to a variable that is then ignored.) Here are some instructions below, if you want to play around.
Again, however you implement the request on your end, make sure to ignore/discard any response from our server, which will attempt to return a fully formed HTML page.
=========== THE QUASI-PRE-API ===========
When inserting a new account, create two requests: One to create the customer's account info, and a second to record the activity in a particular campaign.
If you aren't sure if a transaction is for a new or existing account, err on the side of send both requests. In fact, unless you have a way to know for sure that a transaction has had the customer info created, and there has been no changes to that info since, we would recommend that every transaction request is accompanied with a customer account info update request.
For Recording an account's user info
Use this to both record a new account or to edit an existing account's info.
Put together a URL on a _single line_ with the following elements:
https://www.scanandgorewards.com/admin.php? user_id=AAAAA & user_password=BBBBB & campaign_id=CCCCC & card_number=EEEEE & type=record_customer & first_name=FFFFF & last_name=GGGGG & phone=HHHHH & email=IIIII & custom_date=JJJJJ & street1=KKKKK & street2=LLLLL & city=MMMMM & state=NNNNN & postal_code=OOOOO & country=PPPPP & custom1=QQQQQ
Where:
For recording Points campaign activity & creating new accounts
New customer accounts are automatically created when a record_activity request is received and the account/card code is not in the system already.
Put together a URL on a _single line_ with the following elements:
https://www.scanandgorewards.com/admin.php? user_id=AAAAA & user_password=BBBBB & campaign_id=CCCCC & code=EEEEE & type=record_activity & amount=FFFFF & promo_id=GGGGG & authorization=HHHHH
Where:
For deducting / redeeming points
Because there is no built-in way to check on your end if a customer's current point balance is greater than the amount to be redeemed, I would not recomment using this call, or do so very carefully in situations where it may be very certain that a customer has enough points for the transaction.
Put together a URL on a _single line_ with the following elements:
https://www.scanandgorewards.com/admin.php? user_id=AAAAA & user_password=BBBBB & campaign_id=CCCCC & code=EEEEE & type=redeem & custom_points_redeem_max=FFFFF & custom_points_redeem=GGGGG & custom_dollars_redeem=HHHHH & reward_to_redeem=JJJJJ & authorization=KKKKK
Where:
=========== END OF QUASI-PRE-API ===========