#Randomuser2022

1 messages · Page 1 of 1 (latest)

wraith wyvernBOT
ornate thunder
#

Which checkout element are you referring to? Are you referring to Payment Element or Express Checkout Element?

craggy totem
#

Payment Element

#

you could have a look on this as an example:pi_3NDeeKEydrSRkIrF0W37wLyf

#

the affirm payment failed,but it'll jump to a succeful page

#

we want to change it and look for a more dynamic way to display result for the customer

ornate thunder
#

This is not Payment Element, but Checkout Session (Stripe hosted payment page)

craggy totem
#

oooh but we use payment element. wait a sec

#

pi_3NDLjdEydrSRkIrF01vqioX6

#

this

ornate thunder
craggy totem
ornate thunder
#

Yes

craggy totem
#

the situation is we call the Payment Element, and the page is done. and we send the link to customer. is it technically ok to call payment_intent.succeeded when the customer paid?

ornate thunder
#

What link are you referring to here? With Payment Element, there shouldn't be any link to send to customer.

craggy totem
#

the link is the page we have.

ornate thunder
#

If the payment is paid successfully, then yes - payment_intent.succeeded event will be sent

craggy totem
#

have a look

#

after they paid, it'll jump to this url

ornate thunder
#

The link here refers to Payment Element running on your payment page

craggy totem
craggy totem
ornate thunder
craggy totem
ornate thunder
#

After the payment is completed, you can either:

  1. Listen to payment_intent.* event for the payment outcome; OR/AND
  2. Use Payment Intent retrieval API to check the payment status
#

payment_intent.succeeded is a async event to your Webhook server. If you wish to check the payment intent synchronously after redirecting to your page, payment intent retrieval API should be used instead

craggy totem
#

so Payment Intent retrieval API is a must in order to display the dynamic payment status result for the customer

craggy totem
#

so we need to add two steps in total in order to do that

#

and if we use check out session, we don't have to do these jobs right?

ornate thunder
#

Both steps are actually the same thing/step. The guide provides the information about how you can retrieve the Payment Intent status after redirecting to your page

#

if we use check out session, we don't have to do these jobs right
Yup! This is specific to Payment Element integration

craggy totem
#

so we pick one? which is easier?

ornate thunder
#

Do you mean between Payment Element and Checkout Session?

#

If so, Checkout Session is easier

craggy totem
#

nah, there's no way to do the Checkout Session again. they don't have price and product in stripe so it's impossible we had to use element in the first place. and it leads to so many jobs....

#

i mean between the two steps which one is easier

ornate thunder
#

They are the same! Item (2) teaches you how to integrate Item (1) with the code example

craggy totem
#

oooh so just one

#

let me have a look again. so we need to call it after the payment is completed?

ornate thunder
#

Yes after the customer is redirected to the return_url

craggy totem
#

ok! thank! i'll look into it and i have no more questions for now. thanks you for your kind response and help!!!

ornate thunder
#

No problem! Happy to help 😄

craggy totem
#

oh just one more question if possible. in the test mode, most payment succeeded. if we need to test the fail, how to test in the check-out page?

ornate thunder
wraith wyvernBOT
craggy totem
#

thank you i just finished the meeting, i'll have a look!

#

have no more questions!