Define a coupon with a 90% discount and a limited number of redemptions.
Apply the coupon and then purchase the course. The result in Stripe is that the coupon has been redeemed twice. The second redemption occurs in success_stripe_url (the callback after a successful payment). I think the first redemption is happening in the session checkout (POST /v1/payment_pages/...). Not sure if this is a change in the underlying Stripe library.
A side effect of this is that if there is only 1 redemption left before the purchase, the purchase will succeed but the test for a valid coupon in success_stripe_url will fail and thus the user is redirected back to the enrol page without completing the enrollment. If the solution to the double redemption is to remove the second redemption from success_stripe_url() then this test will also need to be considered.
Reproduced with version 3.4.4.
Define a coupon with a 90% discount and a limited number of redemptions.
Apply the coupon and then purchase the course. The result in Stripe is that the coupon has been redeemed twice. The second redemption occurs in success_stripe_url (the callback after a successful payment). I think the first redemption is happening in the session checkout (POST /v1/payment_pages/...). Not sure if this is a change in the underlying Stripe library.
A side effect of this is that if there is only 1 redemption left before the purchase, the purchase will succeed but the test for a valid coupon in success_stripe_url will fail and thus the user is redirected back to the enrol page without completing the enrollment. If the solution to the double redemption is to remove the second redemption from success_stripe_url() then this test will also need to be considered.