Reputation: 35
Hi theres error on paypal for react native. I got this code from a documentation for paypal-react-native. The code is not working for some reason Here is the Code
const {
nonce,
payerId,
email,
firstName,
lastName,
phone
} = await requestOneTimePayment(
token,
{
amount: '5',
currency: 'GBP',
shippingAddressRequired: false,
userAction: 'commit',
intent: 'authorize',
}
);
Upvotes: 1
Views: 872
Reputation: 91
await
is a promise that you are returning a value, and the rest of your code will not run until it has completed.
It can only be used within asynchronous functions.
async function asyncCall() {
console.log('calling');
const result = await resolveAfter2Seconds();
console.log(result);
// expected output: "resolved"
}
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
Upvotes: 1