BTPayPalDriver
Objective-C
@interface BTPayPalDriver : NSObject
Swift
class BTPayPalDriver : NSObject
Used to tokenize PayPal accounts.
-
Initialize a new PayPal driver instance.
Declaration
Objective-C
- (nonnull instancetype)initWithAPIClient:(nonnull BTAPIClient *)apiClient;
Swift
init(apiClient: BTAPIClient)
Parameters
apiClient
The API client
-
Unavailable
Please use initWithAPIClient:
Base initializer - do not use.
Declaration
Objective-C
- (nonnull instancetype)init;
-
Deprecated
Use tokenizePayPalAccount instead.
Check out with PayPal to create a single-use PayPal payment method nonce.
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 beBTPayPalDriverErrorTypeCanceled
.Declaration
Objective-C
- (void)requestOneTimePayment:(nonnull BTPayPalCheckoutRequest *)request completion: (nonnull void (^)(BTPayPalAccountNonce *_Nullable, NSError *_Nullable))completionBlock;
Swift
func requestOneTimePayment(_ request: BTPayPalCheckoutRequest) async throws -> BTPayPalAccountNonce
Parameters
request
A PayPal Checkout request
completionBlock
This completion will be invoked exactly once when checkout is complete or an error occurs.
-
Deprecated
Use tokenizePayPalAccount instead.
Create a PayPal Billing Agreement for repeat purchases.
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 beBTPayPalDriverErrorTypeCanceled
.Declaration
Objective-C
- (void)requestBillingAgreement:(nonnull BTPayPalVaultRequest *)request completion: (nonnull void (^)(BTPayPalAccountNonce *_Nullable, NSError *_Nullable))completionBlock;
Swift
func requestBillingAgreement(_ request: BTPayPalVaultRequest) async throws -> BTPayPalAccountNonce
Parameters
request
A PayPal Vault request
completionBlock
This completion will be invoked exactly once when checkout is complete or an error occurs.
-
Tokenize a PayPal account for vault or checkout.
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 beBTPayPalDriverErrorTypeCanceled
.Declaration
Objective-C
- (void)tokenizePayPalAccountWithPayPalRequest: (nonnull BTPayPalRequest *)request completion: (nonnull void (^)( BTPayPalAccountNonce *_Nullable, NSError *_Nullable))completionBlock;
Swift
func tokenizePayPalAccount(with request: BTPayPalRequest) async throws -> BTPayPalAccountNonce
Parameters
request
Either a BTPayPalCheckoutRequest or a BTPayPalVaultRequest
completionBlock
This completion will be invoked exactly once when tokenization is complete or an error occurs.