Skip to content

Instantly share code, notes, and snippets.

@ndimatteo
Last active January 2, 2016 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndimatteo/8229942 to your computer and use it in GitHub Desktop.
Save ndimatteo/8229942 to your computer and use it in GitHub Desktop.
app.get('/check-coupon', function(req, res, next) {
stripe.coupons.retrieve(req.body.coupon, function(err, coupon) {
if (err) return res.json({ valid: false });
res.json({ valid: true });
})
})
500 Error: Stripe: I require argument "id", but I got: undefined
$('.apply button').click(function() {
$.getJSON('/check-coupon', {
coupon: $('#coupon').val()
}, function(data) {
if (!data.valid) {
alert('invalid!');
} else {
alert('SUCCESS!');
}
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment