@@ -936,6 +936,11 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
936
936
resolver resolve: @escaping RCTPromiseResolveBlock ,
937
937
rejecter reject: @escaping RCTPromiseRejectBlock
938
938
) -> Void {
939
+ guard let apiClient = apiClient else {
940
+ resolve ( StripeSdk . MISSING_INIT_ERROR)
941
+ return
942
+ }
943
+
939
944
let amounts = params [ " amounts " ] as? NSArray
940
945
let descriptorCode = params [ " descriptorCode " ] as? String
941
946
@@ -950,14 +955,14 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
950
955
return
951
956
}
952
957
if ( isPaymentIntent) {
953
- STPAPIClient . shared . verifyPaymentIntentWithMicrodeposits (
958
+ apiClient . verifyPaymentIntentWithMicrodeposits (
954
959
clientSecret: clientSecret as String ,
955
960
firstAmount: amounts [ 0 ] as! Int ,
956
961
secondAmount: amounts [ 1 ] as! Int ,
957
962
completion: onCompletePaymentVerification
958
963
)
959
964
} else {
960
- STPAPIClient . shared . verifySetupIntentWithMicrodeposits (
965
+ apiClient . verifySetupIntentWithMicrodeposits (
961
966
clientSecret: clientSecret as String ,
962
967
firstAmount: amounts [ 0 ] as! Int ,
963
968
secondAmount: amounts [ 1 ] as! Int ,
@@ -966,13 +971,13 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
966
971
}
967
972
} else if let descriptorCode = descriptorCode {
968
973
if ( isPaymentIntent) {
969
- STPAPIClient . shared . verifyPaymentIntentWithMicrodeposits (
974
+ apiClient . verifyPaymentIntentWithMicrodeposits (
970
975
clientSecret: clientSecret as String ,
971
976
descriptorCode: descriptorCode,
972
977
completion: onCompletePaymentVerification
973
978
)
974
979
} else {
975
- STPAPIClient . shared . verifySetupIntentWithMicrodeposits (
980
+ apiClient . verifySetupIntentWithMicrodeposits (
976
981
clientSecret: clientSecret as String ,
977
982
descriptorCode: descriptorCode,
978
983
completion: onCompleteSetupVerification
0 commit comments