I am successfully using this library on Android with no problems. On iOS, I cannot get past this error. I have tried to follow all of the other fixes in the other bug report threads with similar issues to no avail. (#102, #53, #81) This includes reinstalling the project and starting from scratch several times. Using the instructions with Pods and manually. I have installed the example project and got it working.
This has never been an Expo project.
The library links and appears to be working until I try to initialize it with stripe.init().
`import stripe from 'tipsi-stripe';
console.log('STRIPE', stripe);
stripe.init({
publishableKey: 'pk_test_xxxx'
});`
This console log shows that it is there but when I actually try to use it, it says it is undefined.
STRIPE Stripe {stripeInitialized: false, init: function, deviceSupportsApplePay: function, canMakeApplePayPayments: function, paymentRequestWithApplePay: function鈥canMakeApplePayPayments: function ()cancelApplePayRequest: function ()completeApplePayRequest: function ()createSourceWithParams: function ()createTokenWithBankAccount: function ()createTokenWithCard: function ()deviceSupportsApplePay: function ()init: function ()openApplePaySetup: function ()paymentRequestWithApplePay: function ()paymentRequestWithCardForm: function ()stripeInitialized: true__proto__: Object
ExceptionsManager.js:65 Cannot read property 'init' of undefined


If I run stripe.init() without any arguments which makes it fail as it should, I get this error:
ExceptionsManager.js:65 Failed options type: The options publishableKey is marked as required in Stripe.init, but its value is undefined.
What is going on?
Working now. It was a linking error. Make sure the Header Search Paths at the PROJECT level are linking to the Stripe ones in node_modules>tipsi-stripe>ios>TPSStripe.
A quick note for anyone looking for this type of solution in the future: most of the time when linking fails the project won't build. This will build but doesn't fail until it tries to initialize.
This could be handled better in the error code department. The problem doesn't fully manifest until it doesn't work. This is from Stripe.ios.js in node_modules:
init = (options = {}) => {
checkArgs(
types.initOptionsPropTypes,
options, 'options', 'Stripe.init'
)
this.stripeInitialized = true
// Here should test to see if TPSStripeManager exists first
if (TPSStripeManager)
return TPSStripeManager.init(options)
// Throw error like your library isn't linked properly
}
Thanks for this library. Very helpful!
Hi @GenericJam!
I just installed the library and came to this exact same issue. I can also log stripe and I can see the .init function available although it fails when I use it.
I have no clue what the Header Search Paths are or how to set them properly (I come from web development). Could you be more specific on how to set this correctly (through xCode or where)?
Thank you!
@wmonecke just start reading Installation guide
I agree you should follow the installation guide as that seems to work for most people but I tried both methods (pod and manual) and it didn't copy over the header search paths it needed to build properly. It will build but it doesn't get put into 'NativeModules' so it isn't there when tipsi-stripe tries to pull it out and you get the undefined or null type error when you try to use it.
Using this screen as a guide, you need to make sure the bottom one is on your list in the Header Search Paths. If you are new to Xcode, click on the folder at the top left of the left pane. This will bring you back to your project folder. Click on the folder at the top that has your project name (be careful you aren't on a sub-project folder as they also have all these settings), go to Build Settings in the center panel. Look here for reference of what it should look like. There will probably be lots of things in this so just do a search in the top right corner of the center panel for 'header search paths' or something similar and go to the results. Click on the paths section and it will pop up this little dialog (like in the first link) to allow you to edit them. You can either type it in manually or with Finder open you can drag the node_modules>tipsi-stripe>ios>TPSStripe folder into this dialog and it will link them itself.
That was what solved it for me. Apologies if any of these instructions are inaccurate as I'm doing it from memory as I'm not at work. Hopefully this fixes it for you.
Also, when in doubt clean your build and or build folders.
@GenericJam broken link http://docs.bluedotinnovation.com/display/DEVDOC10/iOS+-+Setting+the+Header+Search+Path
@hopewise
Try this:
https://docs.bluedot.io/ios-sdk/ios-faq-troubleshooting/

The screen looks like this:
https://i.stack.imgur.com/PDEAj.png
Thanks @GenericJam
@Genericjam Can you give me some help here please? It's been so many hours working on this and I still can't get it working...

@GenericJam
Most helpful comment
I agree you should follow the installation guide as that seems to work for most people but I tried both methods (pod and manual) and it didn't copy over the header search paths it needed to build properly. It will build but it doesn't get put into 'NativeModules' so it isn't there when tipsi-stripe tries to pull it out and you get the undefined or null type error when you try to use it.
Using this screen as a guide, you need to make sure the bottom one is on your list in the Header Search Paths. If you are new to Xcode, click on the folder at the top left of the left pane. This will bring you back to your project folder. Click on the folder at the top that has your project name (be careful you aren't on a sub-project folder as they also have all these settings), go to Build Settings in the center panel. Look here for reference of what it should look like. There will probably be lots of things in this so just do a search in the top right corner of the center panel for 'header search paths' or something similar and go to the results. Click on the paths section and it will pop up this little dialog (like in the first link) to allow you to edit them. You can either type it in manually or with Finder open you can drag the node_modules>tipsi-stripe>ios>TPSStripe folder into this dialog and it will link them itself.
That was what solved it for me. Apologies if any of these instructions are inaccurate as I'm doing it from memory as I'm not at work. Hopefully this fixes it for you.
Also, when in doubt clean your build and or build folders.