26 Apr 2024 
Support Center » Knowledgebase » Technical FAQs » Advanced integration and API » Getting Started with the Affiliate API
 Getting Started with the Affiliate API
Solution

Using the Affiliate API


The Affiliate API is a tool that affiliates can use to perform affiliate-specific actions remotely. Currently, the API functions solely as a way to verify whether or not a purchase was made using a particular affiliate link. It does this by using the transaction or receipt ID of the purchase combined with the affiliate’s account ID to lookup the record containing the purchase details. Now, by default, transaction IDs are included in every email receipt and thank you page. This can be useful when an affiliate wants to give the client a way to redeem extra content if they purchased the core product off of their affiliate link.


Let’s dig in!


Quickstart Guide


 Getting Set Up


  1. Log in to your Nanacast account and navigate to the Profile & Preferences page

  2. Open the “Affiliate API Settings” section to show the fields needed for setup.

  3. Make note of the API endpoint (this is where you post requests to) and then enter a custom API Passphrase of your choosing in the input field that appears after clicking the “Change” link.

  4. Provide a source URL. This is used to authorize the URL making the request. Provide the domain only. For example, if you are making the request from http://mycooldomain.com/stuff/nanacastSalesAPI.php, only provide http://mycooldomain.com as the source URL.

  5. Click the “Commit” button.



Making a Request

  1. Here is an example of a front-end request using jQuery to make an asynchronous request using JSON:AffApiRequest_JSON.png

  2. And if you prefer to make the request from the back-end, here’s an example of a request using PHP and an array containing the payload:AffApiRequest_Array.png

    1. Note: You may also use cURL, if you prefer.

  3. As long as there is valid data supplied in your request AND you are making the request from the domain you saved under Profile & Preferences->Affiliate API Settings, the request should work.

  4. All of the request parameters are required; omitting any of them will result in an error or failure.


Catching the Response

  1. Once you have made a successful request to the API, you must catch the response and process it.

  2. For an example of how to catch and process the response for a front-end AJAX request, see the code example for Making the Request above.

  3. For the back-end, PHP request, know that the response will always be JSON, so it may be convenient to process it immediately using json_decode($response) to convert it to a PHP object or json_decode($response, true) if you wish to convert it to an associative array.


Other Notes

  1. As of right now, the Affiliate API is a one-trick pony that can verify whether or not a client bought off a specific affiliate link or not. In the future, we have plans to expand the functionality of this and our other On-Demand API. If you have any suggestions for features, feel free to let us know via Nanacast Support.

  2. If, after reading all of this documentation, you still have questions on getting started with this API, feel free to let us know via Nanacast Support.



Article Details
Article ID: 275
Created On: 06 May 2014 03:06 PM

 This answer was helpful  This answer was not helpful

 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | News
Language:

Help Desk Software By Kayako eSupport v3.60.04