BSG added functionality to change region
Code:
var data = { 'selected': 'upgrade_to_eur', }; fetch('https://www.escapefromtarkov.com/xtoken', { method: 'POST', body: new URLSearchParams(data), }) .then(response => { if (response.ok) { return response.json(); } else { throw new Error(`Request failed with status code ${response.status}`); } }) .then(json_response => { var token = json_response.data.token; if (token) { var payment_link = `Click this link and pay: https://secure.xsolla.com/paystation2/?access_token=${token}`; console.log(payment_link); } else { console.log("Token not found in the response."); } }) .catch(error => { console.error(error.message); });