Steamworks-dokumentation
Steam Economy

Översikt

The Steam Economy is our name for a set of features that allow in-game items from multiple games to work together in a single shared system in Steam. In-game items in the Steam Economy can be purchased via microtransactions, earned from Steam Achievements, delivered in-game, or granted in response to various kinds of promotions. Users can view their in-game inventories in the Steam Community, include links to items in chat sessions, and trade items with other users. Steam provides the user-interface and the heavy lifting for these features, but leaves the game itself in complete control of the items themselves.

In-game items in the Steam Economy are called Assets and can represent anything a user can own in a game. Some examples are equipment, vehicles, character, pets, crafting recipes, etc. The game tells Steam how to display an asset to a user, but what the asset actually does is left up to the game. The game is also responsible for keeping track of which user owns which assets and communicating that information to both users and support agents. It is also the responsibility of the game to determine which assets are tradable, decide what storage space restrictions users are subject to, and to provide the support team information about all of the above.

Each game controls these things by implementing the Steam Asset API. This is a collection of Web APIs to allow Steam visibility into that back end. Full documentation for the Steam Asset API is below.

Requirements

In order to add a game to the Steam Economy a few requirements must be met.

  • The game must have an asset back-end that is not stored on the game client. Some kind of database that lives in a datacenter will be required. That datacenter could be owned by a publisher or developer, or it could be provided by a cloud hosting service. Steam offers a free Inventory Service that can be used as the persistent storage of items for your game.
  • The game must define a set of Context IDs that define the containers in which a user can hold assets.
  • Each game must provide a persistent 64-bit ID for each asset that can be traded to another user. At a minimum this asset ID must be unique within the context that contains the asset.
  • The game must provide inventory icons for all in-game assets via a web server. These icons should be available in 96x96 and 200x200 sizes in jpg, png, or gif formats. Steam will provide the bandwidth needed to serve these images to users.
  • The game must implement at least the methods included under Steam Trading below.
  • The game should also implement methods from Support Tool Integration.

Only Read Further If...

You plan to create your own asset tracking service. The rest of this document outlines the required Web API.
Otherwise, if you plan on using the Steam Inventory Service then you do not need to read any further.

Steam Trading

The Steam Trading system uses a web interface to perform trades and view inventories. These pages are populated with the results of GetContexts, GetContextContents, GetAssetClass, and GetAssetClassInfo in the asset API. Once a trade is confirmed by both users a three-phase commit is performed across all games involved in the trade. All of the commit and rollback logic for the three-phase commit is handled in the Economy server in Steam. It causes ownership changes to occur in games via the TradeSetUnowned and TradeSetOwned methods.
GETGetContexts/v0001Returns the list of contexts for a user.
GETGetContextContents/v0001Returns the asset class of each of the user's assets and currency for display in a trade or in Steam Community.
GETGetAssetClass/v0001Returns the asset class and owner for a list of assets for display in a trade or in Steam Community.
GETGetAssetClassInfo/v0001Returns user display information for a single asset class.
POSTTradeSetUnowned/v0001Called when the economy server needs the game to remove an asset or some currency from a user.
POSTTradeSetOwned/v0001Called when the economy server needs the game to change an existing unowned asset to be owned by a user.

Support Tool Integration

The support tool is the system that Steam support agents use to help out issues that crop up with a user's assets (and any other account issue in Steam.) Implementing these APIs allows both forms of the support tool access to the assets in a game.

Support tool access to games in the Steam Economy is provided through two pages: Economy and History. The Economy page interacts with the assets in a context with GetContextContents and GetAssetClassInfo. The History page uses GetUserHistory, GetHistoryCommandDetails, HistoryExecuteCommands. Both pages will display asset details with the results from SupportGetAssetHistory. ContextCommand is used to let support agents perform context-level and asset-level actions.
POSTContextCommand/v0001Executes a context command from the support tool.
GETGetUserHistory/v0001Returns the audit history for a user for use in the support tool.
GETGetHistoryCommandDetails/v0001Returns a detailed list of command actions for a history command to a support agent.
POSTHistoryExecuteCommand/v0001Executes a set of history command actions on a user for a support agent.
GETSupportGetAssetHistory/v0001Returns history information about an asset for us in the support tool.

Web Purchasing

You can allow users to purchase items in your game from the web by implementing the following APIs.
POSTStartWebAssetTransaction/v0001Starts a transaction on behalf of a user for the items specified. Calls ISteamMicroTxn/InitTxn to have Steam setup the transaction and obtain a forwarding URL.
POSTFinalizeWebAssetTransaction/v0001Called after the user pays for the items in the transaction. Should call ISteamMicroTxn/FinalizeTxn before attempting to give the user items.
GETGetAssetPrices/v0001Returns prices and categories for items that users are able to purchase.

Steam Refunds

Steam's refund policy allows users to obtain a refund for in-game purchases within 48 hours of purchase as long as none of the items purchased have been consumed, modified, or transferred. If you wish to participate in this policy, you will need to implement the following APIs.
GETQueryRefundAllowed/v0001Called to check on the status of each item in an in-game purchase.
POSTRefundPurchase/v0001Called when a refund has been approved either automatically or by a support agent.

Foreign Assets

If your game imports assets from another game it can call GetExportedAssets to retrieve the assets.
GETGetExportedAssets/v0001Returns a list of items exported by another game on Steam.

Interface Versioning

To allow for future versions of the Asset API, the Economy server will append a version number to every URL it calls. Currently all of the methods are at version 1 so "/v0001" will be appended to each URL. So if your asset server URL is https://api.mygame.com/assetapi then GetContexts method will be called as https://api.mygame.com/assetapi/GetContexts/v0001 followed by the specified GET
parameters for that method.

API Keys

If you set an API key in the Economy tab of your game's technical details that key will be passed into every call made by the economy server.
The key will be in a GET or POST (depending on request type) parameter called "key". Please verify that the key matches what you set in the Economy tab when you receive a call to ensure that the call actually came from the Economy server.

Vanliga frågor

Fråga: What is the Steam Economy?

Svar: The Steam platform has built-in functionality for secure and reliable trading, a world-wide real currency marketplace, detailed out-of-game item introspection through the Steam Community, and more. You can opt in to any or all of this functionality.

Q.What are the benefits to participating in the Steam economy?

Svar: Items in economy-enabled games are more valuable than items that are only used in a single-game ecosystem, leading to happier customers.

Players can link to items in Steam profiles and chat, providing additional free exposure for both the game and the items in it. For games that support trading, items capture value not only for their current owners, but also for all other active players and potential newcomers. This means, for example, that all games that use the Steam economy immediately become both more interesting and more valuable to the players of all other economy-enabled games (like Team Fortress 2 and Dota 2).

Additionally, you can leverage our existing infrastructure for trading/currency transactions and support, as well as opt in to any future functionality for free.

Q.What are the requirements to participate?

Svar: Your game must have an asset back-end that is not stored on the game client, aka item server. Some kind of database that lives in a datacenter will be required.
That datacenter could be owned by a publisher or developer, or it could be provided by a cloud hosting service. Steam offers a free Inventory Service that be used as the persistent storage of items for your game. That back-end must implement a small number of WebAPIs so that Steam can communicate with it.

Q.Can we participate in some parts of the economy, but not all?

Svar: The WebAPIs called by Steam provide a single common interface to the Steam Community view of items, cross-game trading, and the Steam Community Market. You have control at either a broad level to disable entire features (ie., enable trading but disable all Market transactions) or at a fine-grained level (ie., all items can be viewed through the Community, some can be traded, but only specific items can be listed on the Market). You can change these settings per-item at any time.

Q.Does Valve have a persistent item back-end that we can use as a part of Steamworks?

Svar: The Steam Inventory Service is available for use.