#miko_api

1 messages · Page 1 of 1 (latest)

chrome forgeBOT
#

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

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

lavish iris
#

👋 happy to help

#

are you using React Native?

#

btw you shouldn't be using your secret key on the "frontend" application (in this case your mobile app)

mint violet
#

yes, i am using react native

lavish iris
#

you need to separate your backend code from the react native app (client-side)

mint violet
#

as i am checking your link, I can tell that:
I have @stripe/stripe-react-native installed,
I am using the initStripe initialization method
I have a payment method enabled(card)

and as i said it is working on iOS simulator, android simulator and on the android build. only the iOS build is making the problem. when i click to open the presentPaymentSheet

lavish iris
#

Error code: Failed You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY').
this message is only sent when you're trying to use the server-side API calls without the secret key

mint violet
#

does this mean i am using the wrong key in the backend?
also how it is possible that it is making this error only on ios build

lavish iris
#

maybe the iOS build is referencing the wrong server URL

old sail
#

it can also mean that you're not passing the Ephemeral Key correctly (to customerEphemeralKeySecret on initPaymentSheet ), like you're passing null or another invalid value.

mint violet
#

UPDATE:
Everything works fine on Android builds, iOS simulators, and Android simulators, but when I try to add a payment card on the real iOS build, I get the following error:
Error code: Failed You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/.

What I’ve Done:
I followed the Expo/Stripe documentation and have provided the publishable key in the frontend using the component, like this:
<StripeProvider publishableKey={process.env.EXPO_PUBLIC_STRIPE_PKEY} urlScheme="your-url-scheme" // required for 3D Secure and bank redirects merchantIdentifier="merchant.com.{{YOUR_APP_NAME}}" // required for Apple Pay >
and on the backend i also tried:

const Stripe = require('stripe');
const stripe = Stripe('sk_test_5…6o', {apiVersion: '2024-04-10'});
The API keys are correctly set in the environment variables.
On Android, iOS simulators, and Android build, everything works as expected.
The issue happens only on real iOS devices.
Setup:

Expo SDK version: ~50.0.20
API version: 2024-04-10
@stripe/stripe-react-native: ~0.35.1
react-native: 0.73.6
Device: iPhone13 (iOS 18.1.1)
What I've Tried:

Verified that the API key is correct and correctly loaded in process.env.EXPO_PUBLIC_STRIPE_PKEY.
Double-checked the relevant documentation for iOS integration with Expo/Stripe, but nothing seems to address this specific error.

chrome forgeBOT
#

Hello @mint violet, we have sent you a direct message, please check it at https://discord.com/channels/@me/1316041136506404875

  • 🔗The message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
lavish iris
#

unfortunately we need to close discord