I am creating a checkout session for a subscription and I sometimes have a coupon ID and sometimes not. I was wondering about the value to which I should set the $coupon_id variable when there is no coupon. Should It be set to 'none' or empty string '' ?
$coupon_id = $ID;
}
else {
$coupon_id = ''; //or 'none' ?
}
$session = \Stripe\Checkout\Session::create([
'payment_method_types' => ['card'],
'line_items' => [[
'price' => $plan_id,
'quantity' => 1,
]],
'mode' => 'subscription',
'discounts' => [[
'coupon' => $coupon_id,
]],
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
]);