#tymm
1 messages · Page 1 of 1 (latest)
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
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..
i want the customer to pay now, but not automatically, because i need to store the generated invoice during finalized invoice callback
let me think if there's any workaround
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_behavioras'always_invoice'to create immediate proration invoicecollection_methodassend_invoiceto avoid automatic payment from saved carddays_until_duefor 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
ok lemme try, thanks
No problem! Happy to help 😄
must i set days_until_due?
Yup! collection_method='send_invoice' always comes with days_until_due
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?
Yes, the subscription will be updated to the new plan after update request is submitted
What is your expected behaviour?
yeah i wanna know the behavior of this
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
If the payment failed, the status will move your failed payment settings in invoice setting dashboard: https://dashboard.stripe.com/settings/billing/automatic
great, meaning i can set the behavior. thanks
i'd recommend trying in test-mode with test clock and ensure it meets your expectation: https://stripe.com/docs/billing/testing/test-clocks
one more question, if i change the subscription collection_method from charge_automatically to send_invoice and back, will it affect the subscription.defaultpaymentmethod?
no, it shouldn't
great, thanks