I'm having problem using the ListInvoices-method. Other methods are working fine. I'm maybe using/providing wrong data, but I'm lost. I'm getting PermissionDenied-error on my request.
I'm trying to get invoice for customer 4890915856.
var client = new GoogleAdsClient();
var googleAdsService = client.GetService(Services.V5.GoogleAdsService);
// Define a GAQL query to retrieve all billing setup information.
string searchQuery = @"SELECT
billing_setup.status,
billing_setup.payments_account,
billing_setup.payments_account_info.payments_account_id,
billing_setup.payments_account_info.payments_account_name,
billing_setup.payments_account_info.payments_profile_id,
billing_setup.payments_account_info.payments_profile_name,
billing_setup.payments_account_info.secondary_payments_profile_id
FROM billing_setup";
// Creates a request that will retrieve all billing setups using pages of the specified
// page size.
SearchGoogleAdsRequest request = new SearchGoogleAdsRequest()
{
Query = searchQuery,
CustomerId = "4890915856",
};
PagedEnumerable<SearchGoogleAdsResponse, GoogleAdsRow> searchPagedResponse = googleAdsService.Search(request);
foreach (var item in searchPagedResponse)
{
item.ToString();
}
//I receive 1 element with this info:
//BillingSetupId: 298986887 (using this in the next request)
//PaymentaccountInfo: "2408-9112-7120"
//Faktureringsoppsettid: 0847768239300645 - Navn: Hovedfaktura"
//Get the GoogleAdsService.
var invoiceService = client.GetService(Google.Ads.GoogleAds.Services.V5.InvoiceService);
var req = new ListInvoicesRequest() { BillingSetup = ResourceNames.BillingSetup(4890915856, 298986887), CustomerId = "4890915856", IssueMonth = Google.Ads.GoogleAds.V5.Enums.MonthOfYearEnum.Types.MonthOfYear.April, IssueYear = "2021" };
var res = invoiceService.ListInvoices(req);
Thanks for help.