#user5469
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Can you share the example subscription ID where you're seeing prorations?
Hi hanzo, here's the test subscription ID: sub_1NTuvkHK8QnjuqRNOLl5an6D
Also, I have the log ID if you would like that as well
HI ๐
I'm stepping in as @wicked palm needs to go. Give me a minute to take a look at this
I'm still reviewing the subscription but just one quick note about the proration_behavior field when creating Subscriptions. It's intended to account for any proration that may occur from setting the billing_cycle_anchor to a date different from the date of the subscription. It doesn't look like you passed a billing_cycle_anchor parameter when you created the subscription you shared here
https://dashboard.stripe.com/test/logs/req_3xXl9xUyKV85TJ
I did not pass the billing_cycle_anchor because it should be the date when a user upgrades/downgrades. My use case: user purchased an annual subscription for $100 and then after a few months they want to upgrade to the $200/yr annual plan. During the upgrade step, the user should be charged $200 and for renewals, the "Invoice credit balance" should be used (I believe this is done by Stripe itself).
But this subscription has only been created, there is no update request made. So can you clarify where you are seeing the behavior you don't expect?
From the previous example, when user upgrades to a new subscription, we will remove the old subscription and prorate the leftover period. Now for the new subscription, we do not want the prorate to be included in the price, user should be charged the full price and credits can be used during renewals
Okay, do you have an API request that you can share where this behavior occurred?
By new/old subscrpition do you mean you are changing the Price object or creating/deleting the subscription entirely?
creating/deleting the subscription entirely
Subscription deleted via: const deleted = await stripe.subscriptions.del(id, {
prorate: true,
});
And why wouldn't you simply upgrade/downgrade the subscription object? https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
New subscription created:
input -
{
"items": {
"0": {
"price": "price_1LDFrXHK8QnjuqRNTmRzpao5"
}
},
"customer": "cus_OGQW3aFdmZvAs8",
"payment_behavior": "default_incomplete",
"payment_settings": {
"save_default_payment_method": "on_subscription"
},
"proration_behavior": "none",
"coupon": "",
"expand": {
"0": "latest_invoice.payment_intent"
}
}
stripe.subscriptions.create(input);
Okay but there is no proroation occurring because you are creating a new subscription. I don't understand what you expect to be occurring
Yes but when the new subscription is created (sub_1NTuvkHK8QnjuqRNOLl5an6D), the "amount_due" is $0 and instead of charging the user through: const paymentResult = await stripe.confirmPayment({
elements,
clientSecret,
redirect: "if_required",
confirmParams: {
payment_method_data: {
billing_details: value,
}
}
});
the user is automatically charged with his credits
That will always happen if the user has credits
Because your approach is creating credits
You would have more control if you modifying the existing Susbcription instead
Ah got it, thanks! I just wanted to check if there was a way to skip credits being applied during payment process
You could try to zero them out by making an adjustment to customer balance: https://stripe.com/docs/api/customer_balance_transactions
Oh good to know, for now, I think if I set prorate to false that should solve the issue
const deleted = await stripe.subscriptions.del(id, {
prorate: false,
});