Response received:errorCode":"INTERNAL_SERVER_ERROR-internalErrorCode RS-9005

function placeOrder(row) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

// Validate the row number before proceeding
if (!row || row <= 0) {
Logger.log(Invalid row number: ${row});
return;
}

Logger.log(Row number provided: ${row});

const data = sheet.getRange(row, 1, 1, 8).getValues()[0]; // Fetch data from the selected row
Logger.log(Data fetched from the sheet: ${JSON.stringify(data)});

const stockCode = data[1]; // e.g., ā€˜NSE:RELIANCE’ or ā€˜BOM:506879’
const orderType = data[3]; // LIMIT or MARKET
const transactionType = data[4]; // BUY or SELL
const quantity = data[5];
const price = data[6];

const [exchange, tradingSymbol] = stockCode.split(ā€˜:’);
Logger.log(Stock Code: ${stockCode}, Exchange: ${exchange}, Trading Symbol: ${tradingSymbol});

const apiUrl = ā€˜https://api.dhan.co/orders’;
const accessToken = ā€˜eyJ0eXAiOiJKV1QiLCJhbGcUxMiJ9.eyJpc3MiOiJkaGFuIiwicGFydG5lcklkIjoiIiwiZXhwIjoxNzI5NTg4NzkwLCJ0NvbnN1bWVyVHlwZSI6IlNFTEYiLCJ3ZWJob29rVXJsIjoiIiwiZGhhbkNsaWVudElkIjoiMTAwMDY3Nzk3MiJ9.sAhBe_AT2p’;
const clientId = ā€˜12345678’;

const payload = {
dhanClientId: clientId,
correlationId: ${new Date().getTime()},
transactionType: transactionType.toUpperCase(),
exchangeSegment: exchange === ā€œNSEā€ ? ā€œNSE_EQā€ : ā€œBSE_EQā€,
productType: ā€œCNCā€,
orderType: orderType,
validity: ā€œDAYā€,
tradingSymbol: tradingSymbol,
quantity: quantity,
price: orderType === ā€˜LIMIT’ ? price : undefined,
};

Logger.log(Payload being sent: ${JSON.stringify(payload)});

const options = {
method: ā€˜POST’,
headers: {
ā€˜Accept’: ā€˜application/json’,
ā€˜Content-Type’: ā€˜application/json’,
ā€˜access-token’: accessToken,
},
payload: JSON.stringify(payload),
muteHttpExceptions: true,
};

try {
const response = UrlFetchApp.fetch(apiUrl, options);
const result = JSON.parse(response.getContentText());
Logger.log(Response received: ${response.getContentText()});

if (response.getResponseCode() === 200) {
  Logger.log(`Order placed successfully: ${JSON.stringify(result)}`);
} else {
  Logger.log(`Error placing order: ${result.message}`);
}

} catch (error) {
Logger.log(Request failed: ${error.toString()});
}
}
function testPlaceOrder() {
placeOrder(2); // Replace ā€˜2’ with the row number you want to test
}

i have added this in Google Apsscript , While placing Order Getting below Error

Response received: {ā€œerrorCodeā€:ā€œINTERNAL_SERVER_ERRORā€,ā€œhttpStatusā€:ā€œINTERNAL_SERVER_ERRORā€,ā€œinternalErrorCodeā€:ā€œRS-9005ā€,ā€œinternalErrorMessageā€:null}

Please guide if any mistake