#maufcost - Confirm PI errors
1 messages · Page 1 of 1 (latest)
Yes. Here's one of the PI's id: pi_3LLWJcDHu3ajdCof1O8TpeSx_secret_suGKkbebyN6H1QXB7UbUGjJzG
The specific error is: Payment confirmation error {"code": "Failed", "declineCode": null, "localizedMessage": "There was an unexpected error -- try again in a few seconds", "message": "Não há payment_intent: 'pi_3LLWJcDHu3ajdCof1O8TpeSx'", "stripeErrorCode": "resource_missing", "type": "invalid_request_error"}
Did you manage to take a look at it?
Not yet just getting to it. It's been really busy today
No prob. Take your time. I can wait here 🙂
Okay so the PI is just fine and this error is coming from the Stripe.js library. How are you confirming the payment intent?
I am confirming on my React Native app as such:
const billingDetails = { email: user ? user.email : "no-email" }
// Creates payment intent and fetches the intent's client secret from the backend
const { clientSecret } = await createPaymentIntentAndCaptureFunds(order)
console.log(clientSecret)
const { paymentIntent, error } = await confirmPayment(clientSecret, {
paymentMethodType: 'Card',
paymentMethodData: { billingDetails },
})
if (error) {
console.log(error);
} else if (paymentIntent) {
// console.log('paymentIntent: ', paymentIntent);
}
Are you using stripe-react-native? That is what our RN docs are set up for
https://stripe.com/docs/payments/accept-a-payment?platform=react-native
https://github.com/stripe/stripe-react-native
Yes. Correct
It's so weird. Everything was working just fine. Then, I switched from my personal account to my business account and swapped the keys and the PIs are not confirmed anymore
Okay....wait a sec. You just said the magic words. Swapped the keys. I think not all the keys are properly swapped.
Can you translate this bit for me?
Não há payment_intent: 'pi_3LLWJcDHu3ajdCof1O8TpeSx
This means: "There isn't a payment intent: pi_3LLWJcDHu3ajdCof1O8TpeSx"
Perfect
yes so what is means is that the Payment Intent was created on the back-end with an API key that is from a different account than the API key used on the front-end
Jeez. I've checked that three times. Gonna check it again
The best way to check is to have the API keys logged at runtime just prior to when the PI is created/confirmed.
When apps get bigger it can be easy to lose track of which variable gets assigned where
That's a great tip. I'm gonna log them as see what comes up
Duuuuuude. I believe xcode + metro cached the previous public key on my virtual env. Recompiling everything now
Ugh. I'm not the biggest fan of XCode....so I'm not surprised