vivawallet-payment
Version:
viva wallet payment gateway for react
20 lines (19 loc) • 553 B
text/typescript
function RedirectFunction(url:string,authorization:string){
const result = fetch(url, {
method: 'POST',
headers:{
"Content-Type":"application/x-www-form-urlencoded",
"Authorization":authorization,
},
body: 'grant_type=client_credentials',
})
.then(async (response) => {
const responseData = await response.json();
return responseData.access_token;
})
.catch((error) => {
return 'Viva Wallet Authorization Error';
});
return result;
}
export { RedirectFunction };