Closed mattgabriel closed 3 years ago
@mattgabriel You can use patch-package to patch the library and force this one to use Stripe ~> 21.4.0
Some extra changes need to be applied because Stripe is now in Swift.
diff --git a/node_modules/react-native-stripe-payments/ios/StripePayments.h b/node_modules/react-native-stripe-payments/ios/StripePayments.h
index f1d3301..322e3ec 100644
--- a/node_modules/react-native-stripe-payments/ios/StripePayments.h
+++ b/node_modules/react-native-stripe-payments/ios/StripePayments.h
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
-#import <Stripe/Stripe.h>
+@import Stripe;
@interface StripePayments : NSObject<RCTBridgeModule, STPAuthenticationContext>
diff --git a/node_modules/react-native-stripe-payments/ios/StripePayments.m b/node_modules/react-native-stripe-payments/ios/StripePayments.m
index d0142c2..7261999 100644
--- a/node_modules/react-native-stripe-payments/ios/StripePayments.m
+++ b/node_modules/react-native-stripe-payments/ios/StripePayments.m
@@ -8,7 +8,7 @@ @implementation StripePayments
RCT_EXPORT_METHOD(init:(NSString *)publishableKey)
{
- [Stripe setDefaultPublishableKey:publishableKey];
+ [StripeAPI setDefaultPublishableKey:publishableKey];
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isCardValid:(NSDictionary *)cardParams)
diff --git a/node_modules/react-native-stripe-payments/react-native-stripe-payments.podspec b/node_modules/react-native-stripe-payments/react-native-stripe-payments.podspec
index 2f2f6a3..7c9b694 100644
--- a/node_modules/react-native-stripe-payments/react-native-stripe-payments.podspec
+++ b/node_modules/react-native-stripe-payments/react-native-stripe-payments.podspec
@@ -19,6 +19,5 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.dependency "React"
- s.dependency "Stripe", "~> 19.0"
+ s.dependency "Stripe", "~> 21.4.0"
end
-
• Create the famous "Dummy" swift file (xcode -> open your project -> right click on the folder named after your project, where Info.plist resides -> new File -> Swift -> say YES when asked for the bridging header) • Remove the swift-5.0 search path, or you will get an error about undefined symbols (try it if you don't believe me), do this -> https://github.com/react-native-community/upgrade-support/issues/62#issuecomment-622985723
Ref: https://github.com/agaweb/react-native-stripe#additional-ios-setup
Everything should work after all of this !
I m facing the same issue solved by updating the latest version of the stripe library
Error:
'new' is unavailable: You cannot directly instantiate an STPIssuingCardPin
This is using react-native-stripe-payments version
1.0.6
. Which requires Stripe~>19.0
. Apparently Stripe issued a fix for this on version21.4.0
, however when trying to force react-native-stripe-payments to use this latest version (Podfile:pod 'Stripe', '~> 21.4.0'
) throws the error below:Any ideas?