I have consolidated billing set up and am linking brand new accounts to 
those payments_account_id & payments_profile_id

I am using almost exactly the same code that is provided in the examples 
but receive the below error: Also, when running the code I will always get 
the error. However, if I go into the GoogleAds UI and click into Billing > 
Settings and DO NOT setup any billing. After I exist GoogleAds and rerun 
the code it runs perfectly fine. Below are the error and code used.

I am receiving this ERROR:
errors {
  error_code {
    billing_setup_error: 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 {
    field_path_elements {
      field_name: "operation"
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "start_time"
    }
  }
}
request_id: "v8fEru_pUG1egwSLFDOTZA"
, 'v8fEru_pUG1egwSLFDOTZA')

Below are the methods used:
def setup_billing(self):
billing_setup = self._create_billing_setup()
billing_setup_operation = client.get_type("BillingSetupOperation")
client.copy_from(billing_setup_operation.create, billing_setup)
billing_setup_service = client.get_service("BillingSetupService")
response = billing_setup_service.mutate_billing_setup(
customer_id=self.customer_id, operation=billing_setup_operation
)
self.billing_setup_id = billing_setup.id
logger.info(
f"Added new billing setup with resource name 
{response.result.resource_name} for cid:{self.customer_id}")


def _create_billing_setup(self):
"""Creates and returns a new billing setup instance.
The new billing setup will have its payment details populated. One of the
payments_account_id or payments_profile_id must be provided.

Returns:
A newly created BillingSetup instance.
"""
billing_setup = self.client.get_type("BillingSetup")

# Sets the appropriate payments account field.
if self.payments_account_id != None:
# If a payments account ID has been provided, set the payments_account
# field to the full resource name of the given payments account ID.
# You can list available payments accounts via the
# PaymentsAccountService's ListPaymentsAccounts method.
billing_setup.payments_account = client.get_service(
"BillingSetupService"
).payments_account_path(self.customer_id, self.payments_account_id)
elif self.payments_profile_id != None:
# Otherwise, create a new payments account by setting the
# payments_account_info field
# See https://support.google.com/google-ads/answer/7268503
# for more information about payments profiles.
billing_setup.payments_account_info.payments_account_name = (
f"Payments Account #{uuid4()}"
)
billing_setup.payments_account_info.payments_profile_id = (
self.payments_profile_id
)
start_date = datetime.now()
billing_setup.start_date_time = start_date.strftime("%Y-%m-%d %H:%M:%S")
return billing_setup

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/367a690d-b2e9-48f1-9490-a94a75aea8e4n%40googlegroups.com.
  • ER... Adam Walters
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Adam Walters
        • ... Adam Walters

Reply via email to