cashier-paddle: Coupon Code is not applied when using "withCoupon()"?
- Cashier Paddle Version: 1.0.0-beta
- Laravel Version: 7.13.0
- PHP Version: 7.4.5
- Database Driver & Version: MySQL 5.7
Description:
I’m trying to apply a coupon to a pay link by using the SubscriptionBuilder and the withCoupon()-method.
In my app, the checkout process looks like this:
- User selects a planfrom a list of plans and adds an optional coupon code and submits the form
- Controller builds PayLink and redirects user to Paddle (I’m not using the inline Checkout right now)
- User completes checkout on Paddle and is redirected back to the app
However, the coupon code doesn’t seem to be applied. The price is not reduced and the user still has the option to add the coupon again by clicking “Add Coupon”. (The coupon is valid as it’s being applied when doing on paddle.com)
While debugging I’ve seen, that the coupon is available during the buildPayload-method call. The value is also still present before calling Cashier::post() here
I have the problem both with “Checkout” and “Product” Coupons.
Steps To Reproduce:
Build a paylink by using withCoupon().
$payLink = $user->newSubscription('default', $paddlePlanId)
->returnTo(route('home'))
->withCoupon('NAME-OF-COUPON')
->create();
return redirect($payLink);
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (10 by maintainers)
Hi @stefanzweifel, there is a known issue with checkout coupons and the pay link API that cashier makes use of. As Dries has mentioned, there shouldn’t be an issue with product coupons so we’d encourage you to use them for the time being.
I’ve added this thread to our bug tracker and will endeavour to keep you updated when a fix is pushed out.
@driesvints(and anyone else following this), I pushed a fix for checkout coupons today so they will now work for checkouts generated with the pay link API. Sorry it took a little while to get out!
@stefanzweifel glad you found a fix 👍
I’m gonna leave this open a while longer to follow up until Paddle has fixed checkout coupons.
Further down at subscriptions it also notes: