#antonio-giano_unexpected

1 messages ¡ Page 1 of 1 (latest)

hollow hazelBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1225567253248872578

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

limber valveBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

runic hedge
#

Hello, in case it was not understood, I am happy to elucidate further

frigid island
#

Hello! Can you link to the guide you're referring to?

runic hedge
#

What i mean with the question is the following:

``// Initialize Stripe.js using your publishable key
const stripe = Stripe('pk_test_51NaMMyF07S1euBUTme3OQEpK0ySsAirJeeUnEdKbzRLdnMWHtFfrxPqW8vF51G5Avj3CmBKOI1HdgVQ7I1YFsKwy00Jefozlxh');

// Retrieve the "payment_intent_client_secret" query parameter appended to
// your return_url by Stripe.js
const clientSecret = new URLSearchParams(window.location.search).get(
'payment_intent_client_secret'
);

// Retrieve the PaymentIntent
stripe.retrievePaymentIntent(clientSecret).then(({paymentIntent}) => {
const message = document.querySelector('#message')

// Inspect the PaymentIntent status to indicate the status of the payment
// to your customer.
//
// Some payment methods will [immediately succeed or fail][0] upon
// confirmation, while others will first enter a processing state.
//
// [0]: https://stripe.com/docs/payments/payment-methods#payment-notification
switch (paymentIntent.status) {
case 'succeeded':
message.innerText = 'Success! Payment received.';
break;

case 'processing':
  message.innerText = "Payment processing. We'll update you when payment is received.";
  break;

case 'requires_payment_method':
  message.innerText = 'Payment failed. Please try another payment method.';
  // Redirect your user back to your payment page to attempt collecting
  // payment again
  break;

default:
  message.innerText = 'Something went wrong.';
  break;

}
});``

frigid island
#

The return_url is only used if an immediate error/decline is not encountered.

runic hedge
#

Got it. What situations, then, lead to having an event of type requires_payment_method?

#

just to get a complete idea of how to treat 360 degrees

frigid island
#

One example is when payment info is provided, a next action of some kind is required (like 3D Secure), that process fails, and thus you get a non-immediate decline. In that case the Payment Method that failed is detached from the Payment Intent and the status of the Payment Intent changes to requires_payment_method. That's when your code above would run.

runic hedge
#

Got it. Do we have other events besides those present?

frigid island
#

Events? Do you mean Payment Intent statuses?

runic hedge
#

Yes, i mean that

frigid island
runic hedge
#

Perfect. Thanks for the link

frigid island
#

Happy to help!