Set up Steam in-app purchases
Overview
No game client change is needed for in-app purchases. On the AGS side, configure both apps in the Steam IAP configuration and pay attention to your IAP Item Mapping. See Configure IAP item mapping.
For an overview of in-app purchases, see Introduction to Third-party In-App Purchase.
Configure Steam IAP for both apps
If you have not set up Steam IAP yet, follow Manage third-party store integrations first.
- Admin Portal
- AGS CLI
-
In the AGS Admin Portal, go to your game namespace.
-
Go to 3rd Party Store > Steam.
-
Select Enable Steam multi app IDs. A second app row appears.
-
For each row, enter the App ID and a Name. You can add up to two apps.
The first row is the default app. To change the default, reorder the rows.
-
Set Sync Mode and Environment.
infoIn Steam Transaction mode, Environment applies to both apps, so you cannot run one app in
LIVEand the other inSANDBOX. -
Click Save.
If the Steam IAP configuration and the Steam login method disagree about Steam multiple apps, the page shows a notice that links to the login method settings. Keep both settings the same.
-
Create a JSON file with the configuration. This example uses
steam-iap.json:{
"appId": "<FirstSteamAppId>",
"enableMultipleAppIds": true,
"appIds": ["<FirstSteamAppId>", "<SecondSteamAppId>"],
"publisherAuthenticationKey": "<YourSteamWebApiKey>",
"syncMode": "TRANSACTION",
"env": "LIVE"
}appId: the first app, which is also the default app. It must be one of the entries inappIds.appIds: the Steam App IDs allowed in this namespace, without duplicates. Every App ID must belong to your Steam publisher account.publisherAuthenticationKey: required. Your Steam Publisher Web API Key from the Steamworks Portal. Both apps share it.syncMode:INVENTORYorTRANSACTION, depending on the sync mode your game uses. Both apps share it.env:LIVEorSANDBOX. Both apps share it. It is required whensyncModeisTRANSACTION. Remove it forINVENTORY.
-
Save the configuration:
ags platform iap-steam update-config --namespace <YourNamespace> --json @steam-iap.json -
Delete
steam-iap.json, because it contains your Steam Web API Key.
IAP sync modes with two Steam apps
- Inventory mode: The sync request from your game client has always included the App ID, including in earlier AGS SDK versions. AGS accepts the App ID only if it is one of the configured apps. No game client change is needed.
- Transaction mode: AGS polls Steam transactions (orders) for each app and tracks a separate sync position per app. No game client change is needed.
Configure IAP item mapping
For how to add item mappings in the Admin Portal or with a JSON file, see Set up and sell consumables.
AGS maps a Steam purchase to an AGS item by the Steam item definition ID (itemdef).
- Item Mapping has no App ID context. There is no per-app mapping. AGS matches the item definition ID on its own, whichever app the purchase came from.
- A Steam item definition ID can be mapped only once in a namespace. Because the mapping has no App ID, when you add a second mapping with the same ID, AGS treats it as a duplicate and rejects it. You cannot map one ID to two different AGS items, one for each app.
- AGS does not check your Steam catalogs when you save a mapping. Each Steam app has its own catalog, so two apps can use the same item definition ID for different products. AGS does not compare the catalogs, so it cannot warn you when this happens.
Because of these limitations, never use one item definition ID for two different products across your apps when you enable Steam multiple apps. Otherwise, AGS can grant the wrong item.
The examples use two apps, App A and App B:
- Same ID, same product (Works)
- Different IDs, same product (Works)
- Same ID, different products (Does not work)
App A · itemdef 100 = sword
App B · itemdef 100 = sword
One mapping, STEAM 100 to sword, serves both apps.
App A · itemdef 100 = sword
App B · itemdef 777 = sword
Add two mappings for the same AGS item, one for each ID.
App A · itemdef 100 = sword
App B · itemdef 100 = armor
Item Mapping cannot express this case. AGS rejects a second mapping for STEAM 100 as a duplicate, so only one AGS item can use it and AGS cannot tell the two apps apart. The App B buyer receives the sword instead of the armor, with no error.