ListInvoices-error (PermissionDenied)

114 views
Skip to first unread message

Asle Furuseth

unread,
May 25, 2021, 9:47:56 AM5/25/21
to AdWords API and Google Ads API Forum
Hi

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 not providing my credentials here, but my LoginCustomerId is 7294448259 (manager account).
I'm trying to get invoice for customer 4890915856.

Here is my simplified C#-code:

            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.id,
            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);


This last method fails in "Permission Denied". 

Why??

Thanks for help.

Google Ads API Forum Advisor Prod

unread,
May 25, 2021, 9:43:55 PM5/25/21
to aslefu...@gmail.com, adwor...@googlegroups.com
Hi Asle,

Thank you for posting your concern.

The USER_PERMISSION_DENIED error occurs when authenticating as an user with access to a manager account but not specifying login-customer-id in the request. However, since you've mentioned that you used the 729-444-8259 in login-customer-id where the client account 489-091-5856 is under, then the error should not occurred.

With this, to further investigate the issue, could you provide the user account / email address used to generate Oauth2 credential and the complete request and response logs with request ID generated on your end where we can see the issue? Please provide it via Reply privately to author option.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2HDVYN:ref

Asle Furuseth

unread,
May 26, 2021, 5:20:49 AM5/26/21
to AdWords API and Google Ads API Forum
I'm sorry, but I can not see the "Reply privately to author"-option.

I have tried different views and browsers but cannot find that option.

Capture.PNG

Google Ads API Forum Advisor Prod

unread,
May 26, 2021, 12:16:20 PM5/26/21
to aslefu...@gmail.com, adwor...@googlegroups.com
Hi Asle,

If you are unable to reply privately, you can email us at googleadsa...@google.com.

Regards,
Anthony

Google Logo
Anthony
Google Ads API Team
 


ref:_00D1U1174p._5004Q2HDVYN:ref
Reply all
Reply to author
Forward
0 new messages