How to fix empty object when trying to get user data after checkout in Next.js?
I need to get the user id after they checkout for a paid plan so I can put it into my database. I'm using nextjs.
The first console log doesn't log at all. The second logs an empty object.
const membershipSignup = async() => {
try {
// or if using signup modal
await memberstack.openModal("SIGNUP")
// after successful signup, redirect them to the stripe checkout
await memberstack.purchasePlansWithCheckout({
priceId: "prc_membership-xz110otj", // required
})
const data = await memberstack.getCurrentMember()
setMember(data)
console.log(member)
} catch(err) {
displayErrorMessage(err.message) // email already taken, etc.
}
}
console.log(member)
Comments
0 comments
Please sign in to leave a comment.