#ylang-ylang_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1282946506650947586
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- ylang-ylang_best-practices, 22 hours ago, 35 messages
What do you mean by "manual proration " ?
I meant creating prorations using internal business logic, like documented here
https://docs.stripe.com/billing/subscriptions/prorations#manually-creating-your-own-prorations
Also I just realised there's an error in the code sample i gave above, amount in invoice_items should be -ve for manual proration to work. Here's the updated code
def upgrade_subscription():
...
resp = stripe.Subscription.modify(
subscription_id,
items=[
...
],
proration_behavior='none',
payment_behavior='pending_if_incomplete',
add_invoice_items=[
{
'price_data': {
'currency': 'usd',
'product': product_id,
'unit_amount': -500,
}
}
],
)
OK. add_invoice_items is one of the supported attribute for pending updates https://docs.stripe.com/billing/subscriptions/pending-updates-reference#supported-attributes . Have you tried it?
Yes, I've tried it. As mentioned in the code posted above
What's the subscription ID?
I've finished the test clock a while ago, let me recreate it
Here's the subscription id sub_1PxNfzHxoLyKoVBRzaTODeLG
Description of invoices:
2nd invoice generated and paid automatically for oct month
3rd invoice generated after upgrading plan to $38 plan (manually computed prorate charge was $19)
Isn't the 3rd invoice paid successfully?
Yes I manually confirmed the payment. My issue is, up until I don't pay the invoice, I do not want subscription to update, right now subscription automatically updates to new plan price
No, that invoice was paid automatically. I don't see any request to pay this invoice manually.
I did pay it manually
What's the ID of the invoice that you are looking at?
Id is in_1PxNlBHxoLyKoVBRasrpCr6L
Also, here's how i created invoice after subscription update
invoice = stripe.Invoice.create(
auto_advance=True,
subscription=subscription_id,
collection_method='send_invoice',
customer=customer_id,
description='Pending upgrade charge',
days_until_due=1,
)
No, that's not the invoice created by the subscription, it's the invoice created by yourself.
That's not how pending updates work.
https://docs.stripe.com/billing/subscriptions/pending-updates I'd recommend you go though this page to get a better understanding of pending updates
So coming back to my question, how to use pending_if_incomplete payment_behavior with manual proration?
Hmm? I though you already did it ? no?