#tymm

1 messages · Page 1 of 1 (latest)

fickle wyvernBOT
minor lintel
#
toUpdateItem.update(
                    SubscriptionItemUpdateParams.builder()
                            .setProrationBehavior(SubscriptionItemUpdateParams.ProrationBehavior.ALWAYS_INVOICE)
                            .setPrice(newPrice.getId())
                            .build()
            );
#

this is how i update the subscriptionitem, i want to be able to pay for the paymentintent manually, in the invoice finalized callback

fast orbit
#

By setting proration_behaviour to create_prorations, it will be paid in the next invoice unless billing period changes or the subscription doesn't require payment.

#

Hmm..

minor lintel
#

i want the customer to pay now, but not automatically, because i need to store the generated invoice during finalized invoice callback

fast orbit
#

let me think if there's any workaround

fast orbit
#

I can think of not so straightforward workaround since Stripe doesn't support this directly. In your update subscription request, you'll set

  • new price plan
  • proration_behavior as 'always_invoice' to create immediate proration invoice
  • collection_method as send_invoice to avoid automatic payment from saved card
  • days_until_due for the number of days that the proration invoice will be due

With this update request, invoice will not be charged automatically and you can collect the payment manually from latest_invoice.payment_intent.

After the manual payment is collected successfully, you should update the subscription again by setting collection_method='charge_automatically' to charge automatically in future billing cycle

minor lintel
#

ok lemme try, thanks

fast orbit
#

No problem! Happy to help 😄

minor lintel
#

must i set days_until_due?

fast orbit
#

Yup! collection_method='send_invoice' always comes with days_until_due

minor lintel
#

Hi i saw that the subscription will get updated regardless of the payment status with the workaround.
what is the behavior of the default flow for this? what would happen if the payment failed?

fast orbit
#

Yes, the subscription will be updated to the new plan after update request is submitted

#

What is your expected behaviour?

minor lintel
#

if the payment failed during auto collection, what would happen

#

if stripe has already handled this then i would just update my tables during payment succeed callback instead

fast orbit
minor lintel
#

great, meaning i can set the behavior. thanks

fast orbit
minor lintel
#

one more question, if i change the subscription collection_method from charge_automatically to send_invoice and back, will it affect the subscription.defaultpaymentmethod?

fast orbit
#

no, it shouldn't

minor lintel
#

great, thanks