_________________________________________________________

NOTE: The below info is for v1 of our API. V2 is now available in beta and
the documentation can be found here: https://warriorplus.com/api/docs

* V2 is currently in BETA and is not officially supported at this time.

_________________________________________________________

Introduction

The WarriorPlus API currently offers the following endpoints you can submit requests to in order to gather information about your account, and various aspects of the Warrior+Plus system:

Endpoints:

• Sale (/api/v1/sale/saleID)

What is an endpoint?

Basically, an endpoint is a service you can call on our server using your API key that will return certain information. The 'sale' endpoint for example, returns various information such as sale amount, sale status and buyer's email when you provide a sale ID.

What can I do with the API?

Making API calls can benefit your external applications in many ways. You can verify purchases, register user accounts and all kinds of things. It's limited only by your imagination (and the endpoints we provide you).

Now that you have an idea of what the API service is, let's show you how to make a call.

Making Your First API Call

When you make a call to an endpoint, you submit your api key via the 'apiKey' parameter. The API will then return a JSON encoded array that your script can get via the GET protocol.

This returned array will either have the information you requested, or an error message about what went wrong. Let's take a look at a simple request to the API:

Request:

Our application submits a request to this url, http://warriorplus.com/api/v1/sale/93939393 (assuming 93939393 is a valid sale ID number, normally 7 digits) with the apiKey parameter equal to our apiKey.

Response: A json encoded array like the following.

{"id":"93939393","code":"randomcharcodes","productid":"55555","amount":"10.99","buyer_email":"buyer_email@gmail.com","created":"2014-09-30 11:26:05","status":"Completed","success":1}

Then what?

Depending on the coding language, you need to get that array into a format you can use, and you can use that data to verify a sale, set up an account, or do anything you'd please.

Here is a list of all the fields we may return. Note: Some of these are only returned for specific sale types. IE: Subscription fields won't be returned if the sale was not a subscription. JV information will not be included if there was not JV payments for the sale.

Possible Return Fields On Successful Request

id - This is the sale ID

productid - The ID of the product sold

code - A unique code that identifies the sale, randomly generated string

amount - Amount of the sale

currency - Included if another currency other than USD was used

buyer_email - The email address of the buyer for the sale

created - Date and time of the sale

status - Normally completed or refunded

affiliate_username - The W+ username of the affiliate, ommitted if none

affiliate_userid - W+ userid of the affiliate, ommitted if none

recurring_profile_id - ID of the recurring profile on W+

recurring_total_payments_scheduled - Total number of payments expected for this recurring profile associated with the saleID

recurring_payments_received - Total number of payments received for this recurring profile

recurring_cycles_left - Billing cycles left for the recurring profile

recurring_revenue - Amount brought in through this profile thus far

success - 0 or 1, indicating failure or success respectively


What if I get an error?

The error will be formatted with the following paramters:

success - 0

errors - An array of errors, each entry contains the next three parameters.

error_type - Normally invalid_request (wrong parameters, api key, etc) or api_error, indicating an error on our side.
param - The parameter in question causing the error.
message - More information about the error, if applicable.

What's Coming?

Do you have plans for more endpoints?

Yes, we plan on building a more robust API with time once the current implementations have been tested and are ready to expand.

Did this answer your question?