#Yashish

1 messages ยท Page 1 of 1 (latest)

autumn locustBOT
jolly cradle
#

Let's chat here, can you give me a quick summary of the issue as well as what you've tried so far?

dawn pelican
#

subscription = subscription.modify(
subscription_id,
proration_behavior='always_invoice',
items=[subscription_item],
payment_behavior='pending_if_incomplete',

    )

in subscription modification
in this can there be any way that we can make the payment statue as open or as drafted

blissful charm
#

๐Ÿ‘‹ hopping in here since hanzo has to head out soon

dawn pelican
#

when we are doing this update stripe tries to make the payment for the update and fails

blissful charm
#

Yes, typically if this is a charge_automatically Subscription the Invoice would be finalized immediately and payment would be attempted

#

Is there a reason you don't want this behavior?

dawn pelican
#

yes

#

`subscription = subscription.modify(
subscription_id,
proration_behavior='always_invoice',
items=[subscription_item],
payment_behavior='pending_if_incomplete',

    )

    subscription = stripe.Subscription.retrieve(subscription_id)

    invoice = stripe.Invoice.retrieve(subscription.latest_invoice, expand=['payment_intent'])

    invoice_url = invoice.hosted_invoice_url

    return redirect(invoice_url)`

I am performing this code and I want the user to do the payment where he is redirected

since user is getting redirect but stripe also tries to do the payment for the update which fails, i don't want strip to do the payment when user tries to update the plan

blissful charm
#

Gotcha! So really the best way to do this would be to use payment_behavior: default_incomplete - if you use that payment won't be attempted automatically and you can manually confirm the underlying payment intent when you want (when you redirect your user)

dawn pelican
#

ook let me try

#

here the payment status is becoming

#

but still the payment for the plan is not done but the plan get change with the status overdue

blissful charm
#

The Subscription is overdue bcause the latest Invoice hasn't been paid - what status were you expecting instead?

dawn pelican
#

until the payment occurs the plan status should not change

blissful charm
#

There's no way to get that behavior - as soon as invoice is finalized for charge_automatically subscriptions we consider the payment to be due

#

The only way around this would be to switch to collection_method: send_invoice which allows you to specify a separate due date that is after finalization

dawn pelican
#

during the update if we specify collection_method: send_invoice
then will it affect the auto-renewal for payment

blissful charm
#

Yes, that will affect the auto renewal -you'd have to change it back to charge_automatically if you want the automatic renewal to happen

dawn pelican
#

`subscription = subscription.modify(
subscription_id,
proration_behavior='always_invoice',
items=[subscription_item],
payment_behavior='default_incomplete',

        collection_method='send_invoice',
        days_until_due=0,
    )

    subscription = stripe.Subscription.retrieve(subscription_id)



    invoice = stripe.Invoice.retrieve(subscription.latest_invoice, expand=['payment_intent'])
    

    invoice_url = invoice.hosted_invoice_url`

here i am unable to get the invoice url

blissful charm
#

It's likely because the Invoice hasn't finalized yet (which is expected with send_invoice Invoices)

#

Have you checked the Invoice's status?

dawn pelican
#

yes it has become

#

but i want to redirect user to the url to do the payment

blissful charm
#

Then you need to finalize the Invoice (which you can do through the API)

dawn pelican
#

how?

autumn locustBOT
blissful charm
dawn pelican
#

let me try

#

days_until_due=0

what does will it exactly work?

#

after finalizing the invoice the user is redirected for the payment but there if the user does not do any payment then

also the plan is getting updated

drowsy parrot
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

Give me a few minutes to get caught up.

#

Can you reframe your question? I don't understand

dawn pelican
dawn pelican
dawn pelican