Miko
Miko

Reputation: 1

(Expo) Stripe iOS Build Error: "You did not provide an API key" despite Providing Key

I'm encountering an issue with Stripe integration in my Expo app when running it on a real iOS device.

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" 
    merchantIdentifier="merchant.com.{{YOUR_APP_NAME}}" 
>

and on the backend i also tried:

const Stripe = require('stripe');
const stripe = Stripe('sk_test_5…6o', {apiVersion: '2024-04-10'});

Setup:

What I've Tried:

Upvotes: 0

Views: 45

Answers (0)

Related Questions