-
-
Save ndimatteo/8229942 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }); | |
| }) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 500 Error: Stripe: I require argument "id", but I got: undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.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