Stay organized with collections
Save and categorize content based on your preferences.
Merchant API code sample to render account issues.
Java
// Copyright 2025 Google LLC//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at//// https://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License.packageshopping.merchant.samples.issueresolution.v1;importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.issueresolution.v1.AccountName;importcom.google.shopping.merchant.issueresolution.v1.IssueResolutionServiceClient;importcom.google.shopping.merchant.issueresolution.v1.IssueResolutionServiceSettings;importcom.google.shopping.merchant.issueresolution.v1.RenderAccountIssuesRequest;importcom.google.shopping.merchant.issueresolution.v1.RenderAccountIssuesResponse;importcom.google.shopping.merchant.issueresolution.v1.RenderIssuesRequestPayload;importcom.google.shopping.merchant.issueresolution.v1.RenderedIssue;importcom.google.shopping.merchant.issueresolution.v1.UserInputActionRenderingOption;importjava.io.IOException;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to render account issues for a given Merchant Center account */publicclassRenderAccountIssuesSample{privatestaticvoidrenderAccountIssuesSample(Configconfig,StringlanguageCode,StringtimeZone,UserInputActionRenderingOptionuserInputActionOption)throwsIOException{// Obtains OAuth token based on the user's configuration.GoogleCredentialscredential=newAuthenticator().authenticate();IssueResolutionServiceSettingssettings=IssueResolutionServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();StringaccountId=config.getAccountId().toString();Stringname=AccountName.newBuilder().setAccount(accountId).build().toString();try(IssueResolutionServiceClientclient=IssueResolutionServiceClient.create(settings)){RenderAccountIssuesRequestrequest=RenderAccountIssuesRequest.newBuilder().setName(name).setLanguageCode(languageCode).setTimeZone(timeZone).setPayload(RenderIssuesRequestPayload.newBuilder().setUserInputActionOption(userInputActionOption).build()).build();System.out.println("Sending RenderAccountIssues request");RenderAccountIssuesResponseresponse=client.renderAccountIssues(request);System.out.println("The full response:");System.out.println(response);System.out.println("-----------------------------------------------------------------");System.out.println("Summary: "+response.getRenderedIssuesCount()+" issues found for the account");System.out.println("-----------------------------------------------------------------");for(RenderedIssueissue:response.getRenderedIssuesList()){System.out.println();// empty line for formattingSimpleRenderer.printIssue(issue);}}catch(Exceptione){System.out.println("An error has occured: ");System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();StringtimeZone="Europe/Zurich";StringlanguageCode="en_GB";// The simple option: request all complex actions to be handled as redirects to// the Merchant Center. e.g. send the merchant to MC to request an appeal.UserInputActionRenderingOptioninputActionOption=UserInputActionRenderingOption.REDIRECT_TO_MERCHANT_CENTER;renderAccountIssuesSample(config,languageCode,timeZone,inputActionOption);}}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-13 UTC."],[],[],null,["# Render account issues\n\nMerchant API code sample to render account issues. \n\n### Java\n\n // Copyright 2025 Google LLC\n //\n // Licensed under the Apache License, Version 2.0 (the \"License\");\n // you may not use this file except in compliance with the License.\n // You may obtain a copy of the License at\n //\n // https://www.apache.org/licenses/LICENSE-2.0\n //\n // Unless required by applicable law or agreed to in writing, software\n // distributed under the License is distributed on an \"AS IS\" BASIS,\n // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n // See the License for the specific language governing permissions and\n // limitations under the License.\n\n package shopping.merchant.samples.issueresolution.v1;\n\n import com.google.api.gax.core.FixedCredentialsProvider;\n import com.google.auth.oauth2.GoogleCredentials;\n import com.google.shopping.merchant.issueresolution.v1.AccountName;\n import com.google.shopping.merchant.issueresolution.v1.IssueResolutionServiceClient;\n import com.google.shopping.merchant.issueresolution.v1.IssueResolutionServiceSettings;\n import com.google.shopping.merchant.issueresolution.v1.RenderAccountIssuesRequest;\n import com.google.shopping.merchant.issueresolution.v1.RenderAccountIssuesResponse;\n import com.google.shopping.merchant.issueresolution.v1.RenderIssuesRequestPayload;\n import com.google.shopping.merchant.issueresolution.v1.RenderedIssue;\n import com.google.shopping.merchant.issueresolution.v1.UserInputActionRenderingOption;\n import java.io.IOException;\n import shopping.merchant.samples.utils.Authenticator;\n import shopping.merchant.samples.utils.Config;\n\n /** This class demonstrates how to render account issues for a given Merchant Center account */\n public class RenderAccountIssuesSample {\n\n private static void renderAccountIssuesSample(\n Config config,\n String languageCode,\n String timeZone,\n UserInputActionRenderingOption userInputActionOption)\n throws IOException {\n\n // Obtains OAuth token based on the user's configuration.\n GoogleCredentials credential = new Authenticator().authenticate();\n\n IssueResolutionServiceSettings settings =\n IssueResolutionServiceSettings.newBuilder()\n .setCredentialsProvider(FixedCredentialsProvider.create(credential))\n .build();\n\n String accountId = config.getAccountId().toString();\n String name = AccountName.newBuilder().setAccount(accountId).build().toString();\n\n try (IssueResolutionServiceClient client = IssueResolutionServiceClient.create(settings)) {\n\n RenderAccountIssuesRequest request =\n RenderAccountIssuesRequest.newBuilder()\n .setName(name)\n .setLanguageCode(languageCode)\n .setTimeZone(timeZone)\n .setPayload(\n RenderIssuesRequestPayload.newBuilder()\n .setUserInputActionOption(userInputActionOption)\n .build())\n .build();\n\n System.out.println(\"Sending RenderAccountIssues request\");\n\n RenderAccountIssuesResponse response = client.renderAccountIssues(request);\n\n System.out.println(\"The full response:\");\n System.out.println(response);\n\n System.out.println(\"-----------------------------------------------------------------\");\n System.out.println(\n \"Summary: \" + response.getRenderedIssuesCount() + \" issues found for the account\");\n System.out.println(\"-----------------------------------------------------------------\");\n\n for (RenderedIssue issue : response.getRenderedIssuesList()) {\n System.out.println(); // empty line for formatting\n SimpleRenderer.printIssue(issue);\n }\n } catch (Exception e) {\n System.out.println(\"An error has occured: \");\n System.out.println(e);\n }\n }\n\n public static void main(String[] args) throws Exception {\n Config config = Config.load();\n String timeZone = \"Europe/Zurich\";\n String languageCode = \"en_GB\";\n // The simple option: request all complex actions to be handled as redirects to\n // the Merchant Center. e.g. send the merchant to MC to request an appeal.\n UserInputActionRenderingOption inputActionOption =\n UserInputActionRenderingOption.REDIRECT_TO_MERCHANT_CENTER;\n\n renderAccountIssuesSample(config, languageCode, timeZone, inputActionOption);\n }\n } \n https://github.com/google/merchant-api-samples/blob/c6de994268c785ce22af0065932518a9ac5b3c03/java/src/main/java/shopping/merchant/samples/issueresolution/v1/RenderAccountIssuesSample.java"]]