PiaSDK
Objective-C
@interface PiaSDK : NSObject
#pragma mark Theme
/// Excludes given set of card schemes from supported card scheme set.
/// @param excludeOptionSet list of card schemes to exclude.
+ (void)excludeCardSchemeOptionSet:(CardScheme)excludeOptionSet;
/// Set a `theme` for a given `interfaceStyle`.
+ (void)setTheme:(id<PiaSDKTheme> _Nonnull)theme
forInterfaceStyle:(UIUserInterfaceStyle)interfaceStyle API_AVAILABLE(ios(13.0));
/// Set a `theme`.
+ (void)setTheme:(id<PiaSDKTheme> _Nonnull)theme;
/// Returns the Nets standard theme for given `interfaceStyle`.
+ (id<PiaSDKTheme>)netsThemeCopyForInterfaceStyle:(UIUserInterfaceStyle)interfaceStyle API_AVAILABLE(ios(12.0));
/// Returns the Nets standard theme.
+ (id<PiaSDKTheme>)netsThemeCopy;
#pragma mark Payment
/// Attempts to initiate a wallet payment and returns `true` if wallet app is installed.
/// @param walletPaymentProcess An object representing SDK supported wallet
/// @param walletURLCallback Callback with `walletURL` following registration with merchant backend
/// @param redirectWithoutInterruption Invoked when wallet-app redirects or user manually returns to app
/// @param failure Invoked if wallet-payment fails with error
+ (BOOL)launchWalletAppForWalletPaymentProcess:(WalletPaymentProcess *)walletPaymentProcess
walletURLCallback:(WalletURLCallback)walletURLCallback
redirectWithoutInterruption:(WalletRedirectWithoutInterruption)redirectWithoutInterruption
failure:(WalletFailureWithError)failure;
/// Returns SDK controller that presents the payment process to user
/// @param paymentProcess An object that identifies the payment process type
/// @param isCVCRequired Return according to configuration with Netaxept
/// @param transactionCallback Callback with result following registration with merchant backend
/// @param success Invoked if payment was completed with success. Commit payment following this.
/// @param cancellation Invoked if user cancelled the payment. Rollback payment following this.
/// @param failure Invoked if payment failed with an error. Rollback payment following this.
+ (UIViewController *)controllerForCardPaymentProcess:(CardPaymentProcess *)paymentProcess
isCVCRequired:(BOOL)isCVCRequired
transactionCallback:(TransactionCallback)transactionCallback
success:(CompletionCallback)success
cancellation:(CompletionCallback)cancellation
failure:(FailureCompletionCallback)failure
__deprecated_msg("Use `PiaSDK.controller(for:success:cancellation:failure)` instead");
// NOTE: The API below should replace all card related payment APIs.
// We don't need separate APIs, thats why we have the PaymentProcess object.
/// Returns SDK controller that presents the payment process to user
/// @param paymentProcess An object that identifies the payment process type
/// @param success Invoked if payment was completed with success. Commit payment following this.
/// @param cancellation Invoked if user cancelled the payment. Rollback payment following this.
/// @param failure Invoked if payment failed with an error. Rollback payment following this.
+ (UIViewController *)controllerForPaymentProcess:(PaymentProcess<PaymentRegistering> *)paymentProcess
success:(PaymentProcessCompletion)success
cancellation:(PaymentProcessCompletion)cancellation
failure:(PaymentProcessFailure)failure;
/// Returns SDK controller that presents the payment process to user
/// @param paymentProcess An object that identifies the payment process type
/// @param isCVCRequired Return according to configuration with Netaxept
/// @param transactionCallback Callback with result following registration with merchant backend
/// @param success Invoked if payment was completed with success. Commit payment following this.
/// @param cancellation Invoked if user cancelled the payment. Rollback payment following this.
/// @param failure Invoked if payment failed with an error. Rollback payment following this.
+ (UIViewController *)controllerForSBusinessCardPaymentProcess:(CardPaymentProcess *)paymentProcess
isCVCRequired:(BOOL)isCVCRequired
transactionCallback:(TransactionCallback)transactionCallback
success:(CompletionCallback)success
cancellation:(CompletionCallback)cancellation
failure:(FailureCompletionCallback)failure
__deprecated_msg("Use `PiaSDK.controller(for:success:cancellation:failure)` instead. Card payment and tokenization process can be set s-business initiated using the the `PaymentProcess` instance method `sBusiness()`. e.g. let cardProcess = CardPayment/CardStorage(…).sBusiness()");
/// Initiate payment with a stored card. If the payment requires 3DS authentication,
/// a webpage will be presented on the sender view controller.
///
/// It is recommended to show an activity indicator by passing `true` for `showsActivityIndicator`.
/// The same activity indicator can be presented using the API `showActivityIndicator(in:)`
/// while obtaining transaction ID from customer's merchant backend. The activity indicator will be
/// removed by the SDK before executing any of the completion blocks.
///
/// @param sender The `viewController` in which 3DS authentication is presented (if necessary)
/// @param isTestMode Is transaction to Netaxept test backend
/// @param showsActivityIndicator Show PiaSDK's standard activity indicator
/// @param merchantID Netaxept provided merchant ID
/// @param redirectURL Redirect URL used by 3DS to redirect user to the app
/// @param transactionID Transaction ID
/// @param success Success handler
/// @param cancellation Cancellation handler
/// @param failure Failure handler
///
+ (void)initiateTokenizedCardPayFrom:(UIViewController *)sender
testMode:(BOOL)isTestMode
showsActivityIndicator:(BOOL)showsActivityIndicator
merchantID:(NSString *)merchantID
redirectURL:(NSString *)redirectURL
transactionID:(NSString *)transactionID
success:(void(^)(void))success
cancellation:(void(^)(void))cancellation
failure:(void(^)(NPIError * _Nonnull))failure
__deprecated_msg("Use `PiaSDK.initiateCardPayment(with:success:cancellation:failure)` instead");
/// Initiate payment with a stored card. If the payment requires 3DS authentication,
/// a webpage will be presented on the sender view controller.
///
/// @param tokenizedCardPayment Tokenized card payment process
/// @param success Success handler
/// @param cancellation Cancellation handler
/// @param failure Failure handler
///
+ (void)initiateCardPaymentWithTokenizedCardExpressCheckout:(TokenizedCardExpressCheckout *)tokenizedCardPayment
success:(PaymentProcessCompletion)success
cancellation:(PaymentProcessCompletion)cancellation
failure:(PaymentProcessFailure)failure;
/// Returns SDK controller that presents the payment process to user
/// @param paymentProcess An object that identifies the payment process type
/// @param payPalRegistrationCallback Callback with result following registration with merchant backend
/// @param success Invoked if payment was completed with success. Commit payment following this.
/// @param cancellation Invoked if user cancelled the payment. Rollback payment following this.
/// @param failure Invoked if payment failed with an error. Rollback payment following this.
+ (UIViewController *)controllerForPayPalPaymentProcess:(PayPalPaymentProcess *)paymentProcess
payPalRegistrationCallback:(PayPalRegistrationCallback)payPalRegistrationCallback
success:(CompletionCallback)success
cancellation:(CompletionCallback)cancellation
failure:(FailureCompletionCallback)failure
__deprecated_msg("Use `PiaSDK.controller(for:success:cancellation:failure)` instead");
/// Returns SDK controller that presents the payment process to user
/// @param paymentProcess An object that identifies the payment process type
/// @param paytrailRegistrationCallback Callback with result following registration with merchant backend
/// @param success Invoked if payment was completed with success. Commit payment following this.
/// @param cancellation Invoked if user cancelled the payment. Rollback payment following this.
/// @param failure Invoked if payment failed with an error. Rollback payment following this.
+ (UIViewController *)controllerForPaytrailPaymentProcess:(PaytrailPaymentProcess *)paymentProcess
paytrailRegistrationCallback:(PaytrailRegistrationCallback)paytrailRegistrationCallback
success:(CompletionCallback)success
cancellation:(CompletionCallback)cancellation
failure:(FailureCompletionCallback)failure
__deprecated_msg("Use `PiaSDK.controller(for:success:cancellation:failure)` instead");
#pragma - mark Redirect From Wallet App
/// Notify SDK that app is opened from wallet app redirect.
/// @param redirectURL The redirect url received in `UIApplication:open url:options:`
/// @param options The options dictionary received in `UIApplication:open url:options:`
/// @return True if a redirect observer is registered with the SDK for the given `redirectURL`.
/// Returns `false` if URL query "wallet" in `redirectURL` does not match expected wallet name.
///
+ (BOOL)willHandleRedirectWith:(NSURL *)redirectURL andOptions:(NSDictionary *)options;
/// Show PiaSDK's standard transition view. User interaction within the bounds of
/// the transition view is absorbed.
/// Pass `UIApplication.shared.keyWindow.rootViewController` in order to block user-
/// interaction even in navigation bar button items.
/// @param viewController The view controller where transition view is added
///
+ (void)showActivityIndicatorIn:(UIViewController *)viewController
__deprecated_msg("Use `addTransitionViewIn:` instead");
/// Remove PiaSDK's standard activity indicator. User interaction in the
/// given `viewController` will be enabled and the activity indicator removed
///
+ (void)removeActivityIndicatorFrom:(UIViewController * _Nullable)viewController
__deprecated_msg("Use `removeTransitionView` instead");
/// Show PiaSDK's standard transition view. User interaction within the bounds of
/// the transition view is absorbed.
/// Pass `UIApplication.shared.keyWindow.rootViewController` in order to block user-
/// interaction even in navigation bar button items.
/// @param superView Super view for SDK's standard transition view with activity indicator.
///
+ (void)addTransitionViewIn:(UIView *)superView;
/// Removes PiaSDK's standard transition view (if found).
+ (void)removeTransitionView;
@end
Swift
class PiaSDK : NSObject
Undocumented
-
Excludes given set of card schemes from supported card scheme set.
Declaration
Objective-C
+ (void)excludeCardSchemeOptionSet:(CardScheme)excludeOptionSet;
Swift
class func excludeCardSchemeOptionSet(_ excludeOptionSet: CardScheme)
Parameters
excludeOptionSet
list of card schemes to exclude.
-
Set a
theme
for a giveninterfaceStyle
.Declaration
Objective-C
+ (void)setTheme:(id<PiaSDKTheme> _Nonnull)theme forInterfaceStyle:(UIUserInterfaceStyle)interfaceStyle;
Swift
class func setTheme(_ theme: PiaSDKTheme, for interfaceStyle: UIUserInterfaceStyle)
-
Set a
theme
.Declaration
Objective-C
+ (void)setTheme:(id<PiaSDKTheme> _Nonnull)theme;
Swift
class func setTheme(_ theme: PiaSDKTheme)
-
Returns the Nets standard theme for given
interfaceStyle
.Declaration
Objective-C
+ (nonnull id<PiaSDKTheme>)netsThemeCopyForInterfaceStyle: (UIUserInterfaceStyle)interfaceStyle;
Swift
class func netsThemeCopy(for interfaceStyle: UIUserInterfaceStyle) -> PiaSDKTheme
-
Returns the Nets standard theme.
Declaration
Objective-C
+ (nonnull id<PiaSDKTheme>)netsThemeCopy;
Swift
class func netsThemeCopy() -> PiaSDKTheme
-
Attempts to initiate a wallet payment and returns
true
if wallet app is installed.Declaration
Objective-C
+ (BOOL)launchWalletAppForWalletPaymentProcess: (nonnull WalletPaymentProcess *)walletPaymentProcess walletURLCallback: (nonnull WalletURLCallback)walletURLCallback redirectWithoutInterruption: (nonnull WalletRedirectWithoutInterruption) redirectWithoutInterruption failure:(nonnull WalletFailureWithError) failure;
Swift
class func launchWalletApp(for walletPaymentProcess: WalletPaymentProcess, walletURLCallback: @escaping WalletURLCallback, redirectWithoutInterruption: @escaping WalletRedirectWithoutInterruption, failure: @escaping WalletFailureWithError) -> Bool
Parameters
walletPaymentProcess
An object representing SDK supported wallet
walletURLCallback
Callback with
walletURL
following registration with merchant backendredirectWithoutInterruption
Invoked when wallet-app redirects or user manually returns to app
failure
Invoked if wallet-payment fails with error
-
Deprecated
Use
PiaSDK.controller(for:success:cancellation:failure)
insteadReturns SDK controller that presents the payment process to user
Declaration
Objective-C
+ (nonnull UIViewController *) controllerForCardPaymentProcess:(nonnull CardPaymentProcess *)paymentProcess isCVCRequired:(BOOL)isCVCRequired transactionCallback: (nonnull TransactionCallback)transactionCallback success:(nonnull CompletionCallback)success cancellation:(nonnull CompletionCallback)cancellation failure:(nonnull FailureCompletionCallback)failure;
Swift
class func controller(for paymentProcess: CardPaymentProcess, isCVCRequired: Bool, transactionCallback: @escaping TransactionCallback, success: @escaping CompletionCallback, cancellation: @escaping CompletionCallback, failure: @escaping FailureCompletionCallback) -> UIViewController
Parameters
paymentProcess
An object that identifies the payment process type
isCVCRequired
Return according to configuration with Netaxept
transactionCallback
Callback with result following registration with merchant backend
success
Invoked if payment was completed with success. Commit payment following this.
cancellation
Invoked if user cancelled the payment. Rollback payment following this.
failure
Invoked if payment failed with an error. Rollback payment following this.
-
Returns SDK controller that presents the payment process to user
Declaration
Objective-C
+ (nonnull UIViewController *) controllerForPaymentProcess: (nonnull PaymentProcess<PaymentRegistering> *)paymentProcess success:(nonnull PaymentProcessCompletion)success cancellation:(nonnull PaymentProcessCompletion)cancellation failure:(nonnull PaymentProcessFailure)failure;
Swift
class func controller(for paymentProcess: PaymentProcess & PaymentRegistering, success: @escaping PaymentProcessCompletion, cancellation: @escaping PaymentProcessCompletion, failure: @escaping PaymentProcessFailure) -> UIViewController
Parameters
paymentProcess
An object that identifies the payment process type
success
Invoked if payment was completed with success. Commit payment following this.
cancellation
Invoked if user cancelled the payment. Rollback payment following this.
failure
Invoked if payment failed with an error. Rollback payment following this.
-
+controllerForSBusinessCardPaymentProcess:
isCVCRequired: transactionCallback: success: cancellation: failure: Deprecated
Use
PiaSDK.controller(for:success:cancellation:failure)
instead. Card payment and tokenization process can be set s-business initiated using the thePaymentProcess
instance methodsBusiness()
. e.g. let cardProcess = CardPayment/CardStorage(…).sBusiness()Returns SDK controller that presents the payment process to user
Declaration
Objective-C
+ (nonnull UIViewController *) controllerForSBusinessCardPaymentProcess: (nonnull CardPaymentProcess *)paymentProcess isCVCRequired:(BOOL)isCVCRequired transactionCallback: (nonnull TransactionCallback)transactionCallback success:(nonnull CompletionCallback)success cancellation: (nonnull CompletionCallback)cancellation failure:(nonnull FailureCompletionCallback) failure;
Swift
class func controller(forSBusinessCardPaymentProcess paymentProcess: CardPaymentProcess, isCVCRequired: Bool, transactionCallback: @escaping TransactionCallback, success: @escaping CompletionCallback, cancellation: @escaping CompletionCallback, failure: @escaping FailureCompletionCallback) -> UIViewController
Parameters
paymentProcess
An object that identifies the payment process type
isCVCRequired
Return according to configuration with Netaxept
transactionCallback
Callback with result following registration with merchant backend
success
Invoked if payment was completed with success. Commit payment following this.
cancellation
Invoked if user cancelled the payment. Rollback payment following this.
failure
Invoked if payment failed with an error. Rollback payment following this.
-
+initiateTokenizedCardPayFrom:
testMode: showsActivityIndicator: merchantID: redirectURL: transactionID: success: cancellation: failure: Deprecated
Use
PiaSDK.initiateCardPayment(with:success:cancellation:failure)
insteadInitiate payment with a stored card. If the payment requires 3DS authentication, a webpage will be presented on the sender view controller.
It is recommended to show an activity indicator by passing
true
forshowsActivityIndicator
. The same activity indicator can be presented using the APIshowActivityIndicator(in:)
while obtaining transaction ID from customer’s merchant backend. The activity indicator will be removed by the SDK before executing any of the completion blocks.Declaration
Objective-C
+ (void)initiateTokenizedCardPayFrom:(nonnull UIViewController *)sender testMode:(BOOL)isTestMode showsActivityIndicator:(BOOL)showsActivityIndicator merchantID:(nonnull NSString *)merchantID redirectURL:(nonnull NSString *)redirectURL transactionID:(nonnull NSString *)transactionID success:(nonnull void (^)(void))success cancellation:(nonnull void (^)(void))cancellation failure: (nonnull void (^)(NPIError *_Nonnull))failure;
Swift
class func initiateTokenizedCardPay(from sender: UIViewController, testMode isTestMode: Bool, showsActivityIndicator: Bool, merchantID: String, redirectURL: String, transactionID: String, success: @escaping () -> Void, cancellation: @escaping () -> Void, failure: @escaping (NPIError) -> Void)
Parameters
sender
The
viewController
in which 3DS authentication is presented (if necessary)isTestMode
Is transaction to Netaxept test backend
showsActivityIndicator
Show PiaSDK’s standard activity indicator
merchantID
Netaxept provided merchant ID
redirectURL
Redirect URL used by 3DS to redirect user to the app
transactionID
Transaction ID
success
Success handler
cancellation
Cancellation handler
failure
Failure handler
-
Initiate payment with a stored card. If the payment requires 3DS authentication, a webpage will be presented on the sender view controller.
Declaration
Objective-C
+ (void) initiateCardPaymentWithTokenizedCardExpressCheckout: (nonnull TokenizedCardExpressCheckout *)tokenizedCardPayment success: (nonnull PaymentProcessCompletion) success cancellation: (nonnull PaymentProcessCompletion) cancellation failure: (nonnull PaymentProcessFailure) failure;
Swift
class func initiateCardPayment(with tokenizedCardPayment: TokenizedCardExpressCheckout, success: @escaping PaymentProcessCompletion, cancellation: @escaping PaymentProcessCompletion, failure: @escaping PaymentProcessFailure)
Parameters
tokenizedCardPayment
Tokenized card payment process
success
Success handler
cancellation
Cancellation handler
failure
Failure handler
-
Deprecated
Use
PiaSDK.controller(for:success:cancellation:failure)
insteadReturns SDK controller that presents the payment process to user
Declaration
Objective-C
+ (nonnull UIViewController *) controllerForPayPalPaymentProcess: (nonnull PayPalPaymentProcess *)paymentProcess payPalRegistrationCallback: (nonnull PayPalRegistrationCallback)payPalRegistrationCallback success:(nonnull CompletionCallback)success cancellation:(nonnull CompletionCallback)cancellation failure: (nonnull FailureCompletionCallback)failure;
Swift
class func controller(for paymentProcess: PayPalPaymentProcess, payPalRegistrationCallback: @escaping PayPalRegistrationCallback, success: @escaping CompletionCallback, cancellation: @escaping CompletionCallback, failure: @escaping FailureCompletionCallback) -> UIViewController
Parameters
paymentProcess
An object that identifies the payment process type
payPalRegistrationCallback
Callback with result following registration with merchant backend
success
Invoked if payment was completed with success. Commit payment following this.
cancellation
Invoked if user cancelled the payment. Rollback payment following this.
failure
Invoked if payment failed with an error. Rollback payment following this.
-
Deprecated
Use
PiaSDK.controller(for:success:cancellation:failure)
insteadReturns SDK controller that presents the payment process to user
Declaration
Objective-C
+ (nonnull UIViewController *) controllerForPaytrailPaymentProcess: (nonnull PaytrailPaymentProcess *)paymentProcess paytrailRegistrationCallback:(nonnull PaytrailRegistrationCallback) paytrailRegistrationCallback success:(nonnull CompletionCallback)success cancellation:(nonnull CompletionCallback)cancellation failure: (nonnull FailureCompletionCallback)failure;
Swift
class func controller(for paymentProcess: PaytrailPaymentProcess, paytrailRegistrationCallback: @escaping PaytrailRegistrationCallback, success: @escaping CompletionCallback, cancellation: @escaping CompletionCallback, failure: @escaping FailureCompletionCallback) -> UIViewController
Parameters
paymentProcess
An object that identifies the payment process type
paytrailRegistrationCallback
Callback with result following registration with merchant backend
success
Invoked if payment was completed with success. Commit payment following this.
cancellation
Invoked if user cancelled the payment. Rollback payment following this.
failure
Invoked if payment failed with an error. Rollback payment following this.
-
Notify SDK that app is opened from wallet app redirect.
Declaration
Objective-C
+ (BOOL)willHandleRedirectWith:(nonnull NSURL *)redirectURL andOptions:(nonnull NSDictionary *)options;
Swift
class func willHandleRedirect(with redirectURL: URL, andOptions options: [AnyHashable : Any] = [:]) -> Bool
Parameters
redirectURL
The redirect url received in
UIApplication:open url:options:
options
The options dictionary received in
UIApplication:open url:options:
Return Value
True if a redirect observer is registered with the SDK for the given
redirectURL
. Returnsfalse
if URL query “wallet” inredirectURL
does not match expected wallet name. -
Deprecated
Use
addTransitionViewIn:
insteadShow PiaSDK’s standard transition view. User interaction within the bounds of the transition view is absorbed. Pass
UIApplication.shared.keyWindow.rootViewController
in order to block user- interaction even in navigation bar button items.Declaration
Objective-C
+ (void)showActivityIndicatorIn:(nonnull UIViewController *)viewController;
Swift
class func showActivityIndicator(in viewController: UIViewController)
Parameters
viewController
The view controller where transition view is added
-
Deprecated
Use
removeTransitionView
insteadRemove PiaSDK’s standard activity indicator. User interaction in the given
viewController
will be enabled and the activity indicator removedDeclaration
Objective-C
+ (void)removeActivityIndicatorFrom:(UIViewController *_Nullable)viewController;
Swift
class func removeActivityIndicator(from viewController: UIViewController?)
-
Show PiaSDK’s standard transition view. User interaction within the bounds of the transition view is absorbed. Pass
UIApplication.shared.keyWindow.rootViewController
in order to block user- interaction even in navigation bar button items.Declaration
Objective-C
+ (void)addTransitionViewIn:(nonnull UIView *)superView;
Swift
class func addTransitionView(in superView: UIView)
Parameters
superView
Super view for SDK’s standard transition view with activity indicator.
-
Removes PiaSDK’s standard transition view (if found).
Declaration
Objective-C
+ (void)removeTransitionView;
Swift
class func removeTransitionView()
-
+makeApplePayPaymentRequestFor:
countryCode: applePayMerchantID: merchantCapabilities: currencyCode: summeryItems: Returns a
PKPaymentRequest
with all the obligatory fields set from the arguments. This helper ensures the request contains all the necessary fields. Mutate the request to add custom requirements (e.g. shipping contact) if necessary.Declaration
Objective-C
+ (nonnull PKPaymentRequest *) makeApplePayPaymentRequestFor:(nonnull NSArray<PKPaymentNetwork> *)networks countryCode:(nonnull NSString *)countryCode applePayMerchantID:(nonnull NSString *)applePayMerchantID merchantCapabilities:(PKMerchantCapability)merchantCapabilities currencyCode:(nonnull NSString *)currencyCode summeryItems:(nonnull NSArray<PKPaymentSummaryItem *> *) summeryItems;
Swift
class func makeApplePayPaymentRequest(for networks: [PKPaymentNetwork], countryCode: String, applePayMerchantID: String, merchantCapabilities: PKMerchantCapability, currencyCode: String, summeryItems: [PKPaymentSummaryItem]) -> PKPaymentRequest
-
Returns UTF-8 encoded string of
self
that’s formatted to fit in Netaxept’s (SOAP) Apple Pay API. The value can be passed in the payment-data field to Netaxept directly without further manipulation.Declaration
Objective-C
+ (nonnull NSString *)netaxeptSOAPPaymentDataFrom: (nonnull PKPaymentToken *)token;
Swift
class func netaxeptSOAPPaymentData(from token: PKPaymentToken) -> String
Parameters
token
PKPaymentToken generated in
PassKit
payment authorisation delegate