Earning Services
Use the earning services to get information on the earnings for the users in your site.
GetSiteEarnings
Description
The GetSiteEarnings method returns a list of all the earnings for all users in the site for a given time period.
Request Parameters
| Field | Field Type | Data Type | Description |
|---|---|---|---|
| Authorization | Header | String | This is the authorization token you'll get from the site administrator console. You must send this string with every api request. |
| Method | URL | String | To use this method you must use the string: GetSiteEarnings |
| StartDate | URL | DateTime | The start date of the report. |
| EndDate | URL | DateTime | The end date of the report. |
| Page | URL | Integer | The page of results you want. |
| Count | URL | String | The number of records per page you want. Ranges from 1 to 100. Defaults to 50. |
| ReturnType | URL | String | This is the type of response you're looking for. Valid values are json and xml. This defaults to json. |
Example:
If you only wanted to get one earning for you site on January 4th 2010 then you would use the following url along with the authorization string in your header:
http://yoursite.com/webservices/earning?method=GetSiteEarnings&Page=1&Count=1&StartDate=2010-01-04&EndDate=2010-01-05
Response
Below are the fields it returns.
| Field | Type | Description |
|---|---|---|
| Earnings | Array | An array of the earnings. |
| Records | Integer | The total number of records matching your criteria. |
Earnings Array
| Field | Type | Description |
|---|---|---|
| Amount | Double | The dollar amount of the earning. |
| PostDate | DateTime | The date and time the earning was posted. |
| Username | String | The username of the user who received the earning. |
| RebateID | Integer | The iRebates system ID of the rebate. |
| UserID | Integer | The iRebates system ID of the user who received the earning. |
| Type | String | The type of earning received. |
| MerchantID | Integer | The iRebates system ID of the merchant that paid out the earning. |
| MerchantName | String | The name of the merchant that paid out the earning. |
Example
Here is an example of a JSON response.
{"Earnings":[{"Amount":1.23,"PostDate":"January, 04 2010 15:59:55-0700","Username":"johndoe","RebateID":364704,
"UserID":123456,"Type":"Rebate","MerchantID":304,"MerchantName":"Bass Pro Shop"}],"Records":910}
CreatePayout
Description
The CreatePayout method creates a payout record for a specific user based on unpaid earnings.
Request Parameters
| Field | Field Type | Data Type | Description |
|---|---|---|---|
| Authorization | Header | String | This is the authorization token you'll get from the site administrator console. You must send this string with every api request. |
| Method | URL | String | To use this method you must use the string: CreatePayout |
| UserID | URL | Integer | The ID of the iRebates user to create the payout for. |
| EndDate | URL | DateTime | The datetime that all unpaid earnings must be less than in order to be associated with the payout. |
| CheckNum | URL | String | The reference number or string associated with the payout. |
Example:
If you only wanted to create a payout for a user with a userID of 12345 for all unpaid earnings prior to January 1st, 2012 with a reference number of 98765 then you would use the following url along with the authorization string in your header:
http://yoursite.com/webservices/earning?method=CreatePayout&CheckNum=98765&UserID=12345&EndDate=2012-01-01
Response
Below are the fields it returns.
| Field | Type | Description |
|---|---|---|
| Success | Boolean | |
| Amount | Double | The dollar amount of the payout. |
| PayoutID | Integer | The iRebates ID for the payout. |
Example
Here is an example of a JSON response.
{"Success":true,"Amount":12.45,"PayoutID":12345}
GetPayoutDetails
Description
The GetPayoutDetails method returns the details for a specific payout including a list of all the earnings associated with it.
Request Parameters
| Field | Field Type | Data Type | Description |
|---|---|---|---|
| Authorization | Header | String | This is the authorization token you'll get from the site administrator console. You must send this string with every api request. |
| Method | URL | String | To use this method you must use the string: GetPayoutDetails |
| PayoutID | URL | Integer | The iRebates ID of the payout. |
Example:
If you only wanted to get the details for a payout with an ID of 12345 then you would use the following url along with the authorization string in your header:
http://yoursite.com/webservices/earning?method=GetPayoutDetails&PayoutID=12345
Response
Below are the fields it returns.
| Field | Type | Description |
|---|---|---|
| PayoutID | Integer | The iRebates ID of the payout. |
| UserID | Integer | The iRebates ID of the user the payout is for. |
| Date | Datetime | The datetime the payout was created |
| Amount | Double | The amount of the payout |
| CheckNumber | String | The reference number of the payout |
| Earnings | Array | An array of the earnings. |
Earnings Array
| Field | Type | Description |
|---|---|---|
| Amount | Double | The dollar amount of the earning. |
| Date | DateTime | The date and time the earning was posted. |
| Merchant | String | The name of the merchant that paid out the earning. |
| EarningID | Integer | The iRebates ID for the earning. |
Example
Here is an example of a JSON response.
{"Earnings":[{"Amount":2.55,"Merchant":"Overstock.com","EarningID":671826,"Date":"September, 10 2011 01:00:10"},
{"Amount":2.54,"Merchant":"Overstock.com","EarningID":672000,"Date":"September, 27 2011 01:00:17"}],"Amount":5.09,
"PayoutID":"9655","UserID":196048,"Date":"March, 07 2012 14:06:03","CheckNum":"FakeCheck"}
