correct account remaining credit

205 views
Skip to first unread message

Inna Keegan

unread,
Aug 20, 2020, 7:53:31 AM8/20/20
to AdWords API and Google Ads API Forum

Hello!

We are creating a service for customers through which they could combine and analyze the statistics and remaining credits of several Google Ads accounts in one place. 

At this point, we need to get the correct amount of the account balance via API.

As we know, it’s not possible to get it directly.

According to API documentation and Google Ads API Team, we have to calculate it from such parameters as spendingLimit and totalAdjustments from BudgetOrder(using BudgetOrderService), and the Cost from Account Performance Report. 

 Unfortunately, we can’t get the same amount as we see in Google Ads account in Billing Summary tab as “Your remaining credit”.

For example, if we get data from 151-032-3320 Google Ads account, we see

spendingLimit = 5872722560000
totalAdjustments = 8308800000
start date of budget order = 20160202 121240 Europe/Moscow
end date of budget order = 20371231 105959 Europe/Moscow
Cost (Feb 2, 2016-Dec 31, 2037) = 5781697901970

Calculated remaining balance = Account budget - Cost = (spendingLimit - totalAdjustments) - Cost  =  827 158,58 RUB 

"Your remaining credit" (Google Ads account) = 124 242.02 RUB

As you see, the difference is huge. Probably, the problem is that not all adjustments are summed up in totalAdjustments.

So we ask you to help us to find a way how to get the correct account balance for customers via API.

Google Ads API Forum Advisor Prod

unread,
Aug 20, 2020, 2:16:40 PM8/20/20
to in...@keegan.ru, adwor...@googlegroups.com
Hi Inna,

Thank you for reaching out to us. I see that you're encountering an issue trying to obtain the correct remaining credit in your account. I'll take a closer look at this internally with my team and get back to you as soon as possible.

Thank you,
Bryan, Google Ads API Team

ref:_00D1U1174p._5004Q23tJDV:ref

Inna Keegan

unread,
Aug 25, 2020, 2:24:42 PM8/25/20
to AdWords API and Google Ads API Forum
Hello, Bryan

Is there any news for us?
четверг, 20 августа 2020 г. в 21:16:40 UTC+3, adsapiforumadvisor:

Google Ads API Forum Advisor Prod

unread,
Aug 27, 2020, 4:10:58 PM8/27/20
to in...@keegan.ru, adwor...@googlegroups.com
Hi Inna,

Thank you for your patience. Could you provide us with which report you used to pull these values? Are you using AdWords or Google Ads API? Could you provide us the request and response logs that show that these are the values you pull?

Thank you,

Google Logo
Bryan Li
Google Ads API Team
 


ref:_00D1U1174p._5004Q23tJDV:ref

Google Ads API Forum Advisor Prod

unread,
Aug 27, 2020, 4:11:29 PM8/27/20
to in...@keegan.ru, adwor...@googlegroups.com

Hi Inna,

For the logs, please reply using "reply privately to author" to send them to us.

Thank you,

Inna Keegan

unread,
Aug 28, 2020, 3:15:18 AM8/28/20
to AdWords API and Google Ads API Forum
Well, the button "reply privately to the author" is unavailable.

That's the documentation I use:
https://developers.google.com/adwords/api/docs/reference/v201809/BudgetOrderService
https://developers.google.com/adwords/api/docs/appendix/reports/account-performance-report#cost

To get the Budget Order I use POST request:
https://adwords.google.com/api/adwords/billing/v201809/BudgetOrderService?wsdl

<?xml version="1.0"?>
  <soapenv:Header>
    <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/billing/v201809" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
      <ns1:clientCustomerId>151-032-3320</ns1:clientCustomerId>
      <ns1:developerToken>XXXX</ns1:developerToken>
      <ns1:userAgent>Calltouch Manual AdWords Collector v1.0</ns1:userAgent>
      <ns1:validateOnly>false</ns1:validateOnly>
      <ns1:partialFailure>false</ns1:partialFailure>
    </ns1:RequestHeader>
  </soapenv:Header>
  <soapenv:Body>
      <serviceSelector>
      <fields  xmlns="https://adwords.google.com/api/adwords/cm/v201809">BillingAccountId,BillingAccountName,BudgetOrderName</fields>
            </dateRange>
</serviceSelector>
    </get> 
</soapenv:Body>
</soapenv:Envelope>

To get the Cost I use POST request:
https://adwords.google.com/api/adwords/reportdownload/v201809

with keys:
__rdquery = SELECT Cost FROM ACCOUNT_PERFORMANCE_REPORT DURING 20160202, 20371231
__fmt = CSV


And the logs are for today:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<requestId>0005adeabb0fff140528e1f98f05c995</requestId>
<serviceName>BudgetOrderService</serviceName>
<methodName>get</methodName>
<operations>1</operations>
<responseTime>259</responseTime>
</ns2:ResponseHeader>
</soap:Header>
<soap:Body>
<ns2:rval>
<totalNumEntries>1</totalNumEntries>
<Page.Type>BudgetOrderPage</Page.Type>
<ns2:entries>
<ns2:billingAccountId>4894-2780-2346-8860</ns2:billingAccountId>
<ns2:id>248035244</ns2:id>
<ns2:billingAccountName>Calltouch</ns2:billingAccountName>
<ns2:primaryBillingId>1529-4487-2379</ns2:primaryBillingId>
<ns2:spendingLimit>
<ComparableValue.Type>Money</ComparableValue.Type>
<microAmount>5872722560000</microAmount>
</ns2:spendingLimit>
<ns2:totalAdjustments>
<ComparableValue.Type>Money</ComparableValue.Type>
<microAmount>8308800000</microAmount>
</ns2:totalAdjustments>
<ns2:startDateTime>20160202 121240 Europe/Moscow</ns2:startDateTime>
<ns2:endDateTime>20371231 105959 Europe/Moscow</ns2:endDateTime>
<ns2:lastRequest>
<ns2:status>APPROVED</ns2:status>
<ns2:billingAccountName>Calltouch</ns2:billingAccountName>
</ns2:lastRequest>
</ns2:entries>
</ns2:rval>
</ns2:getResponse>
</soap:Body>
</soap:Envelope>


"ACCOUNT_PERFORMANCE_REPORT (Feb 2, 2016-Dec 31, 2037)"
Cost
5815358461970
Total

And that's what I see in the interface now:
Screenshot 2020-08-28 at 10.14.47.png
четверг, 27 августа 2020 г. в 23:11:29 UTC+3, adsapiforumadvisor:

Inna Keegan

unread,
Aug 28, 2020, 8:03:39 AM8/28/20
to AdWords API and Google Ads API Forum
Hi Bryan,

also, I think, maybe in the interface, I see the sum with VAT. 
And via API I get the sum without VAT. Right? 

IF so, then I should get via API the sum = 81692.32/1.20 (our VAT is 20%) = 68076.93 RUB

And with my log, you can see the sum = 5872722560000 - 8308800000 - 5815358461970 = 49055298030, which is equal to 49055,30 RUB

Still, it's a huge difference between those two numbers.

I use the formula, which was given to me here: 
https://developers.google.com/adwords/api/docs/guides/budget-order
and here:
https://groups.google.com/g/adwords-api/c/kQyyzdJ9_Qs

Screenshot 2020-08-28 at 15.02.40.png

пятница, 28 августа 2020 г. в 10:15:18 UTC+3, Inna Keegan:

Inna Keegan

unread,
Aug 31, 2020, 2:08:29 PM8/31/20
to AdWords API and Google Ads API Forum
Guys, please

пятница, 28 августа 2020 г. в 15:03:39 UTC+3, Inna Keegan:

Google Ads API Forum Advisor Prod

unread,
Aug 31, 2020, 10:27:05 PM8/31/20
to in...@keegan.ru, adwor...@googlegroups.com
Hi Inna,

Apologies for the delay - I'm a Developer Programs Engineer on the Google Ads API jumping in here to help with your problem.

I was wondering if you could give me a bit more background on where you got the equation: spendingLimit - totalAdjustments - Cost = remaining balance

Based on the documentation spendingLimit should already include totalAdjustments when retrieved via a BudgetOrderService.get. You should only need to subtract totalAdjustments when trying to determine the amount that was originally set before adjustments were applied.

With that said, adjusting your equation below still doesn't yield the same values, thought they appear closer. I think it's possible that there may always be slight differences between the values retrieved in the API and what's visible via the UI. I'm going to try to get some better information on that and will follow up, meanwhile let me know if updating your equation to remove totalAdjustments is helpful.

Thanks,
Ben Karl, Google Ads API Team

ref:_00D1U1174p._5004Q23tJDV:ref

Inna Keegan

unread,
Sep 1, 2020, 9:02:14 AM9/1/20
to AdWords API and Google Ads API Forum
Hello, Ben

Thanks for jumping to me.

Well, I got this formula from two ones. The first was given here in the forum:
"You will have to compute the remaining balance by subtracting the total Cost of the Account Performance Report from your known budget."
https://groups.google.com/g/adwords-api/c/M3nwAv5jlfc/m/4_02Wi0MAgAJ

And the known budget was given here as:
"The account budget will be equal to spendingLimit - totalAdjustments."
https://groups.google.com/g/adwords-api/c/kQyyzdJ9_Qs/m/zwqOLh4XAgAJ

Okay then, if the formula looks like "spendingLimit - Cost", I was wrong. But let's see how the right one works:

For 20 August 2020 (my first message in this thread):
Balance via API = (5872722560000 - 5781697901970)/1000000 = 91 024.66 RUB
"Your remaining credit" (Google Ads account) = 124 242.02 RUB with VAT and 103 535.02 RUB without VAT
Difference = 12 510.36 RUB

For 28 August 2020 (when I gave another data):
Balance via API = (5872722560000 -  5815358461970)/1000000 = 57 364.10 RUB
"Your remaining credit" (Google Ads account) = 81 692.32 with VAT and 68076.93 RUB without VAT
Difference =  10 712.83 RUB

With all the respect, Ben, I think, that 12-16% is not "a slight difference".

Thanks for clarifying though.
вторник, 1 сентября 2020 г. в 05:27:05 UTC+3, adsapiforumadvisor:

Inna Keegan

unread,
Sep 10, 2020, 5:47:03 PM9/10/20
to AdWords API and Google Ads API Forum
Hello, Ben and Bryan! 

Is it possible from your side to correct BudgetOrderService somehow, so we could get the correct balance via API? 

I know you have plans to create a new parameter with balance, I saw it several times here in the forum. Maybe it would be easier to adjust the current structure to something more accurate?

I don't really want to give up with this task, cause 12-16% is not a slight difference.
I don't know how to explain it to our clients. Like ... the company with the world's best search engine cannot give the correct data via API? I mean.. You are the synonym of high quality and best technologies, aren't you?
вторник, 1 сентября 2020 г. в 16:02:14 UTC+3, Inna Keegan:

Google Ads API Forum Advisor Prod

unread,
Sep 11, 2020, 4:23:15 PM9/11/20
to in...@keegan.ru, adwor...@googlegroups.com
Hi Inna,

I'm going to file a feature request on your behalf to see if this can be implemented in the new Google Ads API at some point.

Currently retrieving the remaining balance for an account just isn't supported, which is why it's so tricky to do, and why there's differences with the UI. For reference the UI and API can have discrepancies in some cases because they don't follow the exact same data retrieval paths all the time. Also data parity is not always a matter of quality - sometimes the discrepancies are due to the different use cases supported for API users versus users of the UI.

 Going forward, be sure to keep an eye on the Google Ads Developer Blog, which is where we'll announce any changes for this use case.

Thanks again for reaching out and sharing your feedback,
Ben, Google Ads API Team

ref:_00D1U1174p._5004Q23tJDV:ref

Inna Keegan

unread,
Sep 11, 2020, 5:31:02 PM9/11/20
to AdWords API and Google Ads API Forum
Many thanks

пятница, 11 сентября 2020 г. в 23:23:15 UTC+3, adsapiforumadvisor:
Reply all
Reply to author
Forward
0 new messages