BTApplePayClient

@objc
public class BTApplePayClient : NSObject

Used to process Apple Pay payments

Initializer

  • Creates an Apple Pay client

    Declaration

    Swift

    @objc(initWithAuthorization:)
    public init(authorization: String)

    Parameters

    authorization

    A client token or tokenization key

Public Methods

  • Creates a PKPaymentRequest with values from your Braintree Apple Pay configuration. It populates the following values of PKPaymentRequest: 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() Asynchronous

    Creates a PKPaymentRequest with values from your Braintree Apple Pay configuration. It populates the following values of PKPaymentRequest: countryCode, currencyCode, merchantIdentifier, supportedNetworks.

    Throws

    An Error describing the failure

    Declaration

    Swift

    public func makePaymentRequest() async throws -> PKPaymentRequest

    Return 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

    completion

    A completion block that returns true if Apple Pay is supported for the customer.

  • isApplePaySupported() Asynchronous

    Checks if Apple Pay is configured and available for the current merchant account and device.

    Declaration

    Swift

    public func isApplePaySupported() async -> Bool

    Return Value

    A Bool that 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

    payment

    A PKPayment instance, typically obtained by presenting a PKPaymentAuthorizationViewController

    completion

    A completion block that is invoked when tokenization has completed. If tokenization succeeds, we will return a BTApplePayCardNonce and error will be nil; if it fails, BTApplePayCardNonce will be nil and error will describe the failure.

  • tokenize(_:) Asynchronous

    Tokenizes an Apple Pay payment.

    Throws

    An Error describing the failure

    Declaration

    Swift

    public func tokenize(_ payment: PKPayment) async throws -> BTApplePayCardNonce

    Parameters

    payment

    A PKPayment instance, typically obtained by presenting a PKPaymentAuthorizationViewController

    Return Value

    A BTApplePayCardNonce