Reputation: 1
Does anyone know how I can fetch all payment methods from a Braintree vault?
Using BTDropInResult.fetch
, I can fetch the latest payment method, but not all. See below:
BTDropInResult.fetch(forAuthorization: clientToken, handler: { (result, error) in
if (error != nil) {
let message = error?.localizedDescription
print (message)
} else if let result = result {
print(result) // latest payment method
} else {
}
})
Upvotes: 0
Views: 393
Reputation: 298
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact [email protected].
You can fetch all payment methods for a customer from the iOS client with fetchPaymentMethodNonces
(or fetchPaymentMethodNonces:completion
, which has an additional option, defaultFirst
, to control whether the customer's default or their last used payment method is the first in the returned array). Both methods are documented here: http://cocoadocs.org/docsets/Braintree/4.7.5/Classes/BTAPIClient.html#//api/name/fetchPaymentMethodNonces.
These methods will only return payment methods if you have passed a customer ID in the client token used to instantiate the BTAPIClient object.
Upvotes: 1