# Create your Remote Catalog

> Define your product catalog and upload it to the Remote Catalog service.

Configure your product catalog and [upload it to the Remote Catalog service](#upload-your-product-catalog-to-the-remote-catalog-service) so your users can access the latest products for your application, without having to install a new version.

If you upload your product catalog to the Remote Catalog, the Unity IAP SDK can retrieve the product catalog from the `RemoteCatalogProvider` class and display the products to your users. This has the following benefits:

* You ensure real-time distribution of your products and pricing without the need for your users to update their applications.
* You don't have to configure product information across multiple payment providers.

## Products and catalog listings

Unity IAP represents your catalog with two related concepts:

* A **product** is what you grant to the user. Each product has a SKU, also called the `productId`.
* A **catalog listing** is a purchasable version of a product, identified by a `catalogListingId`. A product can have several catalog listings, so you can sell the same product in more than one way.

To buy a product, a user purchases one of its catalog listings. When you start a purchase or target a specific listing, use the `catalogListingId` rather than the `productId`. If you don't define more than one listing for a product, Unity IAP creates a single catalog listing where the `catalogListingId` matches the SKU. Existing single-listing catalogs continue to work without any changes.

> **Note:**
>
> Before you can deploy your product catalog, you need to install the [Deployment package](https://docs.unity3d.com/Packages/com.unity.services.deployment@latest).

> **Warning:**
>
> For Direct to Consumer (D2C) payment providers, don't use the IAP Catalog window to create products. You have to [create products as an IAP Catalog Item](#create-a-product-catalog-in-the-unity-editor). Similarly, don't use the Codeless IAP path because the **Auto-initialize** option in the Catalog Editor doesn't work with D2C payment providers.

## Define your product catalog

You can use the following methods to define information about your products in a remote product catalog:

* [In the Unity Editor](#create-a-product-catalog-in-the-unity-editor) (recommended)
* [Import an existing catalog from the App Store or Google Play](#import-an-existing-catalog)
* [Use the API](#use-the-api-to-create-a-product-catalog)
* [Use a custom integration](#use-a-custom-deployment-window-integration-to-create-your-product-catalog)

You can also author your catalog directly on the Unity Cloud Dashboard, under **In-App Purchases** > **Catalog**.

If you use the Unity Editor to add products, Unity In-App Purchasing (IAP) automatically handles some of the backend logic required for the purchase fulfillment process. This is helpful especially if you choose to [fulfill purchases through the backend API](./implement-backend.md).

> **Note:**
>
> To create your product catalog in the Unity Editor UI, you must use Unity Editor version 6.0 or later. If you're using an earlier version, you can create the product catalog [using the API](#use-the-api-to-create-a-product-catalog) instead.

### Create a product catalog in the Unity Editor

If you define products in the Unity Editor, the Editor stores your product configurations in files so you can use [config-as-code](/services/service-environments.md#configuration-as-code) workflows to manage them.

To create a product in the Unity Editor, follow these steps:

1. To create a catalog item, right-click in a directory and select **Create** > **Services** > **IAP Catalog item**.
2. Give your catalog item a name. This creates a Catalog Item asset, and opens the asset in the Inspector window.
3. Enter the details for your catalog item. For more information, refer to the [Catalog Item asset Inspector reference](#catalog-item-asset-inspector-reference).
4. Select **Apply**.

Repeat these steps to create catalog items for all your products.


**Frame:**
![A screenshot of the Catalog Item Asset open in the Inspector window of the Unity Editor. The image shows the fields for Catalog Listing Id, Sku, Product Type, Product Details, Pricing Details, Image URL, and Store ID Overrides.](/api/media?file=/iap/media/images/catalog-inspector.png)

After you have added your products, select **View in Deployment window** to open your product catalog in the Deployment window and [upload them to the Remote Catalog](#upload-your-product-catalog-to-the-remote-catalog-service).

You can also edit the product details directly in the file instead of in the Unity Editor. The properties in the file map to the properties listed in the [Catalog Item asset Inspector reference](#catalog-item-asset-inspector-reference).

#### Catalog Item Asset Inspector reference

Refer to the following properties to define your IAP catalog items:

| **Property**           | **Description**                                                                                                                                                                                                |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Script**             | Filled by default.                                                                                                                                                                                             |
| **Catalog Listing Id** | Filled by default (uses the file path). The identifier you use to target this listing when you start a purchase.                                                                                               |
| **SKU**                | Filled by default (uses the file name).                                                                                                                                                                        |
| **Product Type**       | Select the type of IAP product.                                                                                                                                                                                |
| **Product Details**    | Enter information about the product, including:  Title Description Language Subtitle Badge (Text and Image URL)                                                                                                |
| **Pricing Details**    | Enter the product price information, including:  Currency code Amount                                                                                                                                          |
| **Image URL**          | Enter an image URL to specify which image to display for the product.                                                                                                                                          |
| **Store ID Overrides** | Optional. Map your listing to the App Store and Google Play, which have different naming requirements. Only use these fields if your SKU doesn't meet a store's requirements:  Apple Override Google Override  |

### Import an existing catalog

If you already have a catalog configured in the App Store or Google Play, you can import it into the Unity Editor instead of recreating your products.

1. In the Unity Editor, select **Services** > **In-App Purchasing** > **Import Catalog**.
2. Select the **App Store** or **Google Play Store** tab for the store you want to import from.
3. Under **Step 1: Fetch Catalog Data**, enter your store credentials, then select **Fetch Catalog**:
   * **Secret Key**
   * **Secret Scope**
4. Under **Step 2: Import or Export**, set the **Import New** destination path for the generated catalog items, then select **Apply**.

> **Note:**
>
> Any modified SKU only updates the existing `.ucat` file, whereas any new SKU creates a new `.ucat` file at the import destination.

After you import your catalog, [upload it to the Remote Catalog service](#upload-your-product-catalog-to-the-remote-catalog-service).

### Use the API to create a product catalog

Use this method if you prefer to manage your product catalog through an Editor script instead of using the Unity Editor UI.

First, you have to create an `.asmdef` file to contain all the required dependencies.
Refer to the following example to create your `.asmdef` file:

```json
{
    "name": "MyIAPProject.Authoring",
    "rootNamespace": "MyIAPProject.Authoring",
    "references": [
        "Unity.Services.Core",
        "Unity.Services.Core.Editor",
        "Unity.Services.Core.Internal",
        "Unity.Services.DeploymentApi",
        "Unity.Services.Core.Environments.Editor",
        "UnityEditor.Purchasing.Authoring",
        "UnityEditor.Purchasing.Editor.Authoring.Core",
        "Unity.Purchasing.Editor.Shared",
        "Unity.Purchasing"
    ],
    "includePlatforms": [
        "Editor"
    ]
}
```

Then, you can use the `ILiveContentConfigClient` API to modify the Remote Catalog directly:

1. Obtain the relevant services through the `PurchasingAuthoringServiceProvider`:
   * `ILiveContentConfigClient`
   * `IEnvironmentsApi`
     `PurchasingAuthoringServiceProvider.GetService<ILiveContentConfigClient>()`
2. Initialize the `ILiveContentConfigClient` interface with the required information.
3. Make calls to read/update the catalog (these calls are made with the current signed in user authority).

> **Warning:**
>
> This operation is destructive, if you don't send an item, it will not be part of the catalog. This also skips the validations that the deployment process usually validates.

Refer to the following code sample:

```csharp
[MenuItem("IAP/Deployment/Get and print the catalog")]
public static async void Select()
{
    var lcc = PurchasingAuthoringServiceProvider.GetService<ILiveContentConfigClient>();
    var env = PurchasingAuthoringServiceProvider.GetService<IEnvironmentsApi>();
    await lcc.Initialize(
        env.ActiveEnvironmentId.ToString(),
        CloudProjectSettings.projectId,
        CancellationToken.None);
    var items = await lcc.List(CancellationToken.None);
    Debug.Log(string.Join("\n", items.Select(i => $"{i.uSku} - {i.ProductDetails[0].Description}")));
}
```

### Use a custom Deployment window integration to create your product catalog

You can use the Deployment window to host custom integrations, so you can create a simple custom deployment such as CSV or excel directly to the Remote Catalog.

For information on how to create a simple Deployment window, refer to the [Deployment package documentation](https://docs.unity3d.com/Packages/com.unity.services.deployment.api@latest?subfolder=/manual/deployment_api.html).

## Upload your product catalog to the Remote Catalog service

Use the Deployment window to upload your products to the Remote Catalog:

1. In the Unity Editor, select **Services** > **Deployment** to open the Deployment window.
2. Select the products you want to add to your Remote Catalog and select **Deploy Selected**.


**Frame:**
![A screenshot of the Deployment window in the Unity Editor that shows a list of .ucat catalog items.](/api/media?file=/iap/media/images/deployment-window.png)

> **Important:**
>
> At purchase time, IAP uses your Remote Catalog definitions to construct your D2C payment provider Checkout data. IAP doesn't use any products you add directly in Stripe or Coda.

## Delete products from your remote catalog

There are multiple ways you can delete an item from the remote catalog in the Unity Editor:

* Open the catalog item in the Inspector window and select **Delete Remote**.
* Open the Deployment window, right-click the catalog item, and select **Delete Remote**.

> **Note:**
>
> To delete a renamed catalog item from the Remote Catalog, you first recreate a temporary item using the original SKU. You can then delete that item via the Deployment window to successfully sync the removal.

## Next steps

This page is part of a workflow to set up D2C payment providers with IAP. To continue this workflow, choose one of the following options:

[Integrate D2C payment providers](./workflow.md#create-your-remote-catalog): Return to the Integrate D2C payment providers with IAP workflow page.
[Initialize services to handle the startup sequence](./initialize-services.md): Proceed to the next step in the workflow to set up your D2C payment provider.
