BTAPIClient
@objcMembers
public class BTAPIClient : NSObject, BTHTTPNetworkTiming
This class acts as the entry point for accessing the Braintree APIs via common HTTP methods performed on API endpoints.
Note
It also manages authentication via tokenization key and provides access to a merchant’s gateway configuration.-
The TokenizationKey or ClientToken used to authorize the APIClient
Declaration
Swift
public var authorization: ClientAuthorization
-
Client metadata that is used for tracking the client session
Declaration
Swift
public private(set) var metadata: BTClientMetadata { get }
-
Initialize a new API client.
Declaration
Swift
@objc(initWithAuthorization:) public init?(authorization: String)
Parameters
authorization
Your tokenization key or client token. Passing an invalid value may return
nil
.
-
Fetches a customer’s vaulted payment method nonces. Must be using client token with a customer ID specified.
Note
Only the top levelBTPaymentMethodNonce
type is returned, fetching any additional details will need to be done on the serverDeclaration
Swift
public func fetchPaymentMethodNonces(_ completion: @escaping ([BTPaymentMethodNonce]?, Error?) -> Void)
Parameters
completion
Callback that returns either an array of payment method nonces or an error
-
Fetches a customer’s vaulted payment method nonces. Must be using client token with a customer ID specified.
Declaration
Swift
public func fetchPaymentMethodNonces(_ defaultFirst: Bool, completion: @escaping ([BTPaymentMethodNonce]?, Error?) -> Void)