Listing prices will be returned in USD, which the game is responsible for converting to price in virtual currency using the known rate of their virtual currency to USD.
Buy a listed item
When the player selects a listing they'd like to purchase, we can call the /purchase endpoint on the listing.
// The id of the listing the player selected to purchaseconstlistingId="068e3ff0-5db2-41dc-9b14-a3a0dce108e5"// Construct details of the purchaseconstpurchaseDetails= {"playerId":"f4e5d3a4-2a9b-4d9f-bc5a-73b3f0c47b5e",// The player purchasing the listing"version":1,// The version of the listing, to ensure it hasn't changed"mythToUSD":0.33// Will be checked to see if rate has deviated too far since listing was viewed}// The players VC will be deducted and the marketplace purchase will occurconstpurchaseRespose=awaitfetch(`/v1/listings/${listingId}/purchase`, { method:'POST', headers: {"Content-Type":"application/json" }, body:JSON.stringify(purchaseDetails),});// Successful response means the purchase is initiatedconst { traceId } =awaitpurchaseRespose.json();// TraceId can be fetched to check stateconsttraceResponse=awaitfetch('/trace/{id}', { method:'GET', headers: {},});const { state } =awaittraceResponse.json();// Handle stateswitch(state) {// ...}