#LuckyPanda

1 messages · Page 1 of 1 (latest)

tropic spindleBOT
misty mica
#

Hi there, how can I help?

trim relic
#

Can you tell me how to create an immediate invoice just after a subscription is upgraded?

misty mica
#

As per the doc, Stripe will invoice immediately if proration_behavior is set to "always_invoice",

trim relic
#

That's right, But the invoice for proration is attached to the next billing date which means that it is involved in the upcoming invoice.

#

I also set "payment_collection" param to "charge_automatically"

misty mica
#

What's the invoice ID so that I can take a look?

trim relic
#

One sec.

tropic spindleBOT
trim relic
#

ii_1N1MPnHn3Zy4ma8uVdav0fMD
ii_1N3DYMHn3Zy4ma8urvYMesfu

snow fog
#

Both IDs are invoice item ID, not invoice ID (in_xxx). Could you share the invoice ID created after you update the subscription?

trim relic
#

ok, let me send you again

#

one sec

#

DCBA4AD7-0363

#

And I'm working in test mode.

snow fog
trim relic
#

It's in pending invoice now.

#

I think it means that the instance is not created yet?

misty mica
#

Or can you share with me the subscription ID?

trim relic
#

okay okay

#

one sec

#

sub_1N0liPHn3Zy4ma8ufAgi1Ot0

misty mica
#

Thanks, I don't see you've made a update request with proration_behavior set to "always_invoice"

trim relic
#

??

#

But the problem is that I've did it..

misty mica
#

Can you share with me the request ID?

trim relic
#

One sec.

#

So you mean that I didn't update the subscription with proration_behavior set to "always_invoice"?

misty mica
#

You are right.

trim relic
#

Can I share my code with you?

#

I really did it.

misty mica
#

Sure

trim relic
#

okay

#

one sec

#

return this.stripe.subscriptions.create({
customer: customerId,
items,
coupon: coupon || undefined,
collection_method: 'charge_automatically',
proration_behavior: 'always_invoice',
payment_settings: { payment_method_types: ['card'], save_default_payment_method: 'off' },
payment_behavior: 'allow_incomplete', // allow subscription even if payment failed
});

#

This is the code in which I've created that subscription.

misty mica
#

Did you also set proration_behavior: 'always_invoice' when updating the subscription?

trim relic
#

No

#

Should I?

#

And also set "collection_method" to 'charge_automatically'?

#

And all other attributes again?

#

??

#

Hi @misty mica

misty mica
#

You need to specify proration_behavior: 'always_invoice' when updating the subscription

trim relic
#

Thanks, it's working fine for now.
I have one more question. I'm currently using stripe test visa card and is there any way to manage the balances so that I can handle the exception in the case of lack of money in the connected card?