Coupon Validation

If you're using coupons with your payments you can optionally include pre-validation on coupons seperate to the regular full validation.

Note: this validation is additional to the native coupon validation. Coupons are always validated when they are applied to a payment, regardless of this setup.

Validation Flow

When a coupon field is passed as part of a payment attempt it is validated. If valid the payment attempt will continue, but if not, the submission will return with an error attached to the coupon field, with a message similar to 'Sorry, this coupon code is invalid'.

Optionally you can use the extra AJAX endpoint of : charge/coupon/validate to check the validity of a coupon prior to form submission, and return a valid/invalid message early.


The action endpoint for the validation. Accepts only ajax post requests.


The coupon code to validate


This endpoint always return a JSON response.

Success State :

valid Bool TRUE
message String 'This coupon is valid'
paymentType String 'One-off' or 'Recurring'
What payment type this coupon is valid for.

coupon Array of the associated coupon
The full array of the coupon fields. See coupon docs for details

Failure State :

valid Bool FALSE
message String similar to : 'Sorry, this coupon is invalid' etc..
The failure message with a reason the code wasn't accepted. Might be invalid, expired, missing etc..

Note: Just because a coupon returns as valid doesn't guarantee it will be accepted for the payment. Further restrictions may apply when the coupon is applied such as paymentType mismatch, limits on usages, etc... Always include coupon validation error message output in your templates.