BTPayPalClient
@objc
@MainActor
public class BTPayPalClient : BTWebAuthenticationSessionClient
extension BTPayPalClient: BTAppContextSwitchClient
-
Initialize a new PayPal client instance.
Declaration
Swift
@objc(initWithAuthorization:) @MainActor public init(authorization: String)Parameters
authorizationA valid client token or tokenization key used to authorize API calls.
-
Initialize a new PayPal client instance for the PayPal App Switch flow.
Warning
This initializer should be used for merchants using the PayPal App Switch flow. This feature is currently in beta and may change or be removed in future releases.Declaration
Swift
@objc(initWithAuthorization:universalLink:) @MainActor public convenience init(authorization: String, universalLink: URL)Parameters
authorizationA valid client token or tokenization key used to authorize API calls.
universalLinkThe URL to use for the PayPal app switch flow. Must be a valid HTTPS URL dedicated to Braintree app switch returns. This URL must be allow-listed in your Braintree Control Panel.
-
Tokenize a PayPal request to be used with the PayPal Vault flow.
Note
You can use this as the final step in your order/checkout flow. If you want, you may create a transaction from your server when this method completes without any additional user interaction.On success, you will receive an instance of
BTPayPalAccountNonce; on failure or user cancelation you will receive an error. If the user cancels out of the flow, the error code will be.canceled.Declaration
Swift
@objc(tokenizeWithVaultRequest:completion:) @MainActor public func tokenize( _ request: BTPayPalVaultRequest, completion: @escaping (BTPayPalAccountNonce?, Error?) -> Void )Parameters
requestcompletionThis completion will be invoked exactly once when tokenization is complete or an error occurs.
-
tokenize(_:Asynchronous) Tokenize a PayPal request to be used with the PayPal Vault flow.
Note
You can use this as the final step in your order/checkout flow. If you want, you may create a transaction from your server when this method completes without any additional user interaction.On success, you will receive an instance of
BTPayPalAccountNonce; on failure or user cancelation you will receive an error. If the user cancels out of the flow, the error code will be.canceled.Throws
AnErrordescribing the failureDeclaration
Swift
@MainActor public func tokenize(_ request: BTPayPalVaultRequest) async throws -> BTPayPalAccountNonceParameters
requestReturn Value
A
BTPayPalAccountNonceif successful -
Tokenize a PayPal request to be used with the PayPal Checkout or Pay Later flow.
Note
You can use this as the final step in your order/checkout flow. If you want, you may create a transaction from your server when this method completes without any additional user interaction.On success, you will receive an instance of
BTPayPalAccountNonce; on failure or user cancelation you will receive an error. If the user cancels out of the flow, the error code will be.canceled.Declaration
Swift
@objc(tokenizeWithCheckoutRequest:completion:) @MainActor public func tokenize( _ request: BTPayPalCheckoutRequest, completion: @escaping (BTPayPalAccountNonce?, Error?) -> Void )Parameters
requestcompletionThis completion will be invoked exactly once when tokenization is complete or an error occurs.
-
tokenize(_:Asynchronous) Tokenize a PayPal request to be used with the PayPal Checkout or Pay Later flow.
Note
You can use this as the final step in your order/checkout flow. If you want, you may create a transaction from your server when this method completes without any additional user interaction.On success, you will receive an instance of
BTPayPalAccountNonce; on failure or user cancelation you will receive an error. If the user cancels out of the flow, the error code will be.canceled.Throws
AnErrordescribing the failureDeclaration
Swift
@MainActor public func tokenize(_ request: BTPayPalCheckoutRequest) async throws -> BTPayPalAccountNonceParameters
requestReturn Value
A
BTPayPalAccountNonceif successful
View on GitHub