BTPaymentFlowDriver
Objective-C
@interface BTPaymentFlowDriver
: NSObject <BTAppContextSwitchDriver, BTPaymentFlowDriverDelegate>
Swift
class BTPaymentFlowDriver : NSObject, BTAppContextSwitchDriver, BTPaymentFlowDriverDelegate
BTPaymentFlowDriver handles the shared aspects of web/app payment flows.
Handles the app switching and shared logic for payment flows that use web or app switching.
-
Initialize a new BTPaymentFlowDriver 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;
-
Starts a payment flow using a BTPaymentFlowRequest (usually subclassed for specific payment methods).
Declaration
Objective-C
- (void)startPaymentFlow: (nonnull BTPaymentFlowRequest<BTPaymentFlowRequestDelegate> *) request completion:(nonnull void (^)(BTPaymentFlowResult *_Nullable, NSError *_Nullable))completionBlock;
Swift
func startPaymentFlow(_ request: BTPaymentFlowRequest & BTPaymentFlowRequestDelegate) async throws -> BTPaymentFlowResult
Parameters
request
A BTPaymentFlowRequest request.
completionBlock
This completion will be invoked exactly once when the payment flow is complete or an error occurs.
-
A required delegate to control the presentation and dismissal of view controllers.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<BTViewControllerPresentingDelegate> viewControllerPresentingDelegate;
Swift
weak var viewControllerPresentingDelegate: BTViewControllerPresentingDelegate? { get set }
-
Creates a stringified JSON object containing the information necessary to perform a lookup.
Declaration
Objective-C
- (void)prepareLookup: (nonnull BTPaymentFlowRequest<BTPaymentFlowRequestDelegate> *) request completion:(nonnull void (^)(NSString *_Nullable, NSError *_Nullable))completionBlock;
Swift
func prepareLookup(_ request: BTPaymentFlowRequest & BTPaymentFlowRequestDelegate) async throws -> String
Parameters
request
The BTThreeDSecureRequest object where prepareLookup was called.
completionBlock
This completion will be invoked exactly once with the client payload string or an error.
-
Initialize a challenge from a server side lookup call.
Declaration
Objective-C
- (void)initializeChallengeWithLookupResponse:(nonnull NSString *)lookupResponse request: (nonnull BTPaymentFlowRequest< BTPaymentFlowRequestDelegate> *) request completion: (nonnull void (^)( BTPaymentFlowResult *_Nullable, NSError *_Nullable))completionBlock;
Swift
func initializeChallenge(withLookupResponse lookupResponse: String, request: BTPaymentFlowRequest & BTPaymentFlowRequestDelegate) async throws -> BTPaymentFlowResult
Parameters
lookupResponse
The json string returned by the server side lookup.
request
The BTThreeDSecureRequest object where prepareLookup was called.
completionBlock
This completion will be invoked exactly once when the payment flow is complete or an error occurs.