Ads API - BudgetOrderService / consolidating billing support?

76 views
Skip to first unread message

joel

unread,
Jun 20, 2019, 1:41:51 PM6/20/19
to AdWords API and Google Ads API Forum
Hello, is the equivalent of BudgetOrderService supported in the Ads API? I'm following the instructions at https://developers.google.com/google-ads/api/docs/billing/billing-setups but it doesn't have any examples about how to use consolidated billing. I am trying to move an Account's billing underneath an existing consolidated billing Payment Account. However when I run the following code, a NEW payment account is created instead of attaching it to the existing one. Thanks!

Joel


PaymentsAccountInfo paiInfo = PaymentsAccountInfo.newBuilder()
.setPaymentsAccountId("existing-payment-account-id")
.setPaymentsAccountName(StringValue.of("existing-payment-account-name"))
.setPaymentsProfileId("existing-payment-account-name"))
.build();

BillingSetup bs = BillingSetup.newBuilder()
.setId("existing-billing-setup-id")
.setPaymentsAccountInfo(paiInfo)
.setStartTimeType(TimeType.NOW)
.build();

BillingSetupOperation customerOp = BillingSetupOperation.newBuilder()
.setCreate(bs)
.build();

try (BillingSetupServiceClient bsClient = googleAdsClient.getLatestVersion().createBillingSetupServiceClient();
AccountBudgetProposalServiceClient abpClient = googleAdsClient.getLatestVersion().createAccountBudgetProposalServiceClient()
)
{
MutateBillingSetupResponse mutateResponse = bsClient.mutateBillingSetup("1234567890", customerOp);

AccountBudgetProposal proposal = AccountBudgetProposal.newBuilder()
.setBillingSetup(StringValue.of(mutateResponse.getResult().getResourceName()))
.setProposalType(AccountBudgetProposalType.CREATE)
.setProposedName(StringValue.of("Account Budget"))
.setProposedStartDateTime(StringValue.of(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
.setProposedEndTimeType(TimeType.FOREVER)
.setProposedSpendingLimitType(SpendingLimitType.INFINITE)
.build();

AccountBudgetProposalOperation abpOp = AccountBudgetProposalOperation.newBuilder()
.setCreate(proposal)
.build();

MutateAccountBudgetProposalResponse abpResponse = abpClient.mutateAccountBudgetProposal(dbAccount.getExtAccountId(), abpOp);
}

Google Ads API Forum Advisor Prod

unread,
Jun 20, 2019, 5:18:06 PM6/20/19
to joel.p...@gmail.com, adwor...@googlegroups.com

Hi Joel,

Thank you reaching out. The equivalent field to BudgetOrderService in Google Ads API is using AccountBudget, AccountBudgetProposal, BillingSetup and PaymentAccount resource. Please refer to migration document for more information. For your second concern, please refer to the guide, “To sign up with an existing Payments account, set the payments_account to the resource ID of a valid Payments account (payments_account_info should not be set).” You are trying to set up PaymentsAccountInfo in your code sample, this is the reason a new payment account is created instead of attaching it to the existing one. Could you please try to set up PaymentsAccount instead and let me know if it helps?

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UCYeM6:ref

joel

unread,
Jun 21, 2019, 3:43:25 PM6/21/19
to AdWords API and Google Ads API Forum
Thank you for the detailed reply! I've made the following modifications but now the mutateBillingSetup() call returns an internal error. The request id is in the error below - any thoughts? Thanks!
-Joel

WARN [com.google.ads.googleads.lib.request.summary] <15:32:26> {unknown:-1} {unknown.unknown:-1} FAILURE REQUEST SUMMARY. Method: google.ads.googleads.v1.services.BillingSetupService/MutateBillingSetup, Endpoint: googleads.googleapis.com:443, CustomerID: 3998363711, RequestID: gPhihpDxNU23ikQLf0rzrA, ResponseCode: INTERNAL, Fault: Internal error encountered..
Exception in thread "main" com.google.ads.googleads.v1.errors.GoogleAdsException: errors {
  error_code {
    internal_error: INTERNAL_ERROR
  }
  message: "An internal error has occurred."
}

The code now looks like the following:
BillingSetup.Builder bsb = BillingSetup.newBuilder();
bsb.setStartTimeType(TimeType.NOW);
// Reuse Payment Account
String paResource = ResourceNames.paymentsAccount(Long.parseLong(dbAccount.getExternalId()), Long.parseLong(foundPaymentProfileId.replace("-","")), Long.parseLong(foundPaymentAccountId.replace("-","")));
bsb.setPaymentsAccount(StringValue.of(paResource));

BillingSetup bs = bsb.build();


BillingSetupOperation customerOp = BillingSetupOperation.newBuilder()
.setCreate(bs)
.build();

try (BillingSetupServiceClient bsClient = googleAdsClient.getLatestVersion().createBillingSetupServiceClient())
{
MutateBillingSetupResponse mutateResponse = bsClient.mutateBillingSetup(account.getId(), customerOp);
     // exception thrown

Google Ads API Forum Advisor Prod

unread,
Jun 24, 2019, 2:37:56 PM6/24/19
to joel.p...@gmail.com, adwor...@googlegroups.com
Hi Joel,

Thank you for reaching out, and apologies that you're running into this issue. Are you receiving this error message on every request, or is it intermittent? 

Thanks,
Ben Karl, Google Ads API Team

ref:_00D1U1174p._5001UCYeM6:ref

joel

unread,
Jun 24, 2019, 2:55:13 PM6/24/19
to AdWords API and Google Ads API Forum
It happens on every request.
Reply all
Reply to author
Forward
0 new messages