BTApplePayClient

Objective-C

@interface BTApplePayClient : NSObject

Swift

class BTApplePayClient : NSObject

Used to process Apple Pay payments

  • Creates an Apple Pay client.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAPIClient:(nonnull BTAPIClient *)apiClient;

    Swift

    init(apiClient: BTAPIClient)

    Parameters

    apiClient

    An API client

  • Unavailable

    Please use initWithAPIClient:

    Base initializer - do not use.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Creates a PKPaymentRequest with values from your Braintree Apple Pay configuration.

    It populates the following values of PKPaymentRequest: countryCode, currencyCode, merchantIdentifier, supportedNetworks.

    Declaration

    Objective-C

    - (void)paymentRequest:(nonnull void (^)(PKPaymentRequest *_Nullable,
                                             NSError *_Nullable))completion;

    Swift

    func paymentRequest() async throws -> PKPaymentRequest

    Parameters

    completion

    A completion block that returns the payment request or an error. This block is invoked on the main thread.

  • Tokenizes an Apple Pay payment.

    Declaration

    Objective-C

    - (void)tokenizeApplePayPayment:(nonnull PKPayment *)payment
                         completion:
                             (nonnull void (^)(BTApplePayCardNonce *_Nullable,
                                               NSError *_Nullable))completionBlock;

    Swift

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

    Parameters

    payment

    A PKPayment instance, typically obtained by presenting a PKPaymentAuthorizationViewController

    completionBlock

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