Async/await help, please

Hi Annie,

you are actually right on with the required solution.

Technically: Every asynchronous operation that returns a Promise can be ‘awaited’.

Your payNow function looks like it returns a Promise (because you also wait for it with .then({execute things here after operation completes}). Wix Data operations also return promises. So, if you wanted to make it super simple with async/await you could do something like:

function doEverything() {
  const paymentResult = await payNow();
  await wixData.insert(...);
  wixLocation.to('/');
}

I hope this helps!