#jcnguyen_36895_03919
1 messages ยท Page 1 of 1 (latest)
No I don't think so. Why would you want to do that?
because with the existing subscription it wouldn't let me set autoadvance invoice set to false
Hmm how are those related? ๐ค
Btw do you mean to add a negative price amount to an original amount of the first Invoice on a Subscription?
to the second subscription with invoice created
since i can't set autoadvance = false on the first subscription the user ends up auto charged which i don't want
hence of thinking create a new subscription and add the negative price amount that's calculated on previous prorate so it can use "Default_incomplete"
and if the user decide not to take any action on the new subscription the previous subscription remain the same
So you want to somehow credit back the customer
No Subscription doesn't work with minus amount like that
you would want to look at https://stripe.com/docs/invoicing/customer/balance
so credit customer balance on the first subscription and charge them full amount of the second subscription?
No I mean don't create second subscription at all
You create second subscription just to offset the charged amount back to customer, right?
nope
i create second subscription for user who buy another subscription product
and prorate with the first
IE subscription customer pay for $20
then later on decided to subscribe to another product cost them $50
so i want to prorate them the $20 which charges the customer $30 and when the auto renewal comes charge them $50. that's the workflow
I see, you want to kind of offset the $50 amount on the 2nd Subscription. I think negative amount Invoice would help, but my colleague will continue to help you
Hello ๐ I'm caught up and am thinking about your options for doing this with our subscriptions
got it, thanks i just trying to find out what are my options since I can't prevent the original subscription from advancing in the invoice as autopay
hence creating a new subscription with a new product and somehow linking the negative amount calculated from the Previous subscription using upcoming invoice method
So I think the easiest way to do this would be to create a negative invoice item for $20 and then either upgrade the exisitng subscription to your $50 price or delete your old subscription and create a new one at the $50 price
You could also do this via a credit note or discount, but I think the invoice item would be the most direct way
when create a subscription isn't it auto create invoice
how do i create negative invoice item for $20
Use this endpoint and specify a negative amount https://stripe.com/docs/api/invoiceitems/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So you can:
- Create the -$20 invoice item and specify
subscription: sub_123wheresub_123is the ID of your existing subscription - Update your subscription to use the $50 price and specify
proration_behavior: always_invoice
That will immediately generate a $30 invoice for the user to pay from the exisitng subscription
You can also specify payment_behavior=pending_if_incomplete if you want the user to keep their $20 subscription if they fail to pay the new $30 invoice
will that double prorate calculate?
Good point. That proration won't be a clean $50 - $20, it would be based on when in the month you upgraded the subscription
i can ignore the prorate since the invoice already account for -20 correct
It depends on what you want to do.
If you want to keep the billing cycle the same, I think actually you would want to create the negative invoice item and then create a new subscription with that $50 price. You can backdate the start date and set the billing cycle anchor so the cycle still lines up. Then you could listen on whether the user paid the new $30 invoice on this new subscription and if they do you can delete the old subscription
If you want to reset the billing cycle to the current day, you can do the steps I outlined with proration_behavior: none which would try to bill the user for the full amount of the new price minus the negative invoice item.
if an invoice not paid within 24 hours will stripe automatic mark the invoice as cancelled?
so if i go with create a new subscription workflow
- Create new subscription with new price
- Create Invoice Item with prorate calculate from pervious invoice (expect total amount will be $30)
- Send it to User for paid
the starting date of the new subscription will be the createddate
and if the user decides not to pay the new amount the invoice with a new subscription will change to canceled since it passed 24 hr?
and the old subscription remain the same
and if i added invoiceitem to new subscription will it onetime charge or that amount will be on renewal as well
if an invoice not paid within 24 hours will stripe automatic mark the invoice as cancelled?
For the new subscription, yes, I am less sure what would happen when updating the existing subscription.
since i generate a new subscription, i can just cancel the old subscription if the payment of the new one complete correct
- Create new subscription with new price
- Create Invoice Item with prorate calculate from pervious invoice (expect total amount will be $30)
- Send it to User for paid
the starting date of the new subscription will be the createddate
Correct, though you can specifybackdate_start_dateto make the start date the same as the original subscription's current cycle if you want. You can also specifybilling_cycle_anchorto be the end of the current cycle
https://stripe.com/docs/api/subscriptions/create#create_subscription-backdate_start_date
https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_cycle_anchor
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and if i added invoiceitem to new subscription will it onetime charge or that amount will be on renewal as well
It will only be one time, not recurring. So for future months it would just be the $50 price
since i generate a new subscription, i can just cancel the old subscription if the payment of the new one complete correct
Correct
do API let you set subscription status to cancel or only available via dashboard?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes you can cancel via the API
i just tried created negative amount for invoiceitem and attached to the new subscription however i don't see the total get effected?
is it because the invoice of the subscription already finalized?
Can you send me the ID of the subscription? That may be the case.
sub_1NvQHoCixCJn4IR44oTXZskK
requested of invoice item successfully created :req_spelFCJ5qrhLKs
So yes, this happened because the invoice was already finalized. Apologies for my mistake I think we need to swap steps 1 and 2. Create the invoice item, only specifying the customer ID, and then create the subscription. The new invoice should pick up the invoice item and add it to its items
got it let me give it a try
how the new invoice know to attach existing open invoiceitem to this one
Because of the Customer. The invoice items are attached to the customer and new subscriptions will try to use any exisitng invoice items on the Customer.
I did just test this in test mode and it worked for me. Apologies for not testing that suggestion before
no worries
it worked
in_1NvQTgCixCJn4IR4RPFQJl4u
meaning i can't control which invoiceitem it can link to?
here's the new subscription :sub_1NvQTgCixCJn4IR4GJdymWJU
What are you trying to link about the invoice item here?
what i'm trying to get at is i want to control the invoiceitem that i created to a specific invoice that is generated by subscription
this is for the edge case where user request multiple subscription upgrade
Gotcha, that is a good point. Trying to think of whether there is a way to address that.
the only way i can think off is clean up the open invoice when generate a new one
Creating a subscription will automatically do that
the invoice item will only go on one invoice
ok that's good to know
I thought you were talking about something like a bad actor telling you to upgrade two subscriptions at once and manipulating the timing so that one invoice might get two credit notes
i worry that it links to the latest subscritpion since the invoiceitem still open
the scenario which i'm trying to block is user upgrade to subscription B which my service generate a new invoice, then later upgrade to subscription C and my service will generate a new invoice
in this scenario subscription B has invoice item prorate B, and subscription C will has invoice item prorate C
is my understanding correctly>?
I think so yes. The invoice items are one-off and will only be applied to the first subscription you create after creating the invoice item