Stripe-ios: Cannot add a new credit card using the SDK

Created on 29 Jan 2020  路  4Comments  路  Source: stripe/stripe-ios

Summary

I'm using the basic integration of the Stripe SDK and I cannot add a credit card on to my Stripe customer account. Creating the Stripe account works fine and if I already have a credit card,
then I can select it for payment. In short, every thing works in the SDK but I can't add a new credit card.

Pictures of the issue


Simulator Screen Shot - iPhone 8 - 2020-01-29 at 15 22 46
Simulator Screen Shot - iPhone 8 - 2020-01-29 at 15 22 52

iOS version

iOS 13.3

Installation method


Through the basic integration guide: https://stripe.com/docs/mobile/ios/basic

SDK version


Pod: 18.4.0, API: 2019-12-03, NPM: 8.8.0

Other information


We're testing this on the Stripe test platform, trying to add the credit card 4242.

Most helpful comment

Ah yes, that was such a silly mistake! We double checked and in fact iOS was using a publishable key for a different Stripe account. We changed it to the right one and now everything works!

Thanks a lot @yuki-stripe! Now everything is back to normal 馃槃

All 4 comments

Hi @mansoorshahsaid

Do you use Stripe Connect / set stripeAccount anywhere?

Hey @yuki-stripe, I'm not using Stripe Connect anywhere. I'm simply using Stripe Payments with the basic integration for iOS. We tested it on our Android app and everything works fine. There are no problems when adding a credit card. But on iOS, I keep getting this same error every time I'm trying to add a card.

Also what do you mean by set stripeAccount?

@mansoorshahsaid Ah I thought this could be related to Stripe Connect, but never mind!

It looks like the PaymentMethod in the screenshot was created using one account, but the ephemeral key you provide is for a Customer created under a different account.

Could you check that the SDK's publishable key and the server's secret key are for the same account? You can view testmode keys here: https://dashboard.stripe.com/test/apikeys.

Ah yes, that was such a silly mistake! We double checked and in fact iOS was using a publishable key for a different Stripe account. We changed it to the right one and now everything works!

Thanks a lot @yuki-stripe! Now everything is back to normal 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xuzhe picture xuzhe  路  3Comments

marcglasberg picture marcglasberg  路  7Comments

imhugofonseca picture imhugofonseca  路  7Comments

yuzeh picture yuzeh  路  5Comments

odedharth picture odedharth  路  7Comments