I seem to be encountering an issue with the stripe.customers.create
. My goal is to create a new Stripe customer using the email address of the current user, and then update my user with the generated customer.id
.
Despite the fact that stripe.customers.create
returns a promise, I am not seeing any activity within the then
or catch
blocks. The creation of the Stripe customer appears to be unsuccessful, and it seems like the API call to Stripe is not being made at all.
stripe.customers.create({
email: state.getters.currentUser.email
})
.then(customer => {
console.log("Promise resolved");
console.log(`Customer ID: ${customer.id}`);
if (customer.email === state.getters.currentUser.email) {
state.dispatch("updateUserProperty", {
customerId: customer.id
});
}
})
.catch(err => {
console.log("Promise error");
console.error(err);
});
I also attempted another method without success:
async () => {
const params: Stripe.CustomerCreateParams = {
email: state.getters.currentUser.email
};
const customer: Stripe.Customer = await stripe.customers.create(params);
console.log(customer.id);
};
My approach involves using https://github.com/stripe/stripe-node, and no errors or warnings have been triggered. The value of state.getters.currentUser.email
is correct.
Can you point out what may be missing here? Your assistance is greatly appreciated. Thank you.