It looks like you're new here. If you want to get involved, click one of these buttons!
function checkOrderStatus(orderId) {
const urlEndPoint = orderUrl + "/" + orderId;
const response = UrlFetchApp.fetch(urlEndPoint, {
method: "GET",
headers: {
"Authorization": "token " + apiKey + ":" + accessToken
}
});
return JSON.parse(response.getContentText()).status;
}
Hence it is better to fetch order and check before confirming that order is modified or not.
If the new value is not visible in the fetch order response then the rejection reason is in the
status_message
of the order response.