Set up store credentials for catalog import
Add your App Store Connect or Google Play key as a credential so that Unity can read your product listings when you import a catalog.
Read time 9 minutesLast updated a day ago
To import an existing catalog from the App Store or Google Play, Unity needs a store API key that can read your product listings. Unity stores the key as a secret in Secret Manager and reads it when you import. You can't view the value of the secret afterward.
You can add the credential in two ways:
- In the Unity Cloud Dashboard, the Import catalog dialog builds the credential from the key that the store issued to you. Use this method whenever you can, because Unity assembles and escapes the stored value for you.
- Alternatively, you can store the credential in Secret Manager yourself. Take this route if you import from the Import Catalog window in the Unity Editor, or if you manage your secrets outside the Unity Cloud Dashboard.
Whichever method you use, get the key from the store first. The following sections describe what Unity needs for each store, and what permissions that key needs to read your listings. A credential stored in the wrong shape is the most common reason an import fails, so use the dialog if you have the choice.
Prerequisites
Before you set up a store credential, meet the following requirements:
- You have a role in your Unity organization or project that allows you to add secrets. For more information, refer to Grant roles.
- You have an App Store Connect or Google Play account for the application whose catalog you want to import, with enough access to create an API key.
- Your application exists in the store account that the credential belongs to. Unity matches your application by its bundle ID or package name, so the credential and the application must belong to the same account.
Set up an App Store Connect credential
Unity uses an App Store Connect API key to read your in-app purchase listings and their pricing. Create the key in App Store Connect under Users and Access > Integrations. For more information, refer to Creating API keys for App Store Connect API (Apple).
Unity needs three values from the key:
Value | Description |
|---|---|
| Private key | The contents of the |
| Key ID | The identifier that App Store Connect shows next to the key. |
| Issuer ID | Optional. The identifier that App Store Connect shows on the API keys page. Team keys have an issuer ID, and individual keys don't. |
Add the App Store Connect key in the Unity Cloud Dashboard
To build the credential from your key, follow these steps:
- Open In-App Purchases > Catalog, then select Import catalog.
- Select the iOS platform, open the credential dropdown, and select Add credential.
- In Secret name, enter a name for the secret. Use 3 to 100 characters, start with a letter or a digit, and use only letters, digits, underscores (), and hyphens (
_). A bundle ID or package name isn't a valid secret name, because it contains periods (-).. - In Private key, paste the contents of the file, including the
.p8andBEGIN PRIVATE KEYlines.END PRIVATE KEY - In Key ID, enter the key ID from App Store Connect.
- In Issuer ID (team keys only), enter the issuer ID for a team key, or leave the field blank for an individual key.
- Select Add.
Unity combines the values into a single JSON secret and saves it to Secret Manager at project scope, with access granted to In-App Purchase. Unity then selects the new credential in the dropdown, so you can continue the import.
If a value can't be a key, the dialog reports the problem inline and disables Add. Paste only the key itself into Private key, not an assembled JSON document, because the dialog builds the JSON around it for you.
If a key ID or issuer ID doesn't have the format the store usually issues, the dialog shows an advisory warning but still lets you continue. Apple doesn't publish either format as a contract, so Unity warns rather than blocks.
Store the App Store Connect key in Secret Manager yourself
The secret value is a single JSON object with the following fields:
Field | Description | Required |
|---|---|---|
| The full contents of the | Yes |
| The key ID from App Store Connect. | Yes |
| The issuer ID from App Store Connect. Leave the value empty for an individual key. | Yes |
Because is a JSON string value, escape each line break in the private key as . If you paste the contents of the file directly, the literal line breaks make the secret invalid JSON and the import fails.
p8\n.p8Use the following shape for the secret value:
{ "p8": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49\nAwEHBHkwdwIBAQQg...\n-----END PRIVATE KEY-----", "keyId": "A1B2C3D4E5", "issuerId": "12a34b56-c78d-9012-e345-6f78901a2345"}
To store the credential, refer to Store secrets using the Unity Dashboard, and grant the secret access to In-App Purchase.
Set up a Google Play credential
Unity uses a Google Cloud service account key to read your in-app product listings through the Google Play Android Developer API. Create a service account and a JSON key for it in Google Cloud, under IAM and Admin. For more information, refer to Create and delete service account keys (Google).
Unity needs the contents of the JSON key file that you download from Google Cloud. The file must contain the and members that Unity uses to request a token.
client_emailprivate_keyTwo further requirements apply, and the import fails if you miss either of them:
- The service account has the View app information (read only) and Manage store presence permissions for your application, which you grant under Users and permissions in the Google Play Console.
- The Google Cloud project that owns the service account has the Google Play Android Developer API enabled.
For more information about both requirements, refer to Getting started with the Google Play Developer API (Google).
Add the Google Play key in the Unity Cloud Dashboard
To build the credential from your key file, follow these steps:
- Open In-App Purchases > Catalog, then select Import catalog.
- Select the Android platform, open the credential dropdown, and select Add credential.
- In Secret name, enter a name for the secret. Use 3 to 100 characters, start with a letter or a digit, and use only letters, digits, underscores (), and hyphens (
_). A bundle ID or package name isn't a valid secret name, because it contains periods (-).. - In Service account key, paste the whole contents of the JSON key file. The dialog confirms which service account it read from the file.
- Select Add.
Unity wraps the key file in a single JSON secret and saves it to Secret Manager at project scope, with access granted to In-App Purchase. Unity then selects the new credential in the dropdown, so you can continue the import.
Unity passes through any member of the key file that it doesn't recognize, so a change to the Google key format doesn't stop a valid key from working.
Store the Google Play key in Secret Manager yourself
The secret value is a single JSON object with the following field:
Field | Description | Required |
|---|---|---|
| The full contents of the service account key file that you downloaded from Google Cloud. | Yes |
Because is a JSON string value, JSON-escape the whole key file so that the secret is still valid JSON. Escape every backslash () as , and every double quote () as . Escape the line breaks between the members of the key file as , or remove them.
serviceAccountJSON\\\"\"\nThe backslash rule is the one that's easy to miss. The member in the key file already holds escape sequences rather than real line breaks, so escaping its backslashes turns each sequence into in the secret value. If you escape only the quotes and the line breaks, the value either isn't valid JSON, or it parses to a key file whose private key holds real line breaks. Either way, the import fails.
private_key\n\\nUse the following shape for the secret value:
{ "serviceAccountJSON": "{\"type\": \"service_account\", \"project_id\": \"my-project\", \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkq...\\n-----END PRIVATE KEY-----\\n\", \"client_email\": \"unity-catalog-import@my-project.iam.gserviceaccount.com\"}"}
Escaping a key file by hand is error-prone. To produce the value reliably, read the file as a single string with a tool that escapes it for you. For example, writes the complete secret value with the following command:
jqjq -Rs '{serviceAccountJSON: .}' < service-account.json
To store the credential, refer to Store secrets using the Unity Dashboard, and grant the secret access to In-App Purchase.
Import with your credential
After you add the credential, use it in either import method:
- In the Unity Cloud Dashboard, select it in the credential dropdown. For more information, refer to Import a catalog.
- In the Unity Editor, enter the secret name and its scope in the Import Catalog window. For more information, refer to Import an existing catalog.
The credential dropdown in the Unity Cloud Dashboard lists the secrets stored at your project, the secrets your project inherits from your organization, and the secrets stored at the environment you're importing into.
If the import fails, refer to Troubleshooting catalog import.