This starts a transaction on behalf of a user for the items specified.
Implementations should call
ISteamMicroTxn/InitTxn to have Steam setup the transaction and obtain a forwarding URL.
Called by: Web Purchasing
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 asset. |
steamid | uint64 | ✔ | 64bit Steam ID of the user to setup a transaction for. |
language | string | ✔ | ISO639-1 language code plus ISO 3166-1 alpha 2 country code of the language to return strings in. Some examples include en_US, de_DE, zh_CN, and ko_KR. Default: en_US |
asset[n] | string | ✔ | A string representing an item the user wishes to buy. This can be an item definition index, item name, or any other unique representation the game wishes to use. n is a 0-based index and there will be one for each item the user wishes to buy. The value should match the value of the name parameter of GetAssetPrices and is the same string the user passes in to the buyitem URL. |
quantity[n] | uint32 | | An optional unsigned integer specifying the quantity the user wants to purchase for the n'th item. If the parameter is missing for any of the items being purchased, a value of one should be assumed. |
currency | string | ✔ | ISO 4217 currency code to use for the transaction. |
ipaddress | string | ✔ | The user's IP address as a string. The IP address is expected to match the IP address that accesses the forwarding URL and is expected to remain the same throughout the transaction. |
referrer | string | | An optional string containing the URL that referred the user to the transaction. |
sandbox | uint32 | | Non-zero if this transaction will use the microtransaction "sandbox" which will not deduct funds from the user's wallet. In this case you should call ISteamMicroTxnSandbox/InitTxn, instead of ISteamMicroTxn/InitTxn. See Microtransactions Implementation Guide for more details. |
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.
-
displaytext
- an optional localized error message to display to the user.
-
url
- the URL to forward the user to where the transaction will be continued. The URL
should be amended with a returnurl parameter which specifies where to forward the user after he or she
authorizes the transaction. This URL should be the one that ultimately calls
FinalizeWebAssetTransaction
. The value of the returnurl parameter should also contain the
transaction ID as it will be needed when calling FinalizeWebAssetTransaction
.
Additionally, a cancelledurl parameter may also be specified which indicates where to take the user if
he or she clicks cancel instead of authorizing the transaction.
-
txnid
- the transaction ID as was posted to the orderid
parameter of
InitTxn
.
Example Output
{
"result": {
"success": true,
"url": "https://store.steampowered.com/checkout/approvetxn/229984771771125/",
"txnid": "72"
}
}