Buy Listings
Purchase a marketplace listing on behalf of an authorized user. Balance is deducted from the user and the seller is credited.
POST /api/oauth/listings/buy
Request
fetch("https://omegacases.com/api/oauth/listings/buy", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
token: "user_token_here",
listing_id: "uuid-of-listing"
})
})Success response
{
"ok": true,
"item_name": "Dragon Claw",
"price": 12.50,
"new_balance": 37.50
}Error responses
{ "error": "Invalid or revoked token" } // 401
{ "error": "Token does not have buy_listing scope" } // 403
{ "error": "Listing not found or already sold" } // 404
{ "error": "Cannot buy your own listing" } // 400
{ "error": "Insufficient balance" } // 402Getting listing IDs
Fetch active listings from the public API to get listing_id values:
Fetch listings
const res = await fetch("https://omegacases.com/api/listings?limit=24&page=0")
const { listings } = await res.json()
// listings[0].id is the listing_id to pass