OPPCheckoutProviderDelegate
@protocol OPPCheckoutProviderDelegate <NSObject>
A protocol for additional checkout callbacks.
-
Called before submitting a transaction to the Server. Use this callback to recreate checkout for specific payment brand or abort transaction.
Declaration
Objective-C
- (void)checkoutProvider:(nonnull OPPCheckoutProvider *)checkoutProvider continueSubmitting:(nonnull OPPTransaction *)transaction completion: (nonnull void (^)(NSString *_Nullable, BOOL))completion;
Swift
optional func checkoutProvider(_ checkoutProvider: OPPCheckoutProvider, continueSubmitting transaction: OPPTransaction) async -> (String?, Bool)
Parameters
checkoutProvider
The instance of
OPPCheckoutProvider
that is calling delegate method.transaction
The transaction with masked sensitive data.
completion
The completion block you should call to continue submitting transaction or abort it. In case of abortion checkout will be closed with error
OPPErrorCodeTransactionAborted
. -
Called when card holder text field was changed or pressed Pay button on the payment detail view. Use this callback to override the internal card holder validation.
Declaration
Objective-C
- (BOOL)checkoutProvider:(nonnull OPPCheckoutProvider *)checkoutProvider validateCardHolder:(nullable NSString *)cardHolder;
Swift
optional func checkoutProvider(_ checkoutProvider: OPPCheckoutProvider, validateCardHolder cardHolder: String?) -> Bool
Parameters
checkoutProvider
The instance of
OPPCheckoutProvider
that is calling delegate method.cardHolder
The card holder value.
Return Value
YES
if the card holder is valid, otherwiseNO
.
-
Called when the user taps the ‘Done’ button on SFSafariViewController.
Declaration
Objective-C
- (void)checkoutProviderDidFinishSafariViewController: (nonnull OPPCheckoutProvider *)checkoutProvider;
Swift
optional func checkoutProviderDidFinishSafariViewController(_ checkoutProvider: OPPCheckoutProvider)
Parameters
checkoutProvider
The instance of
OPPCheckoutProvider
that is calling delegate method.
-
Called when a new shipping method was selected. The delegate must invoke the completion block with an updated array of
PKPaymentSummaryItem
objects.Declaration
Objective-C
- (void)checkoutProvider:(nonnull OPPCheckoutProvider *)checkoutProvider applePayDidSelectShippingMethod:(nonnull PKShippingMethod *)shippingMethod handler:(nonnull void (^)( OPPApplePayRequestShippingMethodUpdate *_Nonnull))completion;
Swift
optional func checkoutProvider(_ checkoutProvider: OPPCheckoutProvider, applePayDidSelect shippingMethod: PKShippingMethod) async -> OPPApplePayRequestShippingMethodUpdate
Parameters
checkoutProvider
The instance of
OPPCheckoutProvider
that is calling delegate method.shippingMethod
The shipping method for this transaction.
completion
The completion block you should call to update the shipping costs based on the shipping method.
-
Called when a new shipping address was selected. The delegate must invoke the completion block with an updated array of
PKPaymentSummaryItem
objects.Declaration
Objective-C
- (void)checkoutProvider:(nonnull OPPCheckoutProvider *)checkoutProvider applePayDidSelectShippingContact:(nonnull PKContact *)contact handler:(nonnull void (^)( OPPApplePayRequestShippingContactUpdate *_Nonnull))completion;
Swift
optional func checkoutProvider(_ checkoutProvider: OPPCheckoutProvider, applePayDidSelectShippingContact contact: PKContact) async -> OPPApplePayRequestShippingContactUpdate
Parameters
checkoutProvider
The instance of
OPPCheckoutProvider
that is calling delegate method.contact
The contact information needed for shipping.
completion
The completion block you should call to update the shipping address.
-
Called when the payment request was authorized. The delegate must invoke the completion block with an appropriate authorization status.
Declaration
Objective-C
- (void)checkoutProvider:(nonnull OPPCheckoutProvider *)checkoutProvider applePayDidAuthorizePayment:(nonnull PKPayment *)payment handler:(nonnull void (^)( OPPApplePayRequestAuthorizationResult *_Nonnull))completion;
Swift
optional func checkoutProvider(_ checkoutProvider: OPPCheckoutProvider, applePayDidAuthorizePayment payment: PKPayment) async -> OPPApplePayRequestAuthorizationResult
Parameters
checkoutProvider
The instance of
OPPCheckoutProvider
that is calling delegate method.payment
The result of authorizing a payment request and contains payment information, encrypted in the payment token.
completion
The completion block you should call with an appropriate authorization status.