Purshase API NEED HELP [UNSOLVED]

When using purcahse api get this json returned 

{"purchased":false,"reason":"InvalidTransaction","productId":28642482,"statusCode":500,"title":"Invalid Transaction","errorMsg":"An error occured while processing this transaction. No Robux have been removed from your account.","showDivId":"TransactionFailureView","shortfallPrice":-100,"balanceAfterSale":100,"expectedPrice":0,"currency":1,"price":2,"assetId":308414014}

how do i fix this and what does this error mean

Code:


async function BuyItem() {

  const data = {
    'expectedSellerId': 1408999290,
    'expectedCurrency': 1,
   ' expectedPrice': 4,
  };

  const Purchase = await fetch(`https://economy.roblox.com/v1/purchases/products/${ID}`, {
    method: 'POST',
    headers: {
      "cookie": `.ROBLOSECURITY=${cookie}`,
      "x-csrf-token": token,
      "Content-Type": "application/json"
    },
    body: JSON.stringify(data)
  });
  
  if (Purchase.status === 200) {
    console.log(await Purchase.text())
  } else {
    console.error(await Purchase.text());
  }
}

try posting the actual code if you are looking for help

1 Like
async function BuyItem() {

  const data = {
    'expectedSellerId': 1408999290,
    'expectedCurrency': 1,
   ' expectedPrice': 4,
  };

  const Purchase = await fetch(`https://economy.roblox.com/v1/purchases/products/${ID}`, {
    method: 'POST',
    headers: {
      "cookie": `.ROBLOSECURITY=${cookie}`,
      "x-csrf-token": token,
      "Content-Type": "application/json"
    },
    body: JSON.stringify(data)
  });
  
  if (Purchase.status === 200) {
    console.log(await Purchase.text())
  } else {
    console.error(await Purchase.text());
  }
}

Still need help (please Iā€™m desperate)

Are you continiously gettings this error, even after waiting a few hours before trying again? When searching for the status code, 500, it says that it is when something went wrong on the server but the server does not know where.