OPPCheckoutProvider
@interface OPPCheckoutProvider : NSObject
Abstract class for displaying an in-App payment page.
-
Checkout provider delegate.
Declaration
Objective-C
@property (nonatomic, weak) id<OPPCheckoutProviderDelegate> _Nullable delegate;
Swift
weak var delegate: (any OPPCheckoutProviderDelegate)? { get set }
-
Factory method to generate an
OPPCheckoutProvider
used for displaying an in-App payment pages.Declaration
Objective-C
+ (nullable instancetype) checkoutProviderWithPaymentProvider:(nonnull OPPPaymentProvider *)provider checkoutID:(nonnull NSString *)checkoutID settings: (nullable OPPCheckoutSettings *)settings;
Parameters
provider
The OPPPaymentProvider which is used for performing the transaction once all the data from the user is collected.
checkoutID
The checkout Id of the transaction. Must be not
nil
or empty.settings
The
OPPCheckoutSettings
used for these payment pages. These settings are provided to customize the appearance and functionality of the payment pages. Ifnil
, default settings will be created.Return Value
Returns an
OPPCheckoutProvider
for displaying in-App payment pages. Returnsnil
ifprovider
orcheckoutID
are not set. -
Designated initializer method to generate an
OPPCheckoutProvider
used for displaying an in-App payment pages.Declaration
Objective-C
- (nullable instancetype) initWithPaymentProvider:(nonnull OPPPaymentProvider *)provider checkoutID:(nonnull NSString *)checkoutID settings:(nullable OPPCheckoutSettings *)settings;
Swift
init?(paymentProvider provider: OPPPaymentProvider, checkoutID: String, settings: OPPCheckoutSettings?)
Parameters
provider
The OPPPaymentProvider which is used for performing the transaction once all the data from the user is collected.
checkoutID
The checkout Id of the transaction. Must be not
nil
or empty.settings
The
OPPCheckoutSettings
used for these payment pages. These settings are provided to customize the appearance and functionality of the payment pages. Ifnil
, default settings will be created.Return Value
Returns an
OPPCheckoutProvider
for displaying in-App payment pages. Returnsnil
ifprovider
orcheckoutID
are not set.
-
Opens an in-App payment page for collecting user input and submitting a transaction. First the list of payment methods from the checkout settings will be displayed.
Declaration
Objective-C
- (void)presentCheckoutForSubmittingTransactionCompletionHandler: (nonnull void (^)(OPPTransaction *_Nullable, NSError *_Nullable))completionHandler cancelHandler: (void (^_Nullable)(void)) cancelHandler;
Swift
func presentCheckout(forSubmittingTransactionCompletionHandler completionHandler: @escaping (OPPTransaction?, (any Error)?) -> Void, cancelHandler: (() -> Void)? = nil)
Parameters
completionHandler
A block executed when the transaction is completed. You need to send the request to your server to get the transaction status.
cancelHandler
A block executed if the user closes the payment page prematurely.
-
Opens an in-App payment page for collecting user input and submitting a transaction. Payment form for the choosen payment method will be opened. If no user input is required in app (e.g. PayPal), shopper will be redirected directly to the issuer web page.
Declaration
Objective-C
- (void)presentCheckoutWithPaymentBrand:(nonnull NSString *)paymentBrand loadingHandler:(void (^_Nullable)(BOOL))loadingHandler completionHandler: (nonnull void (^)(OPPTransaction *_Nullable, NSError *_Nullable)) completionHandler cancelHandler:(void (^_Nullable)(void))cancelHandler;
Swift
func presentCheckout(withPaymentBrand paymentBrand: String, loadingHandler: ((Bool) -> Void)?, completionHandler: @escaping (OPPTransaction?, (any Error)?) -> Void, cancelHandler: (() -> Void)? = nil)
Parameters
paymentBrand
The payment brand for transaction.
loadingHandler
A block executed whenever SDK sends request to the server or receives the response. You can start or stop loading animation based on
inProgress
parameter.completionHandler
A block executed when the transaction is completed. You need to send the request to your server to get the transaction status.
cancelHandler
A block executed if the user closes the payment page prematurely.
-
Closes the in-App payment page. The delegate is not informed if this method is being called.
Declaration
Objective-C
- (void)dismissCheckoutAnimated:(BOOL)animated completion:(void (^_Nullable)(void))completion;
Swift
func dismissCheckout(animated: Bool) async
Parameters
animated
Specifies whether the payment page should be dismissed using an animation or immediately without an animation.
completion
The completion handler, if provided, will be invoked after the checkout screen will be dismissed.