Using the checkout via the stripe-php SDK I have a standard annual membership for my site that costs $100 per year. If I sign up 26 March 2024, it will auto renew on 26 March 2025 as expected.
I am required to change the billing schedule to calendar year so 1 Jan to 31 Dec.
I am aware that I can set the billing_cycle_anchor to 31 Jan 2025. However, this introduces proration_behavior which is either always or none.
Always - prorates, so if I sign up 26 March, it will charge me $77 and invoice me at the full rate on 31 January 2025. None - price is $0 today and don't have to pay until 31 Jan 2025, so almost a whole year of inadvertent free membership.
$nextYear = date('Y') + 1;
$checkout_params = [
'line_items' => [
[
'price' => $prices->data[0]->id,
'quantity' => 1,
],
],
'mode' => 'subscription',
'success_url' => $success_url . '?success=true&session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => $return_url,
'customer_email' => $email,
'subscription_data' => [
'billing_cycle_anchor' => strtotime("{$nextYear}-01-01"),
'proration_behaviour' => 'none',
]
];
$checkout_session = \Stripe\Checkout\Session::create($checkout_params);
Desired Outcome
I do not wish to prorate, if someone signs up today (26 March) I want them to be billed $100 (the full cost of the annual subscription). Then again on the billing period. Is this possible in Stripe?
You can use
paymentmode checkout session to charge your customer for an ad-hoc $100 membership (remember to set setup_future_usage to save the payment method used in this payment), and create a subscription schedule to start the subscription on 1 Jan next year.