Issue with Billing Setup via API - PHP

74 views
Skip to first unread message

Ethinos DM

unread,
Oct 16, 2024, 1:53:00 AM10/16/24
to Google Ads API and AdWords API Forum

File Name : AddBillingSetup.php

We are encountering an issue when setting up billing for a customer account using the Google Ads API. Specifically, the following error occurs:

ApiException was thrown with message '{
"

message": "Request contains an invalid argument.",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.ads.googleads.v16.errors.GoogleAdsFailure",
"errors": [
{
"errorCode": {
"billingSetupError": "FUTURE_START_TIME_PROHIBITED"
},
"message": "A start time in the future cannot be used because there is currently no active billing setup for this customer.",
"location": {
"fieldPathElements": [
{
"fieldName": "operation"
},
{
"fieldName": "create"
},
{
"fieldName": "start_time"
}
]
}
}
],
"requestId": "1Z_7PyJ9cNH0rJKVvEdGuQ"
}
]
}'.

he above error occurs only when we attempt to create the billing setup through the API. However, the issue does not occur if we log in to the Google Ads account manually, select the relevant customer ID, and click on the Billing section. After doing this, the API request works correctly.

This behavior forces us to manually log in and click the Billing option every time we create a new account, which is not feasible as we need to create and set up billing for over 500 accounts using the API.

My server timezone is UTC and my account setup timezone is IST is it affect any on API call

Ethinos DM

unread,
Oct 16, 2024, 1:57:15 AM10/16/24
to Google Ads API and AdWords API Forum

Google Ads API Forum Advisor

unread,
Oct 16, 2024, 4:05:51 AM10/16/24
to ethinos....@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to Google Ads API Support.

By reviewing your concern, I can see that you’ve received a BillingSetupError FUTURE_START_TIME_PROHIBITED error which states that a start time in the future cannot be used because there is currently no active billing setup for this customer. Kindly double check your request if you are not setting the future date as compared to when the API call was made. To avoid this error, you would need to avoid setting a start date in future with respect to API call request time. Also, as a side note, you may double check the latest billing setup ID in your request that has a valid start date and end date that doesn’t extend beyond its billing setup. 

In order to investigate your issue further, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated at your end.

Since you are using the PHP client library, if you haven't enabled the logging yet, I would request you to enable it by referring to this guide on PHP.

Reply privately to the author option, or direct private reply to this email.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vGeg9:ref" (ADR-00271871)

Thanks,
 
Google Logo Google Ads API Team


 

Ethinos DM

unread,
Oct 16, 2024, 6:07:14 AM10/16/24
to Google Ads API and AdWords API Forum
Request : Google\Ads\GoogleAds\V16\Services\BillingSetupOperation Object
(
    [create] => Array
        (
            [paymentsAccount] => customers/9801342221/paymentsAccounts/2255-4790-2251-9526
            [startDateTime] => 2024-10-16 00:00:00
        )

)


Response :


ApiException was thrown with message '{
    "message": "Request contains an invalid argument.",
    "code": 3,
    "status": "INVALID_ARGUMENT",
    "details": [
        {
            "@type": "type.googleapis.com\/google.ads.googleads.v16.errors.GoogleAdsFailure",
            "errors": [
                {
                    "errorCode": {
                        "requestError": "UNKNOWN"
                    },
                    "message": "The error code is not in this version.",

                    "location": {
                        "fieldPathElements": [
                            {
                                "fieldName": "operation"
                            },
                            {
                                "fieldName": "create"
                            },
                            {
                                "fieldName": "start_time"
                            }
                        ]
                    }
                }
            ],
            "requestId": "r8GyWLaohvEMqxSAQJPj6g"
        }
    ]
}'.

Ethinos DM

unread,
Oct 16, 2024, 6:23:56 AM10/16/24
to Google Ads API and AdWords API Forum
Hello Team,

Now I am getting UNKNOWN error.  Can you please suggest us what to do ?

Google Ads API Forum Advisor

unread,
Oct 16, 2024, 11:03:59 AM10/16/24
to ethinos....@gmail.com, adwor...@googlegroups.com
Hi,

Upon checking your account, I could see that you don't have any billing setups present in your account. As per this guide, when creating a new billing setup, this is when the setup should take effect. NOW is the only acceptable start time if the customer doesn't have any approved setups. As you don't have a billing setup present in your account, I would suggest you to pass the startTimeType field and set it to 'NOW' instead of passing the startDateTime field as mentioned. I would recommend you to refer to the 'Creating new billing setups' guide and the below example as it clearly described. 

If you are still facing issues even after following the provided suggestion, then I would request you to provide the complete updated logs (request and response logs with request-id and request header) generated at your end to better assist you further. 

You can send the details via Reply privately to the author option, or direct private reply to this email.

Ethinos DM

unread,
Oct 17, 2024, 10:08:37 AM10/17/24
to Google Ads API and AdWords API Forum
Billing setup is already done we have to just link to specific payment account id : 2255-4790-2251-9526. We don't want to create new billing setup.

Google Ads API Forum Advisor

unread,
Oct 17, 2024, 3:34:37 PM10/17/24
to ethinos....@gmail.com, adwor...@googlegroups.com
Hi,

According to the documentation, there is currently no method available to link a payment account ID via the Google Ads API. To accomplish this task, I recommend utilizing the Google Ads UI. For more information, you can refer to this link.
Reply all
Reply to author
Forward
0 new messages