#will_api

1 messages · Page 1 of 1 (latest)

young eagleBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1403041309362491503

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

topaz pewter
#

Clarification about my current payment flow:

  1. create payment intent
  2. confirm through payment sheet
  3. do some work -- upload user data
  4. when work completes, capture payment
delicate glen
#

Hey there

topaz pewter
#

Hello

delicate glen
#

Unfortunately no, Invoices do not support manual capture.

#

So you would not be able to use Invoices if you want to use manual capture.

topaz pewter
#

🙁

#

What if I create the invoice in the part of my code where I capture the PI? That is, I attach the payment intent and then immediately capture it?

delicate glen
#

You could capture the PaymentIntent and then create an Invoice and mark it as paid separately.

topaz pewter
#

Okay, thank you for that suggestion. However, I'm struggling to understand why attaching a PI to an invoice would not work.
From the attachPayment documentation: "For the PaymentIntent, when the PaymentIntent’s status changes to succeeded, the payment is credited to the invoice, increasing its amount_paid. When the invoice is fully paid, the invoice’s status becomes paid."
Could you briefly explain why attachment wouldn't work here? It seems to me that, upon successful PI capture, the associated invoice would change to paid; or, on failure, it would send an email notification and attempt to retry.

delicate glen
#

Ah sorry I see what you are saying. Attaching payments to Invoices is part of the new API version so this was a recently added feature. So yeah this should work fine -- it is similar to what I was describing above but you would have actual reconciliation.

#

I'd do a quick test in test mode here but yeah you are correct that this should work.

topaz pewter
#

That's great! I understand that invoice items are also part of the equation. If I moved forward with the payment-intent-attachment solution, do you know if it would also be necessary to create an invoice item, or would the payment intent be sufficient?

delicate glen
#

Yeah you would still need Invoice items in order to have a finalized Invoie that you can then attach the PaymentIntent to.

topaz pewter
#

Okay, thanks. I have another question. Say my product costs $20, so I'll have a payment intent for $20. Like you said, I'll also need to create an invoice item. I'm curious about the amount and pricing fields for the invoice item: should I make the amount $0 since I'll be attaching a $20 payment intent? Can I leave the amount and pricing fields blank? My worry is double-charging the user

delicate glen
#

Best thing to do here is to test this all out in test mode!

#

But you would create a $20 Invoice Item

#

That is how the Invoice will be finalized for a $20 amount

#

And then you can associate a $20 PaymentIntent to it in order to pay it.