I am using "paypal-adaptive" for implementing paypal preapproval.(https://www.npmjs.com/package/paypal-adaptive). what i have is:
export const paypalPreapproval = async () => {
let result = null;
await paypalSdk.preapproval(payload, function (err, response) {
if (err) {
console.log("err......", err);
} else {
console.log("response....", response);----->here i getting the response
if (response.preapprovalUrl) {
result = response;
return result;
}
}
});
console.log("result", result); ---->But here it is null
};
How do i get the response here?It is my server side i need to return this result to client side so how i get the response here? where i went wrong?How can i solve this issue?