-
Notifications
You must be signed in to change notification settings - Fork 309
Description
Braintree SDK Version
6.39.0
Environment
Both
Xcode Version
16.4
OS Version & Device
No response
Integration type
Prebuilt Binaries / Other
Development Processor
Both
Describe the bug
While migrating our app from an older Objective-C implementation to v6 of the SDK with Swift, I discovered that BTConfiguration.canMakeApplePayPayments
is now internal
. This prevents us from checking whether Apple Pay is configured and available for the current merchant account and device.
A potential workaround using Apple's native PKPaymentAuthorizationViewController.canMakePayments(usingNetworks:)
directly is also blocked because the required BTConfiguration.applePaySupportedNetworks
property is also internal
. This is a regression from Objective-C versions where these properties were public
.
We were using this property to determine if the user's Apple Pay method is supported by Braintree for our merchant account, and we want to avoid hardcoding payment networks on the client side. This leads to two main questions:
-
Was this an intentional API change in v6? I noticed
canMakeApplePayPayments
does not appear to be used anywhere within the SDK itself, which led me to wonder if its removal from the public API was an oversight. -
Is it safe to use a local patch? As a temporary workaround, I'm considering forking the repository and changing the protection level of
canMakeApplePayPayments
topublic
. Are there any potential risks or side effects we should be aware of with this approach?
To reproduce
Steps to reproduce the behavior:
- Integrate Braintree iOS SDK v6.x into a Swift project.
- Attempt to access
configuration.canMakeApplePayPayments
. - The compiler will produce the error:
'canMakeApplePayPayments' is inaccessible due to 'internal' protection level
.
Example Code:
import Braintree
// ...
let braintreeApiClient = BTApplePayClient(apiClient:)
braintreeApiClient.fetchOrReturnRemoteConfiguration { (configuration, error) in
guard let configuration = configuration, error == nil else {
// Handle error
return
}
// 🛑 This line fails to compile in v6
let isApplePayAvailable = configuration.canMakeApplePayPayments
// We use this value to decide whether we have an Apple Pay option available or not, and render the UI accordingly
}
Expected behavior
I expect BTConfiguration.canMakeApplePayPayments
to be a public
property, just as it was in the Objective-C versions. This would provide a simple, reliable way to determine if the Apple Pay payment option should be displayed in the UI.
Screenshots
No response