Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NemesisMiko opened this issue Dec 9, 2024 · 1 comment

Comments

@NemesisMiko
Copy link

NemesisMiko commented Dec 9, 2024

Hello, 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" // 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.
@Hiti3
Copy link

Hiti3 commented Dec 9, 2024

We have the same issue... please provide a solution why only ios does not work. At build time, which is handled by EAS, the stripe key is present, yet stripe handling on ios builds does not work..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants