#anthonyg-node-error
1 messages · Page 1 of 1 (latest)
https://stripe.com/docs/api/errors has an example in each language, what part is not working?
@fiery scroll if you want to share some code you have I can likely help
@fiery scroll did you find what you needed?
'sk_test_4eC39HqLyjWDarjtT1zdp7dc',
{
apiVersion: '2020-08-27',
}
);
(async () => {
try {
let customer = await stripe.customers.create({
description: 'description',
name: 'name',
email: 'bademail',
metadata: {
user_id: '123',
},
});
console.log(customer);
} catch (e) {
switch (e.type) {
case 'StripeCardError':
// A declined card error
console.log("StripeCardError - Error message: ", e.message);
break;
case 'StripeInvalidRequestError':
console.log("StripeInvalidRequestError - Error message: ", e.message);
break;
default:
console.log("Unknown error - ", e);
break;
}
}
})();``` for example is a good start (it rejects with invalid email)
Thanks for sending this, and sorry about the lapse in response here. Had a few urgent things come up that took me away from what I was doing here. This is what I was doing. I've gotta check if the error I was getting was a stripe function call error. Might not have been, but pretty sure it was.