#joaoed-confirm-paymentInent

1 messages ยท Page 1 of 1 (latest)

steady furnace
#

Hi there ๐Ÿ‘‹ can you tell us a bit more about your scenario? Usually payment intents only go into a requirees_confirmation state when they're intentionally created to be confirmed manually.

mental solstice
#

Sure. In my application, I need to edit an invoice to set the flat_fee amount (because we can't use the percentage). So, Stripes can take at least one hour to try to pay it. In order to avoid that, I'm calling the API to finalize and pay the invoice immediately after I edit that.

#

but for some reason, some of the payment_intents earn the status: requires_confirmation when I do the process described above^

#

IMO it occurs because we send the payment method when we're creating the subscription, and we're finalizing the invoice when stripe sends us the webhook "invoice.created". It may happen at the same time or not, when not, that occurs (just my guess)

steady furnace
#

Do you have the ID of an example payment intent where you saw this behavior?

mental solstice
#

sure, pi_3K2MJUFnn9huPxuk0K67hEpK

#

here is the invoice ID too, in_1K2LKxFnn9huPxukwe0MVF7V

steady furnace
#

Thanks, looking into that.

steady furnace
#

Thank you for your patience! Looked into this with a teammate and we think you're seeing this behavior because the collection_method is set to send_invoice so our system is planning to send an invoice for the confirmation step.

mental solstice
#

oohh yeah, I did it because if I use the collection_method as automatically_charge instead of send_invoice, the first invoice generated by a subscription is automatically charged and because of that, I can't edit the invoice to set the flat_fee.

#

So, when I use it as send_invoice, Stripe sends to me the invoice.created event and the invoice has the status "draft". So I'm able to edit that setting the flat fee and change the collection method to charge_automatically.

#

It was tricky, would be nice if Stripe allow us to use percentage or amount when creating a new subscription

steady furnace
#

Yeah, I was just trying to think through whether there is an easier way to do flat fees.

steady furnace
#

Sincere apologies for the delay. There is another option for getting around the first invoice finalizing instantly. You can create the subscription with a very short trial period (set trial_end to a time a few seconds in the future). This will cause the trial to generate a zero dollar invoice that is automatically handled and then when the trial ends the first "real" invoice will have the one-hour period before confirming. This would allow you to use the charge_automatically collection method.

mental solstice
#

gotcha! that's nice... but I can call the api to finalize and pay manually if I don't want to wait for the one-hour period? at least for the first invoice.

steady furnace
#

Yes, you can still use the API to finalize the invoice faster, and if the collection_method is set to charge_automatically then that payment will trigger then.

mental solstice
#

gotcha!!, I'll try that. Muito obrigado (Thank you), @steady furnace . You really helped me ๐Ÿ™‚

steady furnace
#

Happy to help!