how can i call result of javascript function into another javascript function “Hosted Checkout Integration”
i want call from this function “sessionId”
function getSessionID(){
axios({
method: 'POST',
url: 'https://banquemisr.gateway.mastercard.com/api/rest/version/61/merchant/xxxxx_xxx/session',
data: JSON.stringify({
apiOperation: 'CREATE_CHECKOUT_SESSION',
interaction: {
operation : "PURCHASE",
},
order : {
amount: function() {
//Dynamic calculation of amount
return realAmount + commission;
},
currency: "EGP",
description : "Ordered goods",
id: idValue,
},
}),
auth: {
username: "merchant.xxxx_xxx",
password: "xxxxxxxxxxxxxxxxxxxxxxxxx"
},
crossOrigin: null,
}).then(function (response) {
console.log('Authenticated');
localStorage.setItem('sessionId',response.data.session.id)
});
into this function
Checkout.configure({
session: {
id : sessionId;
},
interaction: {
operation : "PURCHASE",
merchant: {
name: "xxxxx_xxx",
address: {
line1: clientAddress1,
line2: clientAddress2
}
}
}
});
i try to get it by
return getSessionID()
but not words , any Thoughts