#Mathias

1 messages ยท Page 1 of 1 (latest)

ionic wigeonBOT
bright blaze
#

I don't quite understand you question, can you elaborate?

dreamy trench
#

i can try ๐Ÿ™‚

#

using invoices in a checkout flow, is this recommended or should we do something else?

bright blaze
#

What do you mean by using invoices in a checkout flow,?

dreamy trench
#

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)

bright blaze
#

What are you trying to achieve here? why are you creating a checout session, and then an invoice?

dreamy trench
#

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)

bright blaze
#

So basically you just want to send a receipt (or invoice) upon checkout session completion?

haughty socket
#

hey @dreamy trench

#

I reopened the thread

#

๐Ÿ‘‹ how may I help?

#

sorry my bad

dreamy trench
#

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

haughty socket
#

ok

dreamy trench
#
  1. FE: create payment method
    2: FE: client clicks pay
  2. BE: create customer, create invoice, finalize, pay
    4: FE: poll our server for payment updates
haughty socket
#

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

dreamy trench
#

if they cancel the payment

#

should we void the invoice?

#

because it needs to be finalized before we can collect/pay?

haughty socket
dreamy trench
#
  1. 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?

haughty socket
#

that's the same flow that you've mentioned before

#

which is totally different then what I mentioned earlier

dreamy trench
#

we would poll stripe instead of our server, what flow would you propose?

haughty socket
#

please read through my suggestion once more

dreamy trench
#

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?

haughty socket
#

yes exactly

#

the only thing you need to do upon invoice creation is adding expand: ["payment_intent"] so you can get the client_secret

dreamy trench
#

aha! that was what you ment by expand ๐Ÿ™‚

#

ok, great

#

I will try this ! Thanks alot ๐Ÿ™‚

haughty socket
#

sure thing