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);
}
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
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);