NATS4 API Get Profit Loss Report

From TMM Wiki
Jump to navigationJump to search
NATS 4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers
SOAP API
API
API Best Practices
WSDL Cache
Add Affiliate
Add Member Note
Admin Get Adtools
Adtool Categories
Adtool Types
Affiliate Get Campaigns
Bulk Import Adtools
Caching
Decode Natscode
Expire Manual Member
Get Affiliate Campaigns
Get Affiliate Hit Data
Get Affiliate Loginids
Get Affiliate Nats Codes
Get Affiliate Payout
Get Affiliate Program Campaign List
Get_Affiliate_Program_Campaign_List
Get Member Details
Get Member Instant Upgrade String
Get Member Package Upgrade String
Get Member Token Rebuy String
Get Member Upsell String
Get Payment Data
Get Payvia Rule
Get Profit Loss Report
Ping
Record Member Login
Search Affiliate Info
Search Member Info
Send Email API Function
Set Affiliate Admin Settings
Set Affiliate Customs
Set Affiliate Defaults
Set Affiliate Information
Set Affiliate Settings
Set Member Details
Set Payment Status
Set Payvia Rule
REST API
API Overview
API Best Practices
REST API PATH UPDATES
Adtools
GET /adtools/admin
GET /adtools/categories
GET /adtools/types
POST /adtools/importdump
Affiliate
GET /affiliate/campaigns
GET /affiliate/hitdata
GET /affiliate/payout
GET /affiliate/searchinfo
POST /affiliate/addaffiliate
POST /affiliate/invoice
PATCH /affiliate/setadminsettings
PATCH /affiliate/setcustoms
PATCH /affiliate/setdefaults
PATCH /affiliate/setinformation
PATCH /affiliate/setpayviainfo
PATCH /affiliate/setsettings
PATCH /affiliate/status
Member
GET /member/authstring
GET /member/details
GET /member/searchinfo
GET /suggestedcanceloffers
PATCH /member/setdetails
PATCH /member/setexpiration
POST /member/addnote
POST /member/recordlogin
PUT /member/expiremanual
PATCH /member/forget
Option
GET /option/options
GET /option/rule
PATCH /option/rule
PATCH/option/text
POST /option/rule
Payments
GET /payments/getpayments
GET /payviarule
PATCH /payments/setstatus
PATCH /payviarule
Report
GET /profitlossreport
Get /transactionpayouts
GET /report/transaction
Service
GET /service/decodenatscode
GET /service/ping
POST /service/sendemail

NATS4 supports an API function to grab all the stats used within the NATS profit and loss report. This function will be available in NATS version 4.1.7.1 and above.

get_profit_loss_report accepts the following parameters:

  • view - The breakdown of the report to display. Possible options are:
    • period
    • month
    • year
    • site_group
    • option
    • tour
    • site
    • subid1
    • subid2
    • program
    • login
    • adtool
    • promotional
    • biller
    • demographic
    • refurl
  • params - Parameters for the report. An array that may contain:
    • period - Which period of time to select data for. See below for more information regarding the periods within NATS.
    • start - Freeform start date for the stats. Used when period is not sent or set to 8
    • end - Freeform end date for the stats. Used when period is not sent or set to 8
    • acct_rep - View the profit and loss report as an account rep. Will only see stats for affiliates assigned to the account rep
    • filter_loginid - Only see stats for the specifc login ID passed in.
    • filter_campaignid - Only see stats for the specific campaign ID for the affiliate. (Can only be used if filter_loginid is passed in)
    • filter_siteid - Only see stats for the specific site ID passed in.
    • filter_tourid - Only see stats for the specific tour ID passed in.
    • filter_optionid - Only see stats for the specific option ID passed in.
    • filter_adtoolid - Only see stats for the specific adtool ID passed in.
    • filter_billerid - Only see stats for the specific biller ID passed in.
    • filter_programid - Only see stats for the specific program ID passed in.
    • filter_countryid - Only see stats for the specific Country ID passed in.
    • natscode - Breakdown the NATS code and only view stats associated with the NATS code.
    • no_inhouse - Remove in-house traffic from the returned report.
    • no_typein - Remove type-in traffic from the returned report.

Periods

# Name Argument Description
0 current Current Period
1 last Last Period
2 today Today
3 yesterday Yesterday
4 week This Week
5 month This Month
6 year This Year
7 all All Time
8 free Freeform (See also the start and end parameters above)

NuSOAP Example

This example continues from the main article NuSOAP Example):

$params = Array(
	'view' => 'year',
	'params' => Array(
		'period' => '8',
		'start' => '2012-01-01',
		'end' => '2012-12-30',
	),
);

$result = $client->call('get_profit_loss_report', $params, 'natsapiadmin_wsdl');

print_r($result);

Profit Loss Report Data Output

The returning array will have 2 indexes. The first element in the array will be the 'total' index. This will contain the totals of everything returned. The next index will be 'rows'. It will contain a row for every piece of data returned broken down by the view passed into the API function.

Array
(
    [total] => Array
        (
            [breakdown] => year
            [row] => Array
                (
                    [wm_joins] => 5
                    [initial] => 211
                    [initial_amount] => 1406040
                    [initial_affiliate_payout] => 515454
                    [trial] => 12
                    [trial_amount] => 7440
                    [trial_affiliate_payout] => 3642
                    [other_join] => 2
                    [other_join_amount] => 9000
                    [other_join_affiliate_payout] => 1500
                    [wm_join] => 5
                    [wm_join_affiliate_payout] => 0
                    [rebill] => 21
                    [rebill_amount] => 187980
                    [rebill_affiliate_payout] => 59469
                    [conversion] => 1
                    [conversion_amount] => 3095
                    [conversion_affiliate_payout] => 1547
                    [other_recurring] => 0
                    [other_recurring_amount] => 0
                    [other_recurring_affiliate_payout] => 0
                    [void] => 21
                    [void_amount] => -195873
                    [void_affiliate_payout] => -54990
                    [credit] => 0
                    [credit_amount] => 0
                    [credit_affiliate_payout] => 0
                    [chargeback] => 1
                    [chargeback_amount] => -3000
                    [chargeback_affiliate_payout] => 0
                    [insufficient_funds] => 0
                    [insufficient_funds_amount] => 0
                    [insufficient_funds_affiliate_payout] => 0
                    [other_refund] => 0
                    [other_refund_amount] => 0
                    [other_refund_affiliate_payout] => 0
                    [void_reversal] => 3
                    [void_reversal_amount] => -26340
                    [void_reversal_affiliate_payout] => -9240
                    [credit_reversal] => 0
                    [credit_reversal_amount] => 0
                    [credit_reversal_affiliate_payout] => 0
                    [chargeback_reversal] => 0
                    [chargeback_reversal_amount] => 0
                    [chargeback_reversal_affiliate_payout] => 0
                    [other_reversal] => 0
                    [other_reversal_amount] => 0
                    [other_reversal_affiliate_payout] => 0
                    [seconds_amount] => 0
                    [seconds_affiliate_payout] => 0
                    [wm_join_referral_payout] => 0
                    [affiliate_payout] => 517382
                    [referral_payout] => 6923
                    [account_rep_payout] => 796355
                    [partner_payout] => 0
                    [byoa_payout] => 0
                    [promotional_payout] => 0
                    [charges] => 250
                    [no_cost_registration] => 0
                    [no_cost_registration_amount] => 0
                    [no_cost_registration_affiliate_payout] => 0
                    [ccbill_chargeback] => 0
                    [ccbill_chargeback_amount] => 0
                    [ccbill_chargeback_reversal] => 0
                    [ccbill_chargeback_reversal_amount] => 0
                    [ccbill_conversion] => 0
                    [ccbill_conversion_amount] => 0
                    [ccbill_credit] => 0
                    [ccbill_credit_amount] => 0
                    [ccbill_credit_reversal] => 0
                    [ccbill_credit_reversal_amount] => 0
                    [ccbill_initial] => 0
                    [ccbill_initial_amount] => 0
                    [ccbill_insufficient_funds] => 0
                    [ccbill_insufficient_funds_amount] => 0
                    [ccbill_rebill] => 0
                    [ccbill_rebill_amount] => 0
                    [ccbill_trial] => 0
                    [ccbill_trial_amount] => 0
                    [ccbill_void] => 0
                    [ccbill_void_amount] => 0
                    [ccbill_void_reversal] => 0
                    [ccbill_void_reversal_amount] => 0
                    [impression_trans_affiliate_payout] => 0
                    [qualified_trans_affiliate_payout] => 0
                    [visitor_trans_affiliate_payout] => 0
                    [break] => 2147483647
                    [datebreak] => 2147483647
                    [cachebreak] => 2147483647
                    [ccbill_joins] => 0
                    [ccbill_join_profit] => 0
                    [ccbill_recurring] => 0
                    [ccbill_recurring_profit] => 0
                    [ccbill_reversals] => 0
                    [ccbill_reversal_profit] => 0
                    [ccbill_refunds] => 0
                    [ccbill_refund_loss] => 0
                    [free] => 0
                    [joins] => 225
                    [total_joins] => 225
                    [join_profit] => 1422480
                    [join_affiliate_payout] => 520596
                    [recurring] => 22
                    [total_recurring] => 22
                    [recurring_profit] => 191075
                    [recurring_affiliate_payout] => 61016
                    [payout] => 1320660
                    [reversals] => 3
                    [total_reversals] => 3
                    [reversal_profit] => -26340
                    [reversal_affiliate_payout] => -9240
                    [refunds] => 22
                    [total_refunds] => 22
                    [refund_loss] => -198873
                    [refund_affiliate_payout] => -54990
                    [rebill_biller_charges] => 0
                    [rebill_referral_payout] => 0
                    [rebill_account_rep_payout] => 20204
                    [rebill_partner_payout] => 0
                    [rebill_byoa_payout] => 0
                    [rebill_promotional_payout] => 0
                    [recurring_biller_charges] => 0
                    [recurring_referral_payout] => 0
                    [recurring_account_rep_payout] => 20204
                    [recurring_partner_payout] => 0
                    [recurring_byoa_payout] => 0
                    [recurring_promotional_payout] => 0
                    [impression] => 20026
                    [visitor] => 18014
                    [qualified] => 0
                    [join_hits] => 11636
                    [join_submits] => 5391
                )

        )

    [rows] => Array
        (
            [0] => Array
                (
                    [break] => 1325394000
                    [stats] => Array
                        (
                            [wm_joins] => 5
                            [initial] => 211
                            [initial_amount] => 1406040
                            [initial_affiliate_payout] => 515454
                            [trial] => 12
                            [trial_amount] => 7440
                            [trial_affiliate_payout] => 3642
                            [other_join] => 2
                            [other_join_amount] => 9000
                            [other_join_affiliate_payout] => 1500
                            [wm_join] => 5
                            [wm_join_affiliate_payout] => 0
                            [rebill] => 21
                            [rebill_amount] => 187980
                            [rebill_affiliate_payout] => 59469
                            [conversion] => 1
                            [conversion_amount] => 3095
                            [conversion_affiliate_payout] => 1547
                            [other_recurring] => 0
                            [other_recurring_amount] => 0
                            [other_recurring_affiliate_payout] => 0
                            [void] => 21
                            [void_amount] => -195873
                            [void_affiliate_payout] => -54990
                            [credit] => 0
                            [credit_amount] => 0
                            [credit_affiliate_payout] => 0
                            [chargeback] => 1
                            [chargeback_amount] => -3000
                            [chargeback_affiliate_payout] => 0
                            [insufficient_funds] => 0
                            [insufficient_funds_amount] => 0
                            [insufficient_funds_affiliate_payout] => 0
                            [other_refund] => 0
                            [other_refund_amount] => 0
                            [other_refund_affiliate_payout] => 0
                            [void_reversal] => 3
                            [void_reversal_amount] => -26340
                            [void_reversal_affiliate_payout] => -9240
                            [credit_reversal] => 0
                            [credit_reversal_amount] => 0
                            [credit_reversal_affiliate_payout] => 0
                            [chargeback_reversal] => 0
                            [chargeback_reversal_amount] => 0
                            [chargeback_reversal_affiliate_payout] => 0
                            [other_reversal] => 0
                            [other_reversal_amount] => 0
                            [other_reversal_affiliate_payout] => 0
                            [seconds_amount] => 0
                            [seconds_affiliate_payout] => 0
                            [wm_join_referral_payout] => 0
                            [affiliate_payout] => 517382
                            [referral_payout] => 6923
                            [account_rep_payout] => 796355
                            [partner_payout] => 0
                            [byoa_payout] => 0
                            [promotional_payout] => 0
                            [charges] => 250
                            [no_cost_registration] => 0
                            [no_cost_registration_affiliate_payout] => 0
                            [no_cost_registration_amount] => 0
                            [ccbill_chargeback] => 0
                            [ccbill_chargeback_amount] => 0
                            [ccbill_chargeback_reversal] => 0
                            [ccbill_chargeback_reversal_amount] => 0
                            [ccbill_conversion] => 0
                            [ccbill_conversion_amount] => 0
                            [ccbill_credit] => 0
                            [ccbill_credit_amount] => 0
                            [ccbill_credit_reversal] => 0
                            [ccbill_credit_reversal_amount] => 0
                            [ccbill_initial] => 0
                            [ccbill_initial_amount] => 0
                            [ccbill_insufficient_funds] => 0
                            [ccbill_insufficient_funds_amount] => 0
                            [ccbill_rebill] => 0
                            [ccbill_rebill_amount] => 0
                            [ccbill_trial] => 0
                            [ccbill_trial_amount] => 0
                            [ccbill_void] => 0
                            [ccbill_void_amount] => 0
                            [ccbill_void_reversal] => 0
                            [ccbill_void_reversal_amount] => 0
                            [impression_trans_affiliate_payout] => 0
                            [qualified_trans_affiliate_payout] => 0
                            [visitor_trans_affiliate_payout] => 0
                            [break] => 113983884000
                            [datebreak] => 115530566400
                            [cachebreak] => 115530566400
                            [ccbill_joins] => 0
                            [ccbill_join_profit] => 0
                            [ccbill_recurring] => 0
                            [ccbill_recurring_profit] => 0
                            [ccbill_reversals] => 0
                            [ccbill_reversal_profit] => 0
                            [ccbill_refunds] => 0
                            [ccbill_refund_loss] => 0
                            [free] => 0
                            [joins] => 225
                            [total_joins] => 225
                            [join_profit] => 1422480
                            [join_affiliate_payout] => 520596
                            [recurring] => 22
                            [total_recurring] => 22
                            [recurring_profit] => 191075
                            [recurring_affiliate_payout] => 61016
                            [payout] => 1320660
                            [reversals] => 3
                            [total_reversals] => 3
                            [reversal_profit] => -26340
                            [reversal_affiliate_payout] => -9240
                            [refunds] => 22
                            [total_refunds] => 22
                            [refund_loss] => -198873
                            [refund_affiliate_payout] => -54990
                            [rebill_biller_charges] => 0
                            [rebill_referral_payout] => 0
                            [rebill_account_rep_payout] => 20204
                            [rebill_partner_payout] => 0
                            [rebill_byoa_payout] => 0
                            [rebill_promotional_payout] => 0
                            [recurring_biller_charges] => 0
                            [recurring_referral_payout] => 0
                            [recurring_account_rep_payout] => 20204
                            [recurring_partner_payout] => 0
                            [recurring_byoa_payout] => 0
                            [recurring_promotional_payout] => 0
                            [trial_biller_charges] => 0
                            [trial_referral_payout] => 0
                            [trial_account_rep_payout] => 25361
                            [trial_partner_payout] => 0
                            [trial_byoa_payout] => 0
                            [trial_promotional_payout] => 0
                            [main_joins] => 12
                            [main_without_ccbill_joins] => 12
                            [join_biller_charges] => 0
                            [join_referral_payout] => 0
                            [join_account_rep_payout] => 25361
                            [join_partner_payout] => 0
                            [join_byoa_payout] => 0
                            [join_promotional_payout] => 0
                            [initial_biller_charges] => 0
                            [initial_referral_payout] => 0
                            [initial_account_rep_payout] => 0
                            [initial_partner_payout] => 0
                            [initial_byoa_payout] => 0
                            [initial_promotional_payout] => 0
                            [impression] => 20026
                            [visitor] => 18014
                            [qualified] => 0
                            [join_hits] => 11636
                            [join_submits] => 5391
                            [correction_payout] => 0
                            [other_affiliate_payout] => 0
                            [name] => 1325394000
                        )
                )
        )
)