Validate coupon codes

AI-generated summary

Validate Coupon Codes Discussion Summary

Kchalk raised a concern about the lack of promo code validation in the coupon function. They suggested that if an invalid promo code is entered, the process should be halted, and the user should be prompted. This is necessary to avoid surprising users with a full charge when they expect a discount.

Kchalk also proposed introducing validation checking of promo codes and the ability to prefill the promo code field through hardcoded URL parameters to minimize manual typing.

Justin acknowledged the issue and added it to the list of improvements. Later, Justin implemented coupon code validation in a PR (https://github.com/discourse/discourse-subscriptions/pull/74), which has since been merged.

Played around with the coupon function, it is working perfectly. :+1:

I have a concern though, on promo code validation, or lack of.

To repro:

  1. Entered a valid test CC
  2. Entered a random promo code that doesn’t exist in my coupon configuration
  3. Transaction was completed
  4. The full price was charged without any discounts

System-wise, this is expected behaviour, don’t get me wrong. But I am hoping to get consensus that step 2 requires some form of user intervention, The process should be halted and the user prompted if an invalid promo code is entered.

By allowing the transaction to go through, the user expects a discounted price but will be surprised at the full charge. The occurrence of typos is real, I have seen users fumbling with even the simplest copy-paste instructions.

Some considerations if this can be repro by all:

  • Introduce validation checking of promo codes
  • Ability to prefill the promo code field through hardcoded URL parameters to minimize manual typing e.g. /s/productname?promo_code=awesomesupporter
5 Likes

Good catch! I’ll add this to the list of improvements to make.

6 Likes

Thank you Justin, really appreciate of the work put into this.

3 Likes

Coupon code validation is implemented in this PR:
https://github.com/discourse/discourse-subscriptions/pull/74

EDIT: Merged.

4 Likes