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
OPPCheckoutProviderused 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
providerThe OPPPaymentProvider which is used for performing the transaction once all the data from the user is collected.
checkoutIDThe checkout Id of the transaction. Must be not
nilor empty.settingsThe
OPPCheckoutSettingsused 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
OPPCheckoutProviderfor displaying in-App payment pages. ReturnsnilifproviderorcheckoutIDare not set. -
Designated initializer method to generate an
OPPCheckoutProviderused 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
providerThe OPPPaymentProvider which is used for performing the transaction once all the data from the user is collected.
checkoutIDThe checkout Id of the transaction. Must be not
nilor empty.settingsThe
OPPCheckoutSettingsused 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
OPPCheckoutProviderfor displaying in-App payment pages. ReturnsnilifproviderorcheckoutIDare 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
completionHandlerA block executed when the transaction is completed. You need to send the request to your server to get the transaction status.
cancelHandlerA 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
paymentBrandThe payment brand for transaction.
loadingHandlerA block executed whenever SDK sends request to the server or receives the response. You can start or stop loading animation based on
inProgressparameter.completionHandlerA block executed when the transaction is completed. You need to send the request to your server to get the transaction status.
cancelHandlerA 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) asyncParameters
animatedSpecifies whether the payment page should be dismissed using an animation or immediately without an animation.
completionThe completion handler, if provided, will be invoked after the checkout screen will be dismissed.
OPPCheckoutProvider Class Reference