#tymm

1 messages · Page 1 of 1 (latest)

frank brookBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

  • tymm, 49 minutes ago, 14 messages
  • tymm, 1 day ago, 5 messages
vague heron
#

Can you tell me what you want to achieve so that I can help you with a solution?

reef arch
#

i want to be able to finalize the invoice of a subscription update manually

#

and also want the update call to not change the existing subscription if the customer did not complete the payment

vague heron
#

When do you update the subscription?

reef arch
#

i have tried setting pending_if_incomplete without send_invoice, but seems like the invoice will be finalized immediately after i update the subscription?

vague heron
#

You can listen to invoice.created event and finalize it in your webhook handling.

reef arch
#

i do this

subscription.update(
                SubscriptionUpdateParams.builder()
                        .setCollectionMethod(SubscriptionUpdateParams.CollectionMethod.SEND_INVOICE)
                        .setDaysUntilDue(1L)
                        .setMetadata(meta)
                        .setCoupon(couponCode == null ? "" : couponCode)
                        .build()
        );

then this

toUpdateItem.update(
    SubscriptionItemUpdateParams.builder()
        .setPrice(newPrice.getId())
        .setProrationBehavior(SubscriptionItemUpdateParams.ProrationBehavior.ALWAYS_INVOICE)
        .setProrationDate(prorationDate)
        .setPaymentBehavior(SubscriptionItemUpdateParams.PaymentBehavior.PENDING_IF_INCOMPLETE)
        .build()
);
vague heron
#

I'd suggest you to implement what I suggested and come back if you have any further question.

#

Also as I repeated many times. You can't set payment_behaviour with collection_method=send_invoice

reef arch
#

like i said im seeing the invoice being finalized and customer being charged immediately after i update the subscriptionitems and that was with pending_if_incomplete and without send_invoice.
and i've just tested listening to invoice.created and finalize it from there and i get This invoice is already finalized, you can't re-finalize a non-draft invoice.; request-id: req_AwmlVKzQIqHXJH

vague heron
#

Why you remove send_invoice ? I thought you want to be able to control when to finalize the invoice. ?

reef arch
#

like i've said many times, i only wanted 2 things:

  • to be able to finalize the invoice of a subscription update manually
  • the update call to not change the existing subscription if the customer did not complete the payment

afaik i had to do send_invoice for the first one and pending_if_incomplete for the second one to happen.

#

please suggest a way to achieve both if that 2 configurations cant coexist

vague heron
#

I still don't understand the 2nd requirement. What do you want to update and when do you want to update?

reef arch
#

ok so i have a subscription that has 1 item inside lets call it a package. so a customer can already have a tier 1 package subscription going on and now he wants to upgrade to a tier 2 package.

#

so i would not want his existing subscription to be altered in any way if he didnt go through the payment somehow

#

because without pending_if_incomplete the status of the subscription in stripe will be changed to past due and the items inside would have been changed as well, which is what i do not want

vague heron
#

So you want just check if the subscription's latest_invoice is paid before decidning whether to update the subscription?

vague heron
#

Ok, then I don't see why you want to use pending_if_incomplete in this case.

#

You should just retrieve its latest_invoice, check if it's payment status, and only update the subscription with new item if the invoice is paid.

reef arch
#

ok now how do i create a update subscription invoice that has proration without actually replacing the items in the subscription?