BTApplePayClient
@objc
public class BTApplePayClient : NSObject
Used to process Apple Pay payments
-
Creates an Apple Pay client
Declaration
Swift
@objc(initWithAPIClient:) public init(apiClient: BTAPIClient)
Parameters
apiClient
An API client
-
Creates a
PKPaymentRequest
with values from your Braintree Apple Pay configuration. It populates the following values ofPKPaymentRequest
:countryCode
,currencyCode
,merchantIdentifier
,supportedNetworks
.Declaration
Swift
@objc(makePaymentRequest:) public func makePaymentRequest(completion: @escaping (PKPaymentRequest?, Error?) -> Void)
Parameters
completion
A completion block that returns the payment request or an error.
-
makePaymentRequest()
AsynchronousCreates a
PKPaymentRequest
with values from your Braintree Apple Pay configuration. It populates the following values ofPKPaymentRequest
:countryCode
,currencyCode
,merchantIdentifier
,supportedNetworks
.Throws
AnError
describing the failureDeclaration
Swift
public func makePaymentRequest() async throws -> PKPaymentRequest
Return Value
A
PKPaymentRequest
-
Tokenizes an Apple Pay payment.
Declaration
Swift
@objc(tokenizeApplePayPayment:completion:) public func tokenize(_ payment: PKPayment, completion: @escaping (BTApplePayCardNonce?, Error?) -> Void)
Parameters
payment
A
PKPayment
instance, typically obtained by presenting aPKPaymentAuthorizationViewController
completion
A completion block that is invoked when tokenization has completed. If tokenization succeeds, we will return a
BTApplePayCardNonce
anderror
will benil
; if it fails,BTApplePayCardNonce
will benil
anderror
will describe the failure. -
tokenize(_:
Asynchronous) Tokenizes an Apple Pay payment.
Throws
AnError
describing the failureDeclaration
Swift
public func tokenize(_ payment: PKPayment) async throws -> BTApplePayCardNonce
Parameters
payment
A
PKPayment
instance, typically obtained by presenting aPKPaymentAuthorizationViewController
Return Value