Thanks for the prompt response, but we are still facing the same issue.

The OAuth credentials are generated by the account which has Admin access.
We have passed the MCC id in login-customer-id in App.config file
Also we have passed same MCC id in LoginCustomerId in App.config file, 
please find the sample below:

<add key = 'LoginCustomerId' value = 'XXXXXXXXXX' />
<add key = 'login-customer-id' value = 'XXXXXXXXXX' />


Please find the final code for fetching the billing details in *Program.cs* 
file of *Google.Ads.GoogleAds.Examples:*

            string developerToken = "XXXXXXXX";
            string oAuth2clientId = "YYYYYYY";
            string oAuth2Secret = "ZZZZZZZZ";
            string oAuth2RefreshToken = 
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
            
            long loginCustomerId = long.Parse("XXXXXXX"); //MCC id with 
administrative access;

            GoogleAdsConfig googleAdsConfig = new GoogleAdsConfig()
            {
                DeveloperToken = developerToken,
                LoginCustomerId = loginCustomerId.ToString(),
                OAuth2ClientId = oAuth2clientId,
                OAuth2ClientSecret = oAuth2Secret,
                OAuth2RefreshToken = oAuth2RefreshToken,
            };

            GoogleAdsClient googleAdsClient = new 
GoogleAdsClient(googleAdsConfig);
            ListInvoicesRequest lstRequest = new ListInvoicesRequest();
            lstRequest.CustomerId = "1234567890"; //customer id of the 
account for which we need the invoice details;
            lstRequest.BillingSetup = 
"customers/1234567890/billingSetups/222222222";
            lstRequest.IssueYear = "2019";
            lstRequest.IssueMonth = 
GoogleAds.V2.Enums.MonthOfYearEnum.Types.MonthOfYear.December;

            InvoiceServiceClient invService = 
googleAdsClient.GetService(Services.V2.InvoiceService);
            ListInvoicesResponse res = new ListInvoicesResponse();
            res = invService.ListInvoices(lstRequest);


We are getting the same error 
'Google.Ads.GoogleAds.V2.Errors.GoogleAdsException: 
'Status(StatusCode=PermissionDenied, Detail="The caller does not have 
permission")'', please go through the code and let me know if we are 
following the same format and all the values passed are correct. While 
debugging I found that we are getting the error at the last line i.e. "res 
= invService.ListInvoices(lstRequest);"

Regards,
Siddhesh


On Tuesday, 4 February 2020 00:42:01 UTC+5:30, adsapiforumadvisor wrote:
>
> Hi Siddhesh,
>
> Thanks for reaching out. StatusCode=PermissionDenied indicates that the 
> account you used to authenticate does not have the access to the customer 
> account you are querying on. You would need to make sure the OAuth 
> credentials were generated by an email address which has the Administrative 
> access to the account you query on. Also, you need to  set a 
> login-customer-id in your local configuration, please refer to this blog 
> post 
> <https://ads-developers.googleblog.com/2019/01/new-required-header-for-google-ads-api.html>
>  
> on how to implement it. Please let me know if you have any further 
> questions.
>
> Thanks and regards,
> Xiaoming, Google Ads API Team
>
>
>  
>
> ref:_00D1U1174p._5001UUzvwL:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/951c8077-c5c5-43bd-bd75-7d5daafd42e7%40googlegroups.com.

Reply via email to