Skip to content

BTConfiguration.canMakeApplePayPayments and applePaySupportedNetworks are inaccessible (internal) in v6 #1671

@Smertowing

Description

@Smertowing

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:

  1. 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.

  2. 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 to public. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions