Many Merchants could benefit greatly from the ShareASale API’s ability to automate common or repetitive tasks. However, its technical nature can be a barrier for some so let’s tap into our inner geek and explore the basic building blocks of a successful Merchant API request!
Step #1: What do you want to do?
Decide what task you’d like to take control of using the API. Would you like to automate reconciliation by having transaction voids and edits reflected in ShareASale automatically? Try the VOID or EDIT API requests. The newest version of our Merchant API (1.7) will even allow you to void or edit child transactions related to an original, source transaction too. For example, a two-tier or leapfrog transaction could also be voided with the original order that triggered it, if applicable and necessary.
If you would like to have all ShareASale transactions on-hand locally for your own records, you could request the Transaction Detail Report using the API. All of your Affiliates’ referred transactions would be returned and you can store them internally. Then, you’ll always know which transactions were referred by any Affiliate without ever having to login!
For a final example, you might decide to automate your seasonal banner updates. The deal, banner, or text link edit API requests are perfect for that task and once setup might save you a bundle of time.
Step #2: Create the URL Request
All API requests are basically a URL – you might be familiar with something similar when navigating the web. When you type in the URL ‘www.facebook.com’ you’re requesting information from Facebook. For the ShareASale API your URL is ‘https://shareasale.com/w.cfm’ instead.
However, with an API request instead of the browser receiving a web page for a human, it’s a script receiving data for a computer.
Let’s first create the URL:
Start with: https://shareasale.com/w.cfm
All requests must contain:
- ?merchantID= your merchant ID number
- &token= unique alphanumeric token received when account is set up for API use. Check your settings for yours.
- &action= one of the supported actions (edit, void, etc. from step 1 above)
- &version= currently 1.7
Step #3: Adding Additional Parameters
Working through a VOID transaction API request, we have the following so far:
But wait! Different API requests require extra parameters. A VOID API request also needs the minimum:
- &date= format mm/dd/yyyy of the original order’s date
- &ordernumber= your order number to be voided
- &reason= URL encoded text description of void reason
If we had an order number 123 originally placed on June 1st 2013 that was returned by a customer as the wrong size our request is now:
Step #4: The Final Touch
ShareASale’s API also requires you prove you really are our Merchant. You wouldn’t want just anyone to be able to void your transactions, request your reports, or edit your banners!
So, every request requires authentication. You can set only certain IP addresses to gain access, and/or send a special encoded authentication string with your request depending on the API version.
This is a bit technical, so read more on our Merchant API settings page (Tools >> Merchant API) including sample code to get you started. Once the authentication is setup, no more work is necessary.