Search code examples
adsense-api

Figure out last completed payment via Accounts.payments: list in AdSense Management API v1.4


I am successfully using Google's AdSense API to retrieve payments. The AdSense account I am testing the app with does not have any completed payments.

I am using Accounts.payments:list to retrieve the payments and currently I am only getting one row with Id = "unpaid". This entry specifies the amount that is available for payment.

My question here is what are the other possible entries in the result? Specifically how can I find last completed payment?

Thank you for your help.


Solution

  • items[] description: "The list of Payments for the account. One or both of a) the account's most recent payment; and b) the account's upcoming payment".

    As far I can see id can be "unpaid", or date of the last payment (probably the "payment issued" date):

    {
     "kind": "adsense#payments",
     "items": [
      {
       "kind": "adsense#payment",
       "id": "unpaid",
       "paymentAmount": "***.**",
       "paymentAmountCurrencyCode": "***"
      },
      {
       "kind": "adsense#payment",
       "id": "****-**-**",
       "paymentDate": "****-**-**",
       "paymentAmount": "***.**",
       "paymentAmountCurrencyCode": "***"
      }
     ]
    }
    

    how can I find last completed payment?

    In my understanding, that is exactly what Accounts.payments:list is (or will be) returning:

    • your account current balance
    • last payment (if there was any)