This is called when the Steam Economy Server needs to transfer an asset or chunk of currency that was previously set unowned to a user's inventory. It is up to the asset server to verify that this is a legal change to make to this asset or currency type. It should check asset ownership is actually unowned, that the asset or currency is tradable, and that the requested amount is present.
For stackable assets and currency it is possible that this request will provide an amount that is fewer than was originally set unowned. In that case the unowned asset or currency should have its amount decremented and a new asset should be created.
This will happen if you have a stackable item that can be listed on the Community Market. For example, if somebody puts a large stack of items on the market in a single listing, then multiple smaller purchases may come in.
The asset server will receive one
TradeSetUnowned call when the listing is created, and then one
TradeSetOwned
call for each purchase. When someone makes the first purchase for the listing on the market, the
audit_reference
value in the
TradeSetOwned
call will match the
audit_reference
value from the
TradeSetUnowned
call. Further purchases of that listing will all have different values for
audit_reference
, but will still refer to the same
assetid
. If the listing is canceled, the value of
audit_reference
in the resulting
TradeSetOwned
call will be a value that has not previously been used in any other
TradeSetOwned
calls and thus is not guaranteed to match the value was used in the
TradeSetUnowned
call when the listing was created.
Called by: Trading System
HTTP Method: POST
Parameters:
Name | Type | Required | Description |
key | string | ✔ | This is the "Asset Server Key" that you provided in your app's Steam Economy Settings on the partner site. |
appid | uint32 | ✔ | 32bit App ID of the application associated with the assets. |
owner | uint64 | ✔ | The 64-bit Steam ID of the new owner of the asset or currency. |
contextid | uint64 | ✔ | The 64-bit ID of the context in which this asset or currency can be found. |
assetid | uint64 | | The 64-bit asset ID being transferred. Either assetid or currencyid will be set to indicate which kind of object should be set to owned. |
currencyid | uint32 | | The 32-bit currency ID being removed. Either assetid or currencyid will be set to indicate which kind of object should be set to owned. |
amount | uint32 | | The number of the asset or currency to transfer. This number will always be 1 for non-stackable assets. It will always be less or equal to the amount that the Steam Economy server believes is present for this asset/currency in this context. Defaults to 1. |
trade_start_time | uint32 | ✔ | The time the trade session responsible for this action started, expressed in seconds from Jan. 1, 1970. |
audit_action | uint32 | ✔ | A 32-bit number that specifies what kind of action is causing this asset or currency to be set owned. |
audit_reference | uint64 | ✔ | A 64-bit number that identifies which event action is associated with. The asset server may wish to record this number for auditing and debugging purposes. |
leave_original | bool | ✔ | If this boolean parameter is set to 1 (to indicate true), then the asset server is being asked to duplicate the item and create a new owned item that is a copy of the asset specified. This will only be true for one-sided undos of a trade by a support agent. Defaults to 0 (false). |
request_repeated | bool | ✔ | If this is set to 1 (to indicate true), then the Steam Economy server is indicating that it has made an identical request to this one at some point in the past but did not receive a clear success or failure. If it appears that the asset or currency has already been set to owned for the same audit_action and audit_reference, the asset server should return success and set new_assetid and new_contextid to whatever was returned on the first request. |
is_market | bool | ✔ | If this is set to 1 (to indicate true), then the request is being performed in response to some activity on the Steam Community Market. When audit_action is 101 (Trade Commit), this indicates the user has purchased this item. When audit_action is 102, this indicates the user is canceling their market listing or the item is being returned to the user because of an error creating the listing. |
Returns
The output from this method should be encoded in the JSON format.
Response: -
result
-
success
- True if the method was successful. If the asset server is returning false, it should set error
to a string that explains why.
-
error
- a string describing why this call failed. This message will be recorded in the error log, which is available under the Economy tab on the Steamworks site.
-
new_assetid
(optional) - The 64-bit asset ID of the unowned version of this asset. This is only set for asset transfers. This
could be a new asset ID or be the same as the asset id specified in the request depending on the implementation of the asset server.
Defaults to being the same as the asset ID that was passed in.
NOTE: For auditing purposes, we recommend that asset server implementations create a new copy of the asset and return the new asset ID in the TradeSetOwned response. We have found that this also helps prevent bugs as it means once an asset is deleted/unowned, it remains in that state forever. Tracking that there is a link between the new and old assets (for example, by preserving some "original asset ID" from when the asset was first created in your game) may also prove useful. None of this is required, it's just something we've found to be useful.
-
new_contextid
(optional) - The 64-bit context ID of the newly owned version of this asset or currency. This could be a different context ID or be the same as the context id specified in the request depending on the implementation of the asset server. Defaults to being the same as the context ID that was passed in.
Audit Actions
This is the current list of audit actions that could be passed with this method. New audit types could be added to this list at any time, so asset servers should be ready to deal with any unsigned 32-bit number as an audit action.
- 101 - Trade Commit - The request is part of committing a trade. audit_reference is a trade ID.
- 102 - Trade Rollback - The request is part of rolling back a trade. audit_reference is a trade ID.