OPPPaymentProvider
@interface OPPPaymentProvider : NSObject
Defines the methods and properties of the payment provider. Use the factory method +paymentProviderWithMode:
to instantiate a new provider.
-
Determines the type of Server to use. Transactions to the LIVE server come with fees attached.
Declaration
Objective-C
@property (nonatomic) OPPProviderMode mode;
Swift
var mode: OPPProviderMode { get set }
-
Delegate for processing the 3-D Secure transaction.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<OPPThreeDSEventListener> threeDSEventListener;
Swift
weak var threeDSEventListener: (any OPPThreeDSEventListener)? { get set }
-
Factory method to obtain a new provider.
Declaration
Objective-C
+ (nonnull instancetype)paymentProviderWithMode:(OPPProviderMode)mode;
Swift
convenience init(mode: OPPProviderMode)
Parameters
mode
Determines the type of Server to use. Transactions to the LIVE server come with fees attached.
Return Value
An
OPPPaymentProvider
which can be used to process transactions.
-
On sending a transaction, it is performed asynchronously using an
NSURLSession
to communicate with the Server. Depending on the endpoint the transaction will be submitted or registered only without making the payment.Declaration
Objective-C
- (void)sendTransaction:(nonnull OPPTransaction *)transaction toEndpoint:(nonnull NSString *)endpoint completionHandler:(nonnull void (^)(OPPTransaction *_Nonnull, NSError *_Nullable))completionHandler;
Swift
func send(_ transaction: OPPTransaction, toEndpoint endpoint: String) async throws -> OPPTransaction
Parameters
transaction
The transaction to be sent.
endpoint
The endpoint which will be used for processing transaction. The endpoint must start with a
"/"
.completionHandler
A block executed when the transaction is sent.
-
On submitting a transaction, it is performed asynchronously using an
NSURLSession
to communicate with the Server. Depending on the concrete type of the transaction, various calls to the server are necessary to ensure proper processing. Submitting means that the transaction is sent to the server, where it will cause a debit of the given amount on the account specified in theOPPTransaction
‘sOPPPaymentParams
.Declaration
Objective-C
- (void)submitTransaction:(nonnull OPPTransaction *)transaction completionHandler: (nonnull void (^)(OPPTransaction *_Nonnull, NSError *_Nullable))completionHandler;
Swift
func submitTransaction(_ transaction: OPPTransaction) async throws -> OPPTransaction
Parameters
transaction
The transaction to be submitted.
completionHandler
A block executed when the transaction is submitted.
-
On storing a payment data, it is performed asynchronously using an
NSURLSession
to communicate with the Server. The method creates a just registration separate from any later payment.Declaration
Objective-C
- (void)registerTransaction:(nonnull OPPTransaction *)transaction completionHandler: (nonnull void (^)(OPPTransaction *_Nonnull, NSError *_Nullable))completionHandler;
Swift
func register(_ transaction: OPPTransaction) async throws -> OPPTransaction
Parameters
transaction
The transaction to be registered.
completionHandler
A block executed when the transaction is registered.
-
Requests checkout details such as amount, currency and tokens from the Server by checkout ID. Request is performed asynchronously using an
NSURLSession
.Declaration
Objective-C
- (void)requestCheckoutInfoWithCheckoutID:(nonnull NSString *)checkoutID completionHandler: (nonnull void (^)(OPPCheckoutInfo *_Nullable, NSError *_Nullable)) completionHandler;
Swift
func requestCheckoutInfo(withCheckoutID checkoutID: String) async throws -> OPPCheckoutInfo
Parameters
checkoutID
The checkout ID of a transaction.
completionHandler
The completion block will be invoked once the response in received. On success, you will receive an instance of
OPPCheckoutInfo
; on failure, an error.
-
Requests logo URLs for specified payment brands. Request is performed asynchronously using an
NSURLSession
.Declaration
Objective-C
- (void)requestLogoURLsForPaymentBrands: (nonnull NSArray<NSString *> *)paymentBrands completionHandler: (nonnull void (^)( NSDictionary<NSString *, NSURL *> *_Nullable, NSError *_Nullable))completionHandler;
Swift
func requestLogoURLs(forPaymentBrands paymentBrands: [String]) async throws -> [String : URL]
Parameters
paymentBrands
The list of payment brands to get logos from the Server.
completionHandler
The completion block will be invoked once the response in received. On success, you will receive a dictionary with URLs in format
<paymentBrand: URL>
; on failure, an error.
-
Note
If you are using core SDK, please request checkout info by calling
-[OPPPaymentProvider requestCheckoutInfoWithCheckoutID:completionHandler:]
before requestBinInfo call. Checkout info call is essential part of the flow, error will be thrown otherwise.Declaration
Objective-C
- (void)requestBinInfoWithCheckoutID:(nonnull NSString *)checkoutID bin:(nonnull NSString *)bin completionHandler: (nonnull void (^)(OPPBinInfo *_Nullable, NSError *_Nullable))completionHandler;
Swift
func requestBinInfo(withCheckoutID checkoutID: String, bin: String) async throws -> OPPBinInfo
Parameters
checkoutID
The checkout ID of a transaction.
bin
First 6 or more digits of the card number.
completionHandler
The completion block will be invoked once the response in received. On success, you will receive an instance of
OPPBinInfo
; on failure, an error. -
Requests a list of iDeal banks.
This method is deprecated.
Declaration
Objective-C
- (void)requestIdealBanksWithCheckoutID:(nonnull NSString *)checkoutID completionHandler: (nonnull void (^)(NSArray<NSDictionary *> *_Nullable, NSError *_Nullable)) completionHandler;
Swift
func requestIdealBanks(withCheckoutID checkoutID: String) async throws -> [[AnyHashable : Any]]
Parameters
checkoutID
The checkout ID of a transaction.
completionHandler
The completion block which will be invoked once the response is received. On success, you will receive a list of banks in array, and on failure an error is received.
-
The ipworks3ds SDK performs security checks in order to provide a list of
Warning
objects. These can be checked by the app to determine whether or not to proceed with the checkout process.Declaration
Objective-C
- (void)securityWarningsWithCompletionHandler: (nonnull void (^)(NSArray<Warning *> *_Nullable, NSError *_Nullable))completionHandler;
Swift
func securityWarnings() async throws -> [Warning]
Parameters
completionHandler
The completion block will be invoked once the performing of security checks is done . On success, you will receive an instance of
Warning
; on failure, an error.
-
Determine whether this device can process Apple Pay payment requests using specific payment request. Your application should confirm that the user can make payments before attempting to authorize a payment. Your application may also want to alter its appearance or behavior when the user is not allowed to make payments.
Declaration
Objective-C
+ (BOOL)canSubmitPaymentRequest:(nonnull PKPaymentRequest *)request;
Swift
class func canSubmitPaymentRequest(_ request: PKPaymentRequest) -> Bool
Parameters
request
The return value of this method depends on the
supportedNetworks
property of this payment request.Return Value
YES
if the user can authorize payments on this device using the payment request.NO
if the user cannot authorize payments on these networks or if the user is restricted from authorizing payments. -
Whether or not this device is capable of using Apple Pay. This checks both whether the user is running an iPhone 6/6+ or later, iPad Air 2 or later, or iPad mini 3 or later, as well as whether or not they have stored any cards in Apple Pay on their device.
Declaration
Objective-C
+ (BOOL)deviceSupportsApplePay;
Swift
class func deviceSupportsApplePay() -> Bool
Return Value
Whether or not the user is currently able to pay with Apple Pay.
-
A convenience method to return a
PKPaymentRequest
with sane default values. You will still need to configure thepaymentSummaryItems
property to indicate what the user is purchasing.Declaration
Objective-C
+ (nonnull PKPaymentRequest *) paymentRequestWithMerchantIdentifier:(nonnull NSString *)merchantIdentifier countryCode:(nonnull NSString *)countryCode;
Swift
class func paymentRequest(withMerchantIdentifier merchantIdentifier: String, countryCode: String) -> PKPaymentRequest
Parameters
merchantIdentifier
Your Apple Merchant ID, as obtained at https://developer.apple.com/account/ios/identifiers/merchant/merchantCreate.action
countryCode
The merchant’s ISO country code. We suggest using the country where your business is located.
Return Value
A
PKPaymentRequest
with proper default values.
-
A convenience method to check if Touch ID, Face ID or passcode are set on user device.
Declaration
Objective-C
+ (BOOL)isDeviceAuthenticationAvailable;
Swift
class func isDeviceAuthenticationAvailable() -> Bool
Return Value
NO
if neither Touch ID/Face ID nor passcode are set, otherwiseYES
. -
Requests a Apple’s recurring payments tokenId.
Declaration
Objective-C
- (void)requestApplesTokenIdWithCheckoutID:(nonnull NSString *)checkoutID completionHandler: (nonnull void (^)(NSString *_Nullable, NSError *_Nullable)) completionHandler;
Swift
func requestApplesTokenId(withCheckoutID checkoutID: String) async throws -> String
Parameters
checkoutID
The checkout ID of a transaction.
completionHandler
The completion block which will be invoked once the response is received. On success, you will receive a tokenId, and on failure an error is received.
-
Requests a Checkout payment data
Declaration
Objective-C
- (void)requestCheckoutDataWithCheckoutID:(nonnull NSString *)checkoutID completionHandler: (nonnull void (^)(OPPCheckoutData *_Nullable, NSError *_Nullable)) completionHandler;
Swift
func requestCheckoutData(withCheckoutID checkoutID: String) async throws -> OPPCheckoutData
Parameters
checkoutID
The checkout ID of a transaction.
completionHandler
The completion block which will be invoked once the response is received. On success, you will receive an OPPCheckoutData ojbect with payment data, and on failure an error is received.