#user5469

1 messages ยท Page 1 of 1 (latest)

misty daggerBOT
wicked palm
#

Hello ๐Ÿ‘‹
Can you share the example subscription ID where you're seeing prorations?

misty daggerBOT
tired horizon
#

Hi hanzo, here's the test subscription ID: sub_1NTuvkHK8QnjuqRNOLl5an6D

#

Also, I have the log ID if you would like that as well

lapis void
#

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

tired horizon
#

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).

lapis void
#

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?

tired horizon
#

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

lapis void
#

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?

tired horizon
#

creating/deleting the subscription entirely

#

Subscription deleted via: const deleted = await stripe.subscriptions.del(id, {
prorate: true,
});

lapis void
tired horizon
#

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);

lapis void
#

Okay but there is no proroation occurring because you are creating a new subscription. I don't understand what you expect to be occurring

tired horizon
#

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

lapis void
#

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

tired horizon
#

Ah got it, thanks! I just wanted to check if there was a way to skip credits being applied during payment process

lapis void
tired horizon
#

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,
});