#greggles_best-practices

1 messages ¡ Page 1 of 1 (latest)

somber martenBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1260307482945782084

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

robust zealot
#

Additional requirements:
I need the customer address to determine tax liability first and I want to use the address element. This affects the bottom line price. We add tax manually to the invoice and use Anrok as a 3rd party tax provider.

vapid dew
#

Just to clarify, are you trying to create one-off invoices and then pay them using PaymentElement?

robust zealot
#

Hi, thank you. At it's basic level, I'm trying to sell a stripe one-off payment product and have the customer use the address element and the payment element.

#

I've tried several integrations, the latest was the deferred payment method of loading the payment element, but it was limited to cards, cashApp and US bank account which skunks my international clients.

vapid dew
#

Sorry for the delay here

robust zealot
#

So, is it preferable to

  1. create the paymentintent or setupintent prior to rendering the payment and address elements
  2. render the elements
  3. confirm the payment

Then what?
After confirming the payment
create the customer,
create the invoice,
attach products to invoice
Apply payment?

vapid dew
#

I don't think we have a guide that covers this usecase fully. But ideally you could do something like,

Finalized invoice generates a PaymentIntent.. Use that to render elements, collect card details and confirm payment: https://docs.stripe.com/api/invoices/object#invoice_object-payment_intent

robust zealot
#

Thank you for the suggestion. So essentially this would be a 2 page/step process because I'd need to instantiate stripe elements separately, once for the address element, then again for the payment element using the client_secret?

#

This is how I backed myself into a corner before. I instantiated stripe elements on page load and rendered the address element and payment element from that initial instantiation.

vapid dew
#

Yeah since third-party tax API + invoices are involved, it'd be better to do it as a step process