#jcnguyen_36895_03919

1 messages ยท Page 1 of 1 (latest)

quiet pecanBOT
fallow agate
#

No I don't think so. Why would you want to do that?

scenic orbit
#

because with the existing subscription it wouldn't let me set autoadvance invoice set to false

fallow agate
#

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?

scenic orbit
#

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

fallow agate
#

So you want to somehow credit back the customer

#

No Subscription doesn't work with minus amount like that

scenic orbit
#

so credit customer balance on the first subscription and charge them full amount of the second subscription?

fallow agate
#

No I mean don't create second subscription at all

#

You create second subscription just to offset the charged amount back to customer, right?

scenic orbit
#

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

quiet pecanBOT
fallow agate
#

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

lyric python
#

Hello ๐Ÿ‘‹ I'm caught up and am thinking about your options for doing this with our subscriptions

scenic orbit
#

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

lyric python
#

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

scenic orbit
#

when create a subscription isn't it auto create invoice

#

how do i create negative invoice item for $20

lyric python
#

So you can:

  1. Create the -$20 invoice item and specify subscription: sub_123 where sub_123 is the ID of your existing subscription
  2. 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

scenic orbit
#

will that double prorate calculate?

lyric python
#

Good point. That proration won't be a clean $50 - $20, it would be based on when in the month you upgraded the subscription

scenic orbit
#

i can ignore the prorate since the invoice already account for -20 correct

lyric python
#

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.

scenic orbit
#

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

  1. Create new subscription with new price
  2. Create Invoice Item with prorate calculate from pervious invoice (expect total amount will be $30)
  3. 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

lyric python
#

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.

scenic orbit
#

since i generate a new subscription, i can just cancel the old subscription if the payment of the new one complete correct

lyric python
#
  1. Create new subscription with new price
  2. Create Invoice Item with prorate calculate from pervious invoice (expect total amount will be $30)
  3. Send it to User for paid
    the starting date of the new subscription will be the createddate
    Correct, though you can specify backdate_start_date to make the start date the same as the original subscription's current cycle if you want. You can also specify billing_cycle_anchor to 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
#

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

scenic orbit
#

do API let you set subscription status to cancel or only available via dashboard?

lyric python
#

Yes you can cancel via the API

scenic orbit
#

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?

lyric python
#

Can you send me the ID of the subscription? That may be the case.

scenic orbit
#

sub_1NvQHoCixCJn4IR44oTXZskK

#

requested of invoice item successfully created :req_spelFCJ5qrhLKs

lyric python
#

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

scenic orbit
#

got it let me give it a try

#

how the new invoice know to attach existing open invoiceitem to this one

lyric python
#

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

scenic orbit
#

no worries

#

it worked

#

in_1NvQTgCixCJn4IR4RPFQJl4u

#

meaning i can't control which invoiceitem it can link to?

#

here's the new subscription :sub_1NvQTgCixCJn4IR4GJdymWJU

lyric python
#

What are you trying to link about the invoice item here?

scenic orbit
#

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

lyric python
#

Gotcha, that is a good point. Trying to think of whether there is a way to address that.

scenic orbit
#

the only way i can think off is clean up the open invoice when generate a new one

lyric python
#

Creating a subscription will automatically do that

#

the invoice item will only go on one invoice

scenic orbit
#

ok that's good to know

lyric python
#

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

scenic orbit
#

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>?

lyric python
#

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

scenic orbit
#

sound good

#

thanks