#Meta Krypto

1 messages · Page 1 of 1 (latest)

warm nicheBOT
next canopy
supple dragon
#

yes

next canopy
#

I'm afraid we don't have flow chart or anything which might go deeper in the data flow but I am happy to explain how the flow overall works

supple dragon
#

ah no documentation explaining the full flow?

#

yes, can you please give some indication what has happened when user click to the Pay button

next canopy
#

1/ You create a PaymentRequest for the amount which allows you to render the wallets (Apple Pay/Google Pay/Link) and tokenise the payment method & you also create a PaymentIntent for the same amount server-side

2/ While the PaymentMethod is being tokenized by going through the authorization flow, client-side code is listening to an event called paymentmethod which allows it to listen for tokenization events. When the PaymentMethod is tokenized, It invokes the callback function as shown in the example here
https://stripe.com/docs/stripe-js/elements/payment-request-button?client=html#html-js-complete-payment

3/ Before the callback function invokes, your client-side code can fetch the PaymentIntent. Once the callback function runs & it has access to the PaymentIntent, it calls confirmCardPayment with the clientSecret (of the PaymentIntent) and the paymentMethod that was tokenized from the wallets
https://stripe.com/docs/stripe-js/elements/payment-request-button?client=html#html-js-complete-payment

The clientSecret allows API to know which PaymentIntent is being confirmed & the paymentMethod parameter tells the API which PaymentMethod to use

supple dragon
#

Thanks hanzo

#

I'll dig more into the code with the information you provided