#ganesh-gawali_unexpected

1 messages · Page 1 of 1 (latest)

viral sentinelBOT
#

👋 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/1447928790977216602

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

twilit veldt
#

👋 Hi there! Do you have a Payment Intent ID you can share where this is happening? pi_…

wicked dagger
#

pi_3ScPz8ExYCOPxGAz1xnJTewu

twilit veldt
#

Thanks. Can you share a bit of your code where this is happening?

wicked dagger
#

yes

#

please give me 2

twilit veldt
#

as per the document we called the confirmPaymentIntent again
Also, can you share which documentation you're referring to here?

wicked dagger
#

code - async function collectPaymentByCreatingPaymentIntent() {
const { error, paymentIntent } = await createPaymentIntent({
amount: selectedDonationAmt * 100,
currency: Config.CURRENCY_CODE.MYR,
onBehalfOf: Account.Merchant_Id,
captureMethod: 'automatic',
descriptor: 'GivePlease',
});

    if (error) {
        showToast("Failed to create payment intent", 'danger');
        setIsLoading(false);
        setError(error.message);
        return;
    } else {
        setError(null);
        paymentIntentCreated.current = paymentIntent;
        collectThePaymentMethod();
    }
}

async function collectThePaymentMethod() {
const { error, paymentIntent } = await collectPaymentMethod({
paymentIntent: paymentIntentCreated.current,
updatePaymentIntent: true,
});
console.log('PAYMENT INTENT', paymentIntent);
if (error) {
setIsLoading(false);
setError(error.message);
showToast(error.message, 'danger');
disconnectReader();
return;
} else {
setError(null);
confirmThePaymentFromStripe(paymentIntent);
}
}

async function confirmThePaymentFromStripe(updatedPaymentIntent) {
const { error } = await confirmPaymentIntent({
paymentIntent: updatedPaymentIntent,
});

    if (error) {
        setIsLoading(false);
        setError(error.message);
        showToast('Failed to confirm the payment', 'danger');
        disconnectReader();
        return;
    }
    setError(null);

}
twilit veldt
wicked dagger
#

okay

twilit veldt
#

Overall this looks correct:

  • You create a Payment Intent
  • You call collectPaymentMethod which updates the Payment Intent once a card has been presented. At this point the status is requires_confirmation
  • You call confirmPaymentIntent — and the Payment Intent moves to succeeded
wicked dagger
#

yes

#

sharing

#

pi_3ScQOoExYCOPxGAz0Z4J8ObS

#

we called confirmPaymentIntent twice for this

twilit veldt
wicked dagger
#

okay

viral sentinelBOT
wicked dagger
#

Is there a possibility of delay in the payment process? We are getting requires_confirmation but after a while the payment is getting successfully executed

twilit veldt