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

fix: Alert user if attempting to use methods before initializing Stripe #853

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix: use STPAPIClient.shared otherwise stuff breaks
  • Loading branch information
charliecruzan-stripe committed Apr 22, 2022
commit c0df213d6ec6b8d87859b5993ad18610c8d05299
9 changes: 5 additions & 4 deletions ios/StripeSdk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
let url = RCTConvert.nsString(appInfo["url"]) ?? ""

self.merchantIdentifier = merchantIdentifier

self.apiClient = STPAPIClient.init(publishableKey: publishableKey)
self.apiClient?.stripeAccount = stripeAccountId
self.apiClient?.appInfo = STPAppInfo(name: name, partnerId: partnerId, version: version, url: url)

STPAPIClient.shared.publishableKey = publishableKey
STPAPIClient.shared.stripeAccount = stripeAccountId
STPAPIClient.shared.appInfo = STPAppInfo(name: name, partnerId: partnerId, version: version, url: url)
self.apiClient = STPAPIClient.shared

self.paymentHandler = STPPaymentHandler.shared()
self.paymentHandler?.apiClient = self.apiClient!
Expand Down