Allow users to enter promo code on checkout
Hi Produkt,
The ability to apply discounts depends on the specific payment processor you’re using.
For instance, with Paddle, you can log in to your Paddle billing interface, navigate to the Catalog section, and select Discounts. From there, you can configure the desired discount details.
During checkout, users will have the option to enter the discount code, which will then be applied automatically to their billing.
Hope that helps.
I discovered the answer. Edit wave/src/Http/Livewire/Billing/Checkout.php
:
public function redirectToStripeCheckout(Plan $plan)
{
$stripe = new StripeClient(config('wave.stripe.secret_key'));
$price_id = $this->billing_cycle_selected == 'month' ? $plan->monthly_price_id : $plan->yearly_price_id ?? null;
$checkout_session = $stripe->checkout->sessions->create([
'line_items' => [[
'price' => $price_id,
'quantity' => 1
]],
'metadata' => [
'billable_type' => 'user',
'billable_id' => auth()->user()->id,
'plan_id' => $plan->id,
'billing_cycle' => $this->billing_cycle_selected
],
'mode' => 'subscription',
'success_url' => url('subscription/welcome'),
'cancel_url' => url('settings/subscription'),
'allow_promotion_codes' => true, // add this line
]);















