call Stripe API with await

Viewed 4633

I'm trying to call the stripe API within an async method on the server (javascript, using MeteorJS) like so:

selectedPlan = await Stripe.plans.retrieve(stripePlanId);

the stripe API call (using the NodeJS library) has a callback to handle the error, but what syntax could I use to capture the error, if I'm using the await pattern?

tried something like

[error, selectedPlan] = await Stripe.plans.retrieve(stripePlanId);

but that did not work.

1 Answers
Related