AdSense Management API (PHP) Get Payments - adsense-api

I'm trying to get the 'Balance' value from the API. Basically, I want to retrieve the amount that has not yet been paid.
So far, I have the sample API PHP working, but I can't figure out how to get the value above, or the "This Month" value that appears in the AdSense console.
Any advice?
Thanks

Figured out how to get amount owing:
$result = $service->accounts_payments->listAccountsPayments($accountID);
foreach ($result as $payment) {
printf("Amount to be paid: %s\$%s\n", $payment['paymentAmountCurrencyCode'], $payment['paymentAmount']);
}

Related

Walmart MWS API not returning nextCursor

After checking the Walmart Markeptlace API to retrieve all the items in the catalog, you can see that it will return:
errors (array of objects)
itemResponse (array of objects)
additionalAttributes (object)
totalItems (integer)
nextCursor (string)
In my case I have over 2000 items in the catalog, but by default it will just return 20 items with a nextCursor so I can retrieve the next items. Unfortunately, i'm not getting my nextCursor in the response. I tried contacting walmart and been waiting for a reply over 2 weeks, but never got a single reply.
This is what my response looks like:
Is there anybody running into the same issue as me? I really don't know what to do in order to retrieve the nextCursor.
Walmart's documentation is unclear, and contradictory. They could use some good examples. I was having the same problems as you were.
What worked for me was explicitly passing nextCursor=* for the first page.
I know the documentation says that's the default, but that doesn't seem to be the case.
The response will have the nextCursor value for the next page.

How to get Amazon's discounted price?

I'm using ItemSearch Amazon API. It works fine for most cases; however, when Amazon has a discount, it doesn't show the discounted price they show on Amazon, it returns the old original price.
For example for this item, Amazon's discounted price is $37.50. However, the API just returns the original price: $44.99.
The Offers section doesn't help either (it has other sellers' offers, not Amazon's).
Any thoughts anyone?
Here is the API call for your convenience (fill up the {} fields):
http://webservices.amazon.com/onca/xml?AWSAccessKeyId={}&AssociateTag={}&Condition=New&Keywords=887961219319&Operation=ItemSearch&ResponseGroup=Images%2CItemAttributes%2CLarge%2COffers%2CReviews&SearchIndex=All&Service=AWSECommerceService&Timestamp={}&Signature={}
After almost about a week of digging and investigation, it turns out I had to remove the "condition" field from the request! After that, I was able to get the the price displayed on Amazon.com properly! (using the filed Item.Offers.Offer.OfferListing.Price.Amount).
Reason: it seems Amazon displays what they call as "Buy Box Winner" price if it exists, or the lowest possible offer. To get this value returned in the response, you'd have to remove the Condition field in addition to the MerchantId as well. More details here.
Jeez Amazon! I hope someone finds this useful!

paypal get phone number

I'm using Paypal rest-api-sdk-php (this example) http://paypal.github.io/PayPal-PHP-SDK/sample/doc/payments/ExecutePayment.html
This is the payment execution:
https://i.gyazo.com/42e6b22951b7b82e7b6193d18cce6042.png
In their printed response object, I can see phone is already present there https://i.gyazo.com/b4b65b445a5696e42908a1514d3eb33c.png
but when I want to access $result->payer->payer_info->phone it doesn't return anything.
not even when I print_r the payment execution $result
https://i.gyazo.com/971926556ee9d7d46443a73616e36056.png
do you see anything I'm not noticing? can you please point me in the right direction?
there must be something I'm not getting here.
I've spent 1 hour with this.

Instagram API search by tag, blank return

I'm trying to use the search by tag API to return the JSON result, but it returned a blank result.
This is the API request format from their website. I only set the tag-name & access token parameters.
https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token=ACCESS-TOKEN
I already set my access token's scope as public_content so that I can use this particular API.
However, the result I got is:
{
"pagination": {
"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"
},
"meta": {
"code": 200
},
"data": []
}
Which was basically nothing. I read that I should be expecting max & min ids. I had already checked that the hashtag I'm searching has more than 200 entries, so there should be more than one page.
No issues with other insta APIs when searching by userids, just can't get it to work on this and searching by recent media.
Really appreciate any help. Thank you!
By the looks of things, you're getting a deprecation warning because you are passing the next_max_id and min_id parameters in your request.
As mentioned in the result you got, you should use min_tag_id and max_tag_id instead (if you want these parameters in your request). This is mentioned in the Instagram Developer documentation
ACCESS_TOKEN A valid access token.
COUNT Count of tagged media to return.
MIN_TAG_ID Return media before this min_tag_id.
MAX_TAG_ID Return media after this max_tag_id.
Sorry, I'm not sure what you mean by "expecting max & min ids". If you mean you're expecting them in the response, then this is a wrong expectation.
Also, another possible cause for your problem is the recent Instagram Platform update, which has forced all clients created after November 17th, 2015 to be in Sandbox mode and go through a review process. If you are affected by this, note that your results will be "filtered" depending on the Sandbox users you have (in which case, you might not have the number of results you were expecting).

eBay API in Sandbox returns response as a continuous string

Just started using the eBay API.
I created some products and purchased it with another Sandbox account.
In the Sellers account, I can see 2 products under the 'Sold' section.
I am using the GetOrders API call to fetch the orders/sales.
And in the response I am getting a continuous string.
2013-04-20T07:28:55.919ZSuccess819E819_CORE_API_15993720_R111false260765010Completed0.038.00.0NoPaymentFailure2013-04-09T07:15:25.000ZPayPalCompletefalse0.0false0.0StandardShippingFromOutsideUS4.01false510103falseBuyer2013-04-09T07:15:25.000ZPayPalTest UseraddresscityWAUSUnited States1 800 111 1111981026806769eBayStandardShippingFromOutsideUS4.034.038.0xxx.yyy#gmail.com1012013-04-06T11:32:41.000Z110115066261US1000New1None023.0112.51USeBay2.00.0110115066261-0xxx.yyy#gmail.com1022013-04-09T07:13:20.000Z110115066411US1000Brand New1None2705398200111.078.41USeBay2.00.0110115066411-27053982001testuser_xxxyyy252013-04-09T07:15:25.000ZfalsenY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4GhCpKBpwidj6x9nY+seQ==None10011
I don't see any labels associated with the values, like date = 2013-04-09T07:15:25.000Z
And why is it not formatted?
Any help would be appreciated.
Thank you.
as i thought your problem is when you echo the answer, your browser will automatically set header as html and that cause your view. so just add xml header at the top of the file (rember to not echo anything else but one xml otherwise you will get header error).
header ("Content-Type:text/xml");
About your question about filter by time your response i would definitly go for NumberOfDays as i saw you used. Otherwise you can either add ModTimeFrom and ModTimeTo for last x time modified orders or CreateTimeFrom and CreateTimeTo to check new orders entered.

Resources