braintree / braintree-ios-drop-in

Braintree Drop-in for iOS
https://developers.braintreepayments.com
MIT License
98 stars 77 forks source link

vaultCard = false not working #414

Closed jfmwork closed 1 year ago

jfmwork commented 1 year ago

Braintree Drop-in SDK Version

9.8.2

Environment

Sandbox

Xcode Version

Version 14.3 (14E222b)

OS Version & Device

iPhone 14 Pro - iOS 16.4

Integration type

CocoaPods

Development Processor

Apple Silicon (M-series chips)

Describe the bug

We want our users to choose whether they can save or not a payment method. In the SDK documentation we found this:

/// Optional: Whether or not to vault the card upon tokenization, can only be applied when initializing the Braintree client with a client token that was generated with a customer ID. When set to `false` with `allowVaultCardOverride` set to `false`, then cards will not be vaulted.
/// Defaults to true
@property (nonatomic, assign) BOOL vaultCard;

We are creating our request like this:

let request = BTDropInRequest()
request.paypalDisabled = !parameters.payPalEnabled
request.applePayDisabled = !parameters.applePayEnabled
request.vaultManager = parameters.vaultManager
request.vaultCard = false
request.allowVaultCardOverride = false
request.threeDSecureRequest = createThreeDSecureRequest(for: parameters)

But the payment method is always vaulted. After completing a payment, we always see the payment method used in the recent section. And if we go to our web version, the payment method appears there as well.

For the web version, we are seeing the same behaviour with the vaultCard option.

We are doing it like this instead of creating a token without CustomerId because we would like to provide the following experience:

  1. The user can select whether to save the payment method before showing Braintree.
  2. If the user selects to not save the payment method but the user has some payment method saved, we want to show the saved payment methods.
  3. If the user pays after selecting to not save the payment method, the payment method is not saved.

Are we missing something?

Thanks!

To reproduce

  1. Create a client token with customerId.
  2. Create a Braintree request with vaultCard = false.
  3. Pay with a card in the sandbox environment.
  4. The card is saved even if vaultCard = false.

Expected behavior

I would expect the payment method to not be saved and to not appear on the Recent section of the Braintree Drop-In.

Screenshots

No response

jaxdesmarais commented 1 year ago

Hello @jfmwork -

We just ran a series of tests in our Demo app and are unable to replicate the behavior you are seeing on version 9.8.2. We updated to set vaultCard and allowVaultCardOverride to false on our DemoDropInViewController here. Additionally we updated our customer ID to pass in the value 123. Attempting to add a new card using the above resulted in the card not being vaulted or showing in the recent view.

Are you able to reproduce the behavior you are seeing in our Demo app? If so can you please send over steps to reproduce so we can troubleshoot the error further?

jfmwork commented 1 year ago

Hello!

Thanks for taking the time to answer! We found out that the problem was related to the backend and the use case that we want to implement. We have a meeting with people from Braintree Today to clarify it. You can close the issue.

Thanks!

jaxdesmarais commented 1 year ago

@jfmwork glad to hear things are working as expected now! 🥳