I have a separate file created to facilitate stripe-based functions called stripe.js.
In this file I want to create a function that retrieves session object, so I initialize stripe with my test key and create function that I export as so:
const stripe = require('stripe')('my_stripe_key_here');
export async function obtainSession(sid) {
return await stripe.checkout.sessions.retrieve(sid);
}
Now in the App.vue I first import the function and try to use it:
import { obtainSession } from "./stripe/stripe";
let session = obtainSession(this.session_id)
.then(session=> {
return session
});
console.log(session)
And all I get is a pending promise in the console (Promise < pending >)
I've tried for a few days and tested different approaches from stackoverflow and elsewhere but I cannot seem to get this promise resolved. I am using a valid and existing session ID with no result.
Can anybody tell me what's the problem? Thanks!
question from:
https://stackoverflow.com/questions/65921241/stripe-promise-pending-even-though-its-async-await 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…