Problem with AddBillingSetup.php example

113 views
Skip to first unread message

Алексей Рябиков

unread,
Jan 18, 2023, 12:51:32 AM1/18/23
to Google Ads API and AdWords API Forum
Hello! 
I have a problem with an example from Google Ads PHP library.

When I'm trying to run example via console I have an error like:
"
Fault
-------
Status code: 3
Details: Request contains an invalid argument.
Failure: {"errors":[{"errorCode":{"requestError":"UNKNOWN"},"message":"The error code is not in this version.","location":{"fieldPathElements":[{"fieldName":"operation"},{"fieldName":"create"},{"fieldName":"start_time"}]}}],"requestId":"yZbhEFXVZpZkKw6fCu2Rig"}
Request with ID 'yZbhEFXVZpZkKw6fCu2Rig' has failed.
Google Ads failure details:
        request_error: The error code is not in this version.
"

And I found that this is the problem with $start_time variable: In the example we have $startDate = time(); on line 252, and if we run as is (current time, current date) - it's return error. 

But if we manipulate this variable until we get tomorrow date (like $startDate = time() + 86400; on line 252 OR $billingSetup->setStartDateTime(date('Y-m-d', strtotime('+1 day', $startDate))); instead $billingSetup->setStartDateTime(date('Y-m-d', $startDate)); on 254) - it OK, its works. 

And therefore this problem generates another: AddAccountBudgetProposal works with tomorrow's day only, because of your billing setup. And if we use tomorrow's date to make AddAccountBudgetProposal example works - we will see the blank screen in your google ads account in the billing section (for today, tomorrow it will be OK, you'll your billing setup and budget).


So, my question is: What could be wrong with AddBillingSetup.php? Why only tomorrow's date? 

P.S. I've tried to add +1 hour, +1 minute, +1 second, etc. But it works only in case, when you add enough seconds to get  tomorrow's date.

P.P.S. Other examples work perfectly for me. Including AddAccountBudgetProposal  if you add  Billing Setup manually via your cabinet.

Thnx!

Google Ads API Forum Advisor

unread,
Jan 18, 2023, 9:50:03 AM1/18/23
to house...@gmail.com, adwor...@googlegroups.com

Hi,
 

Thanks for reaching out to the Google Ads API team. I hope you are doing well today.


With regards to your concern, the budget start time is the same day that you made the budget proposal. Does this error occur when you give a future date as a start time? According to our documentation (look lower down by startDateTime), only a future time is allowed.
 

If you follow that and you are still getting an error, then you may send us the complete request and response logs with the request-id when you encounter the error, so our team can better check? If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. PHP) > Logging documentation, which you can access from this link.


You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.


Regards,

Google Logo
Darwin
Google Ads API Team
 

 




ref:_00D1U1174p._5004Q2hzeYR:ref

Алексей Рябиков

unread,
Jan 18, 2023, 12:32:05 PM1/18/23
to Google Ads API and AdWords API Forum
Hi! 
Thanks for your response 
Yes, but it's not about " the budget start time is the same day that you made the budget proposal", but about billing setup: It's works only if I change date in example script (sic!):
Comment on line 251 says clearly: "... the only acceptable start date time is today."
But, unfortunately, it doesn't work :)

In attach you can see error in console, when I'm trying to run example php /home/bitrix/www/google-ads-php/examples/Billing/AddBillingSetup.php --customerId ***** --paymentsAccountId '****'
(customerId and paymentsAccountId - correct, because they work in case with tomorrow's date).

And text of response (except warnings of php 8.1 version):
[2023-01-18T17:22:58.128672+00:00] google-ads.INFO: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v12.services.GoogleAdsService/SearchStream", CustomerId: 9427904266, RequestId: "UwCv_xC-Nal98SaZ0InHJw", IsFault: 0, FaultMessage: "None"
[2023-01-18T17:22:58.842060+00:00] google-ads.WARNING: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v12.services.BillingSetupService/MutateBillingSetup", CustomerId: 9427904266, RequestId: "NhMQ-9qCyuS4pWKwyH-AhQ", IsFault: 1, FaultMessage: "["The error code is not in this version."]"
[2023-01-18T17:22:58.844041+00:00] google-ads.NOTICE: Request
-------
Method Name: /google.ads.googleads.v12.services.BillingSetupService/MutateBillingSetup
Host: googleads.googleapis.com
Headers: {
    "x-goog-api-client": "gl-php\/8.1.13 gccl\/17.1.0 gapic\/17.1.0 gax\/1.17.0 grpc\/1.51.1 rest\/1.17.0 pb\/3.21.12+c",
    "x-goog-request-params": "customer_id=9427904266",
    "developer-token": "REDACTED",
    "login-customer-id": "5074588743"
}
Request:
{"customerId":"9427904266","operation":{"create":{"paymentsAccount":"customers/9427904266/paymentsAccounts/5448-8273-0617-4024","startDateTime":"2023-01-18","endDateTime":"2023-01-19"}}}

Response
-------
Headers: {
    "request-id": "NhMQ-9qCyuS4pWKwyH-AhQ",
    "date": "Wed, 18 Jan 2023 17:22:58 GMT",
    "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""

}

Fault
-------
Status code: 3
Details: Request contains an invalid argument.
Failure: {"errors":[{"errorCode":{"requestError":"UNKNOWN"},"message":"The error code is not in this version.","location":{"fieldPathElements":[{"fieldName":"operation"},{"fieldName":"create"},{"fieldName":"start_time"}]}}],"requestId":"NhMQ-9qCyuS4pWKwyH-AhQ"}
Request with ID 'NhMQ-9qCyuS4pWKwyH-AhQ' has failed.

Google Ads failure details:
        request_error: The error code is not in this version.


P.S. It's just an example from the library, not my own code. It's really strange :(


среда, 18 января 2023 г. в 17:50:03 UTC+3, adsapi:
CowALF9l.png
KB3CeFX6.png

Google Ads API Forum Advisor

unread,
Jan 19, 2023, 4:30:10 AM1/19/23
to house...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us. I hope that you are doing well today.

Please allow me to raise this concern to the rest of our team. Rest assured that we will get back to you once we have an update.

Kind regards,
Google Logo
Sherwin Vincent
Google Ads API Team
 


ref:_00D1U1174p._5004Q2hzeYR:ref

Алексей Рябиков

unread,
Jan 19, 2023, 7:34:07 AM1/19/23
to Google Ads API and AdWords API Forum
Thank you! 
I'll be waiting :)

четверг, 19 января 2023 г. в 12:30:10 UTC+3, adsapi:

Google Ads API Forum Advisor

unread,
Jan 20, 2023, 3:03:42 PM1/20/23
to house...@gmail.com, adwor...@googlegroups.com
Hello - 

Thanks for bringing this issue up! I'm a developer relations engineer jumping in to help out here. The internal error I see for your request ID is CUSTOMER_BILLING_ERROR_CANNOT_CREATE_IN_PAST, which is kind of confusing since you are setting the start date the same as the date of the request. 

This actually does not appear to be specific to the PHP library, we use the same pattern in Python and other languages, and I've seen other users encounter this problem.

Currently the issue has been escalated to the Billing team, who is exposing that internal error and also helping resolve the discrepancy between our example and the API's behavior.

Once I have more details I'll follow up to let you know.

Thanks!
Google Logo
Ben Karl
Google Ads API Team
 


ref:_00D1U1174p._5004Q2hzeYR:ref

Алексей Рябиков

unread,
Jan 22, 2023, 7:19:11 AM1/22/23
to Google Ads API and AdWords API Forum
Hi! 
Wow, thank you! 
I'll be waiting :)

пятница, 20 января 2023 г. в 23:03:42 UTC+3, adsapi:
Reply all
Reply to author
Forward
0 new messages