#Mathias
1 messages ยท Page 1 of 1 (latest)
I don't quite understand you question, can you elaborate?
i can try ๐
using invoices in a checkout flow, is this recommended or should we do something else?
What do you mean by using invoices in a checkout flow,?
the customer checks out and is going to pay,
then we create a payment method, create a customer, attach the payment method, create an invoice and then finalize and pay the invoice (to complete the checkout for the customer)
What are you trying to achieve here? why are you creating a checout session, and then an invoice?
I think we want to have a receipt for the payment that can be sent to the customer
so when they come to the payment site we create a invoice and when they pay we finalize and pay the invoice with the method they have created
( we are redoing our integration and the old integration was not done by me )
we wanted the items to show in stripe and items cannot be added to a intent etc as i understood it
(for the receipt)
So basically you just want to send a receipt (or invoice) upon checkout session completion?
Now its unlocked ๐
thanks
Im intrested in some implementation best practicies
I suspect we have not integrated the correct way..
in our webshop we create invoices that we trigger the /pay on. when the customer clicks pay
some cases we collect payment for later (then a invoice would be fine i guess)
but we are also collecting payment on-session with the help of invoice
ok
- FE: create payment method
2: FE: client clicks pay - BE: create customer, create invoice, finalize, pay
4: FE: poll our server for payment updates
you can start by creating the invoice on the backend
and once that's done, you'd have a payment_intent field on it
if you expand the payment_intent field, you can get the client_secret that you can use to collect/pay the invoice on the front-end
which is a lot easier/faster and better integration
if they cancel the payment
should we void the invoice?
because it needs to be finalized before we can collect/pay?
yes that's correct
- FE: create payment method
2: FE: client clicks pay
BE: create customer, create invoice, finalize,
4: FE: pay / poll and get redirect url from stripe
so the new flow would be something like this?
that's the same flow that you've mentioned before
which is totally different then what I mentioned earlier
we would poll stripe instead of our server, what flow would you propose?
please read through my suggestion once more
sorry, im new to the stripe API :), basically when we have created the invoice I use the payment_intent and follow a regular flow for payment_intent?
yes exactly
the only thing you need to do upon invoice creation is adding expand: ["payment_intent"] so you can get the client_secret
aha! that was what you ment by expand ๐
ok, great
I will try this ! Thanks alot ๐
sure thing