#sqarf_code

1 messages ยท Page 1 of 1 (latest)

hybrid laurelBOT
#

๐Ÿ‘‹ 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/1303371133374173256

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

severe talon
#

Goal:
Create a checkout page by using stripe payment and address elements. After checkout user should get also stripe invoice with automatic tax calculated depending on the address.
What we have tried:

  1. Create invoice, finalize it, but we don't know yet the customer address.
  2. From that we get payment intent to get the client secret to render stripe elements
  3. Make the payment
    This works fine, but we can't enable automatic tax here after address is submitted, as we can't update finalized invoice. We could not finalize the invoice to update it later, but without finalized invoice we can't get the payment intent for client secret to render the address element. And we can't set automatic tax for the invoice at the beginning, as customer still didn't fill the form.
    -=-=-=-=-=-
    2nd option we tried:
  4. Setup intent to get the secret to render stripe elements
  5. Collect all the user details, like address and card details
  6. Update the customer with all the details
  7. Create invoice with automated tax and pay it.
    This one also works fine untill we try to use a card that requires 3DS authorization, the popup shows up and we authorize, but we can't pay the invoice as it requires the authorization one more time.
    So the questions is how can we allow user to make the purchase in one step, basically checkout with address and payment elements, he makes the payment and on stripe side invoice is generated and paid.
dapper quest
hybrid laurelBOT
severe talon
#

No, we don't want to use Stripe checkout in this case

dapper quest
#

you will need to upfront collect the address from the customer before finalizing the Invoice, it's just required for this to be able to work.

#

so basically your first option you explained earlier

#

we can't get the payment intent for client secret to render the address element
note you do not need a client_secret to render Elements โ€” see https://docs.stripe.com/payments/accept-a-payment-deferred
But I would still say, you need a two-step process here (first page, collect customer address; second page, render PaymentElement to accept payment), it's just the best way to get this started and have something working if you're not going to use Checkout.