#Randomuser2022
1 messages · Page 1 of 1 (latest)
Which checkout element are you referring to? Are you referring to Payment Element or Express Checkout Element?
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
This is not Payment Element, but Checkout Session (Stripe hosted payment page)
After the customer completes the payment, he/she will be redirected back to the success_url set in request creation request: https://dashboard.stripe.com/logs/req_RCuqxTbxUfmD7Q
Where did you see payment_intent.succeeded for pi_3NDLjdEydrSRkIrF01vqioX6? I only saw payment_intent.payment_failed event such as https://dashboard.stripe.com/events/evt_3NDLjdEydrSRkIrF0OD6Xpsu
Before displaying the payment outcome, you can use Payment Intent retrieval API to check the status: https://stripe.com/docs/api/payment_intents/retrieve
This is guide about how you can retrieve the payment intent after customer is redirected to your page: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-submit-payment
no it's failed. i check this now
it's another api?
Yes
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?
What link are you referring to here? With Payment Element, there shouldn't be any link to send to customer.
the link is the page we have.
If the payment is paid successfully, then yes - payment_intent.succeeded event will be sent
The link here refers to Payment Element running on your payment page
yep
this is the answer to your question
When the customer completes the payment (be it failed or successful), he/she will be redirected to the return_url set in the confirm request: https://dashboard.stripe.com/logs/req_gSARodoKedOdfn
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
not in the payment element api right? it's in payment_intent.succeeded i guess
After the payment is completed, you can either:
- Listen to
payment_intent.*event for the payment outcome; OR/AND - 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
so Payment Intent retrieval API is a must in order to display the dynamic payment status result for the customer
i'm having a look on this...
so we need to add two steps in total in order to do that
- Before displaying the payment outcome, you can use Payment Intent retrieval API to check the status: https://stripe.com/docs/api/payment_intents/retrieve
- This is guide about how you can retrieve the payment intent after customer is redirected to your page: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-submit-payment
and if we use check out session, we don't have to do these jobs right?
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
so we pick one? which is easier?
Do you mean between Payment Element and Checkout Session?
If so, Checkout Session is easier
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
They are the same! Item (2) teaches you how to integrate Item (1) with the code example
oooh so just one
let me have a look again. so we need to call it after the payment is completed?
Yes after the customer is redirected to the return_url
ok! thank! i'll look into it and i have no more questions for now. thanks you for your kind response and help!!!
No problem! Happy to help 😄
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?
You may use declined test cards here for testing payment failure: https://stripe.com/docs/testing#declined-payments