[Seller reviews](https://support.google.com/merchants/answer/190657) help people find businesses that offer
high-quality customer experiences, helping to build trust and enabling more
informed purchasing decisions. As a result, shop ratings can help businesses
improve the performance of ads and organic listings and drive more qualified
customers to their landing pages.

This page explains how you can manage seller reviews using Merchant API.

## Prerequisites

Google needs you to provide specific information. You must have the following:

- An active merchant review data source in the Google Merchant Center.
- Your account must be enrolled into the [store ratings
  program](https://support.google.com/merchants/answer/190657). If you are unsure whether you are already enrolled, check the Merchant Center. If you aren't enrolled, submit the [request form](https://docs.google.com/forms/d/e/1FAIpQLSePegrteda-PD48S5z8SFb4i3WOEeUdsf9YFgkOOVrc-G9VXA/viewform).

> [!NOTE]
> **Note:** A merchant review data source is not the same as a product review data source.

## Create a data source

Use the
[accounts.dataSources.create](https://developers.google.com/merchant/api/reference/rest/datasources_v1/accounts.dataSources/create)
method to create a merchant reviews data source. If an existing merchant
reviews data source is available, use
[accounts.dataSources.list](https://developers.google.com/merchant/api/reference/rest/datasources_v1/accounts.dataSources/list)
to fetch the
[`accounts.dataSources.name`](https://developers.google.com/merchant/api/reference/rest/datasources_v1/accounts.dataSources#DataSource.FIELDS.name)
field.

To refer to them directly in future API calls, we recommend you to store the
`accounts.dataSources.name` for the data sources you create in your local
database for merchant review. For your existing data sources, perform a one-time
backfill of your local database with their names.

The form of the request is as follows:

    POST https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}

### Example

The example shows a typical request and response.

**Request**

    POST https://merchantapi.googleapis.com/datasources/v1/accounts/123/dataSources {"displayName": "test api data source", "merchantReviewDataSource":{} }

**Response**

    {
      "name": "accounts/123/dataSources/1000000573361824",
      "dataSourceId": "1000000573361824",
      "displayName": "test api data source",
      "merchantReviewDataSource": {},
      "input": "API"
    }

For more information, see [Create a product review data
source](https://developers.google.com/merchant/api/guides/data-sources/manage-various-data-sources#product-review-data-source).

> [!NOTE]
> **Note:** The data source is immediately available after creation, so you don't need to wait for any processing.

## Create merchant review

You can use the
[`accounts.merchantReviews.insert`](https://developers.google.com/merchant/api/reference/rest/reviews_v1alpha/accounts.merchantReviews/insert)
method to create or update a seller review. The
`accounts.merchantReviews.insert` method takes a `merchantreview` resource and a
data source name as input. It returns the new or updated merchant review,
if successful. Creating a merchant review requires
[`accounts.dataSources.name`](https://developers.google.com/merchant/api/reference/rest/datasources_v1/accounts.dataSources#DataSource.FIELDS.name).

> [!IMPORTANT]
> **Important:** This request overwrites the entire merchant review resource, so the request needs to include all the details to avoid losing information.

The form of the request:

    POST https://merchantapi.googleapis.com/reviews/v1alpha/{parent=accounts/*/}merchantReviews:insert

Study the following sample merchant review for reference.

    POST https://merchantapi.googleapis.com/reviews/v1alpha/accounts/{ACCOUNT_ID}/merchantReviews:insert?dataSource=accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}

      merchantReviewId = 'my_own_review'
      merchantReviewAttributes {
        merchantId = 'merchant_id'
        merchantDisplayName = 'merchant_display_name'
        merchantLink = 'publisher_name'
        merchantRatingLink = 'https://www.google.com'
        minRating = 1
        maxRating = 10
        rating = 7.9
        title = 'Amazing Merchant'
        content = 'This is an incredible merchant'
        reviewerId = 'reviewer_id'
        reviewerUsername = 'reviewer_username'
        isAnonymous = false
        collectionMethod = 'AFTER_FULFILLMENT'
        reviewTime = '2024-04-01T00:00:00Z'
        reviewLanguage = 'en'
        reviewCountry = 'US'
      }

After merchant review creation, it may take a few minutes for the review to
propagate.

## View merchant reviews

To view a merchant review, use
[`accounts.merchantReviews.get`](https://developers.google.com/merchant/api/reference/rest/reviews_v1alpha/accounts.merchantReviews/get).
This is read-only. It requires your `merchantId` and the ID of the merchant
review as part of the name field. The get method returns the corresponding
merchant review resource.

For example:

    GET https://merchantapi.googleapis.com/reviews/v1alpha/{name=accounts/*/merchantReviews/*}

To retrieve a single product for a given Merchant Center account, you can use
the
[`google.shopping.merchant.accounts.v1.GetProductRequest`](https://developers.google.com/merchant/api/reference/rest/reviews_v1alpha/accounts.productReviews/get)
method, as shown in the following sample.

### Java


    import com.google.api.gax.core.FixedCredentialsProvider;
    import com.google.auth.oauth2.GoogleCredentials;
    import com.google.common.io.BaseEncoding;
    import com.google.shopping.merchant.products.v1.GetProductRequest;
    import com.google.shopping.merchant.products.v1.Product;
    import com.google.shopping.merchant.products.v1.ProductsServiceClient;
    import com.google.shopping.merchant.products.v1.ProductsServiceSettings;
    import java.nio.charset.StandardCharsets;
    import shopping.merchant.samples.utils.Authenticator;
    import shopping.merchant.samples.utils.Config;

    /** This class demonstrates how to get a single product for a given Merchant Center account */
    public class GetProductSample {

      // Base64Url encoder/decoder without padding
      private static final BaseEncoding BASE64URL_NOPADDING = BaseEncoding.base64Url().omitPadding();

      // Encodes a string to base64url without padding
      public static String encodeProductId(String productId) {
        return BASE64URL_NOPADDING.encode(productId.getBytes(StandardCharsets.UTF_8));
      }

      public static Product getProduct(Config config, String accountId, String productId)
          throws Exception {

        // Obtains OAuth token based on the user's configuration.
        GoogleCredentials credential = new Authenticator().authenticate();

        // Creates service settings using the credentials retrieved above.
        ProductsServiceSettings productsServiceSettings =
            ProductsServiceSettings.newBuilder()
                .setCredentialsProvider(FixedCredentialsProvider.create(credential))
                .build();

        try (ProductsServiceClient productsServiceClient =
            ProductsServiceClient.create(productsServiceSettings)) {

          // The name has the format: accounts/{account}/products/{productId}
          String name = "accounts/" + accountId + "/products/" + productId;

          // The name has the format: accounts/{account}/products/{productId}
          GetProductRequest request = GetProductRequest.newBuilder().setName(name).build();

          System.out.println("Sending get product request:");
          Product response = productsServiceClient.getProduct(request);

          System.out.println("Retrieved Product below");
          System.out.println(response);
          return response;
        }
      }

      public static void main(String[] args) throws Exception {
        Config config = Config.load();
        String accountId = config.getAccountId().toString();

        // The name of the `product`, returned after a `Product.insert` request. We recommend
        // having stored this value in your database to use for all future requests.
        String productId = "en~GB~sku123"; // Replace with your actual product ID

        // Uncomment the following line if the product name contains special characters (such as forward
        // slashes) and needs base64url encoding.
        // productId = encodeProductId(productId);

        getProduct(config, accountId, productId);
      }
    }

## List merchant reviews

You can use the
[`accounts.merchantReviews.list`](https://developers.google.com/merchant/api/reference/rest/reviews_v1alpha/accounts.merchantReviews/list)
method to view all created merchant reviews.

    GET https://merchantapi.googleapis.com/reviews/v1alpha/accounts/{ACCOUNT_ID}/merchantReviews

## Delete merchant reviews

To delete a merchant review, use
[`accounts.merchantReviews.delete`](https://developers.google.com/merchant/api/reference/rest/reviews_v1alpha/accounts.merchantReviews/delete).
Similar to the `accounts.merchantReviews.get` method, this method requires the
name field of the merchant review returned during creation.

For example:

    DELETE https://merchantapi.googleapis.com/reviews/v1alpha/{name=accounts/*/merchantReviews/*}

## Merchant review status

The merchant review resource contains the status similar to other
APIs, which is the integral part of the resource and follows the same
issue \& destination structure.