BTApplePayClient
@objc
public class BTApplePayClient : NSObject
Used to process Apple Pay payments
-
Creates an Apple Pay client
Declaration
Swift
@objc(initWithAuthorization:) public init(authorization: String)Parameters
authorizationA client token or tokenization key
-
Creates a
PKPaymentRequestwith 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
completionA completion block that returns the payment request or an error.
-
makePaymentRequest()AsynchronousCreates a
PKPaymentRequestwith values from your Braintree Apple Pay configuration. It populates the following values ofPKPaymentRequest:countryCode,currencyCode,merchantIdentifier,supportedNetworks.Throws
AnErrordescribing the failureDeclaration
Swift
public func makePaymentRequest() async throws -> PKPaymentRequestReturn Value
A
PKPaymentRequest -
Checks if Apple Pay is configured and available for the current merchant account and device.
Declaration
Swift
@objc(isApplePaySupported:) public func isApplePaySupported(completion: @escaping (Bool) -> Void)Parameters
completionA completion block that returns
trueif Apple Pay is supported for the customer. -
isApplePaySupported()AsynchronousChecks if Apple Pay is configured and available for the current merchant account and device.
Declaration
Swift
public func isApplePaySupported() async -> BoolReturn Value
A
Boolthat returns true if Apple Pay is supported for the customer. -
Tokenizes an Apple Pay payment.
Declaration
Swift
@objc(tokenizeApplePayPayment:completion:) public func tokenize(_ payment: PKPayment, completion: @escaping (BTApplePayCardNonce?, Error?) -> Void)Parameters
paymentA
PKPaymentinstance, typically obtained by presenting aPKPaymentAuthorizationViewControllercompletionA completion block that is invoked when tokenization has completed. If tokenization succeeds, we will return a
BTApplePayCardNonceanderrorwill benil; if it fails,BTApplePayCardNoncewill benilanderrorwill describe the failure. -
tokenize(_:Asynchronous) Tokenizes an Apple Pay payment.
Throws
AnErrordescribing the failureDeclaration
Swift
public func tokenize(_ payment: PKPayment) async throws -> BTApplePayCardNonceParameters
paymentA
PKPaymentinstance, typically obtained by presenting aPKPaymentAuthorizationViewControllerReturn Value
View on GitHub