Hi, I'm using BudgetOrderService to increase the budget amount in a bunch of BudgetOrders, periodically. This is working fine for the most part. Every once in awhile, though, I run into this error: INVALID_BUDGET_ALREADY_SPENT
>From what I read, this is caused when you try to set the spendingLimit of a BudgetOrder to a value lower than what is already spent. For example, If I have a $300 budget, and have spent $250, trying to set the budget to anything lower than $250 will result in an error. I did this a lot to early on, but have since fixed up my code to avoid this case. My problem seems to crop up whenever a large credit is involved. Let's say I have a $300 BudgetOrder, with $100 of credit, and the whole thing has been spent. This means spendingLimit = $400 = budget ($300) + totalAdjustments ($100), and amount spent is $400 Now what if I want to increase the spendingLimit by $50? In the api the only way to do this is through the BudgetOrderService -> mutate -> SET -> spendingLimit and, from the docs <https://developers.google.com/adwords/api/docs/reference/v201609/BudgetOrderService.BudgetOrder#spendinglimit> : > Note, that for *get* requests the spending limit includes any adjustments > that have been applied to the budget order. For *mutate*, the spending > limit represents the maximum allowed spend *prior to considering any > adjustments*. So, the current budget amount before adjustments is $300 ( I can get that number by taking spendingLimit and subtracting totalAdjustments ). If I want to increase it by $50, I have to *SET* spendingLimit to $350. After adjustments, the spendingLimit should come back in the *GET* request as $450 ( $350 budget + $100 adjustment ). But it doesn't. It fails with INVALID_BUDGET_ALREADY_SPENT. *Herein lies the problem (as far as I can tell):* Using a mutate -> SET request, *spendingLimit is only the budget amount,* and *does not include any adjustments*. I guessing at some point in the *SET*, the API checks to see if *spendingLimit (only budget amount, no adjustments) < amount spent*, which, in this case, is $350 < $400, causing the INVALID_BUDGET_ALREADY_SPENT error. I would think the correct way to check for INVALID_BUDGET_ALREADY_SPENT would be *spendingLimit* (*just budget amount) + totalAdjustments < amount spent, *or $350 + $100 < $400 = no error Interestingly, for this same case, I can go to the mcc, and set the budget amount to $350, and it correctly set the budget amount without bringing up an error. Am I looking at this wrong, or is it the intended behavior? Thanks, -Evan -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/a7f2891f-8de4-4f78-8071-117adf09d5ec%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
