PiaSDKDelegate
Deprecated
Migrate to declarative APIs in PiaSDK namespace
Objective-C
@protocol PiaSDKDelegate <UINavigationControllerDelegate>
Swift
protocol PiaSDKDelegate : UINavigationControllerDelegate
The PiaSDK protocol provides a mechanism for your application to take action on events that occur in both payment and saving card processes. You can make use of these calls by assigning an object to the PiaSDK’ delegate property directly.
-
Before the actual payment, the app should register the payment in it’s own backend. This method will get called when the sdk needs the app to do that.
Declaration
Objective-C
- (void)doInitialAPICall:(PiaSDKController *_Nonnull)piaSDKController storeCard:(BOOL)storeCard withCompletion:(void (^_Nonnull)(NPITransactionInfo *_Nullable)) completionHandler;
Swift
func doInitialAPICall(_ piaSDKController: PiaSDKController, storeCard: Bool) async -> NPITransactionInfo?
Parameters
storeCard
Boolean value determines if card should be saved for later uses (chosen by user). Note: this value will always be TRUE if process is saving card
-
This method will get called if the chosen payment type will be PayPal.
Declaration
Objective-C
- (void)registerPaymentWithPayPal:(PiaSDKController *_Nonnull)piaSDKController withCompletion: (void (^_Nonnull)(NPITransactionInfo *_Nullable)) completionHandler;
Swift
func registerPayment(withPayPal piaSDKController: PiaSDKController) async -> NPITransactionInfo?
-
This method will get called if the chosen payment type will be Finnish bank payment.
Declaration
Objective-C
- (void)registerPaymentWithPaytrail:(PiaSDKController *_Nonnull)piaSDKController withCompletion: (void (^_Nonnull)(NPITransactionInfo *_Nullable)) completionHandler;
Swift
func registerPayment(withPaytrail piaSDKController: PiaSDKController) async -> NPITransactionInfo?
-
Will get called if, for whatever reason, the payment process fails. Check the error code to see what went wrong (both saving card and payment).
Declaration
Objective-C
- (void)PiaSDK:(PiaSDKController *_Nonnull)piaSDKController didFailWithError:(NPIError *_Nonnull)error;
Swift
func piaSDK(_ piaSDKController: PiaSDKController, didFailWithError error: NPIError)
-
Will get called if payment process goes well.
Declaration
Objective-C
- (void)PiaSDKDidCompleteWithSuccess: (PiaSDKController *_Nonnull)piaSDKController;
Swift
func piaSDKDidComplete(withSuccess piaSDKController: PiaSDKController)
-
Will get called if saving card process goes well.
Declaration
Objective-C
- (void)PiaSDKDidCompleteSaveCardWithSuccess: (PiaSDKController *_Nonnull)piaSDKController;
Swift
func piaSDKDidCompleteSaveCard(withSuccess piaSDKController: PiaSDKController)
-
Will get called if user decides to cancel the process (both saving card and payment)
Declaration
Objective-C
- (void)PiaSDKDidCancel:(PiaSDKController *_Nonnull)piaSDKController;
Swift
func piaSDKDidCancel(_ piaSDKController: PiaSDKController)
-
Will get called if user decides to change the shipping contact inside Apple Pay process
Declaration
Objective-C
- (void)PiaSDK:(PiaSDKController *_Nonnull)piaSDKController didChangeApplePayShippingContact:(PKContact *_Nonnull)contact withCompletion: (void (^_Nonnull)(BOOL, NSDecimalNumber *_Nullable)) completionHandler;
Swift
optional func piaSDK(_ piaSDKController: PiaSDKController, didChangeApplePayShippingContact contact: PKContact) async -> (Bool, NSDecimalNumber?)
Parameters
contact
PKContact object returned by Apple Pay after user changed the shipping contact