BTPayPalClient
@objc
public class BTPayPalClient : BTWebAuthenticationSessionClient
extension BTPayPalClient: BTAppContextSwitchClient
-
Initialize a new PayPal client instance.
Declaration
Swift
@objc(initWithAPIClient:) public init(apiClient: BTAPIClient)
Parameters
apiClient
The API Client
-
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(initWithAPIClient:universalLink:) public convenience init(apiClient: BTAPIClient, universalLink: URL)
Parameters
apiClient
The API Client
universalLink
The 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:) public func tokenize( _ request: BTPayPalVaultRequest, completion: @escaping (BTPayPalAccountNonce?, Error?) -> Void )
Parameters
request
completion
This 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
AnError
describing the failureDeclaration
Swift
public func tokenize(_ request: BTPayPalVaultRequest) async throws -> BTPayPalAccountNonce
Parameters
request
Return Value
A
BTPayPalAccountNonce
if 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:) public func tokenize( _ request: BTPayPalCheckoutRequest, completion: @escaping (BTPayPalAccountNonce?, Error?) -> Void )
Parameters
request
completion
This 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
AnError
describing the failureDeclaration
Swift
public func tokenize(_ request: BTPayPalCheckoutRequest) async throws -> BTPayPalAccountNonce
Parameters
request
Return Value
A
BTPayPalAccountNonce
if successful