#jossy-subscription-proration
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ we can pick up the conversation here. How can I help?
Hello
I have a problem with automatic payment even if subscription has "always_invoice" proration behavior
May I describe more detailed what flow I want to achive ?
Sure
I want charge additionally user for each invite he sends. For example: User has subscription for 60$/month each invite is 8$/month which means user should pay 68$/month if he invited 1 user.
- How should I properly handle such logic? Should I create new product or something like that?
- How to fix problem with automatic payment after subscription update? I have set proration behavior to "always_invoice" already
When do you want the user to pay in regards to the billing cycle? This sounds like a good fit for a usage-based billing (metered products), where you report usage to us as appropriate and the user is billed at the end of the billing period based on the amount of usage.
https://stripe.com/docs/billing/subscriptions/usage-based
No, I don't think this billing model suits me
I want this paid invite to be as a subscription item
But as I saw I'm getting this error If i try to add one more invite
Cannot add multiple subscription items with the same plan: price_1NXhFxKwhjmH7xPxDaZnxDSP
If the Price is already on the Subscription, then you would change its quantity rather than adding the Price again.
Okay, I'll try now
What about second question ? Is there any ideas how to prevent auto payment of new subscripiton item ?
Can you clarify what that means? If you set the proration_behavior to always_invoice, then it is expected for that update to create a new Invoice. Is that still what you're after, you just don't want that Invoice to be immediately paid?
Yes, I want to complete payment manually where user can enter their card. Like in payment intent flow
I'm starting to think Subscriptions may not be a good fit for this use case. What part of the price that you want to charge is expected to be recurring?
If invite subscription (8$/month) was submitted in the middle of the main subscription(60$/month), I want to charge 4$ and on the next billing date 60$ + 8$
Something like that
Gotcha. Setting proration_behavior to create_prorations is the closest thing we have for that, but the way that works the $4 proration is charged to the customer on the next Invoice when the billing cycle ends.
If you want to immediately charge the customer for the prorated amount, then you will need to set proration_behavior to none, and build a separate flow that you direct your customer to where a one-time payment is created and processed.
Okay, so I do smth like this?
`var subscriptionUpdateOptions = new SubscriptionUpdateOptions()
{
Items = new List<SubscriptionItemOptions>()
{
new SubscriptionItemOptions()
{
Id = subscriptionItem.Id,
Deleted = false,
Quantity = 1,
}
},
ProrationBehavior = "none",
PaymentBehavior = "default_incomplete"
};
var updatedSubscription = await subscriptionService.UpdateAsync(subscription.Id, subscriptionUpdateOptions);`
Then I create a one-time payment using payment-intent ?
updated code
No, you'll set . Yes. But afterwards yes, you would create a one-off Payment Intent (or an Invoice if that is preferred) to handle collecting the payment. (edited for the code revision)proration_behavior to none, no need to provide payment_behavior
๐ taking over
Reading over the earlier convo I'm not sure I follow why you would have to do a separate flow
@hollow quiver wouldn't https://stripe.com/docs/billing/subscriptions/pending-updates be the right fit here?
I have also one more issue
Am I misremembering that always_invoice changes billing cycle anchors? I was getting the impression that was not desired.
It definitely does not change the billing cycle at all
Cannot add multiple subscription items with the same plan: price_1NXhFxKwhjmH7xPxDaZnxDSP - this is the error I got
@slow plank you have to modify the existing SubscriptionItem, not add the Price again
so you have a Subscription and it has one SubscriptionItem si_123 on Price price_A and then you update that SubscriptionItem and change its quantity to 2 or 3 or 10
jossy-subscription-proration
Ok
So to answer the earlier point, I do think all you want is proration_behavior: 'always_invoice' if you want to charge them for the price difference. https://stripe.com/docs/billing/subscriptions/prorations is a good place to start
Okay, I think it will work, but I need to test it. I will do it tommorow, if I have questions I will ask to open this thread once more
Thank you guys
We won't open this thread again but you can ask a new question with context and then we'll help in a new thread ๐