Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

86
Views
Access variable from inside stripe function

Currently when running this, I get an error saying that lineItems is not defined. How can I get the console.log to work here?

My Code:

await stripe.checkout.sessions.listLineItems(
      session.id,
      { limit: 5 },
      function lineItems(err, lineItems) {
        if (err) {
          console.log(err);
        } else {
          var price = lineItems.data[0].price.id;
        }
        return price;
      }
    );

    const priceId = lineItems();

    // console log price from line items
    console.log(priceId);

Any help is appreciated, thanks!

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!