react-native-payengine 2.0.16 → 2.0.18-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +96 -65
  2. package/android/.gradle/checksums/checksums.lock +0 -0
  3. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  5. package/android/build.gradle +2 -2
  6. package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +65 -3
  7. package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +1 -0
  8. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +16 -3
  9. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +15 -4
  10. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
  11. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
  12. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
  13. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +430 -133
  14. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
  15. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +1848 -5121
  16. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +35 -117
  17. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +35 -117
  18. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  19. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +35 -117
  20. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +35 -117
  21. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
  22. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  23. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
  24. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
  25. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
  26. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +860 -266
  27. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
  28. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1848 -5121
  29. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +35 -117
  30. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +35 -117
  31. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  32. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +35 -117
  33. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +35 -117
  34. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1848 -5121
  35. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +35 -117
  36. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +35 -117
  37. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  38. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +35 -117
  39. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +35 -117
  40. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
  41. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  42. package/ios/Sources/Classes/RNPEEventEmitter.swift +1 -1
  43. package/ios/Sources/Classes/RNPayEngineNative.swift +125 -64
  44. package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +1 -0
  45. package/ios/Sources/Payengine.m +6 -0
  46. package/lib/commonjs/components/PayEngine.js +1 -1
  47. package/lib/commonjs/components/PayEngine.js.map +1 -1
  48. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +124 -0
  49. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  50. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js +78 -0
  51. package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
  52. package/lib/commonjs/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
  53. package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +53 -0
  54. package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
  55. package/lib/commonjs/components/v2/PEPaymentRequest.js +121 -0
  56. package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -1
  57. package/lib/commonjs/components/v2/PayEngineNative.js +182 -4
  58. package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -1
  59. package/lib/commonjs/components/v2/PayEngineProvider.js +52 -0
  60. package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -1
  61. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +71 -0
  62. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -1
  63. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +82 -0
  64. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -1
  65. package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -1
  66. package/lib/commonjs/components/v2/SecureFields/ITokenizationData.js.map +1 -1
  67. package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -1
  68. package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -1
  69. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +20 -3
  70. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
  71. package/lib/commonjs/index.js +17 -13
  72. package/lib/commonjs/index.js.map +1 -1
  73. package/lib/commonjs/interfaces/index.js +20 -0
  74. package/lib/commonjs/interfaces/index.js.map +1 -1
  75. package/lib/commonjs/utils/index.js +26 -0
  76. package/lib/commonjs/utils/index.js.map +1 -1
  77. package/lib/module/components/PayEngine.js +1 -1
  78. package/lib/module/components/PayEngine.js.map +1 -1
  79. package/lib/module/components/v2/ApplePay/PEApplePayButton.js +124 -0
  80. package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
  81. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js +75 -0
  82. package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
  83. package/lib/module/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
  84. package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +53 -0
  85. package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
  86. package/lib/module/components/v2/PEPaymentRequest.js +119 -0
  87. package/lib/module/components/v2/PEPaymentRequest.js.map +1 -1
  88. package/lib/module/components/v2/PayEngineNative.js +184 -5
  89. package/lib/module/components/v2/PayEngineNative.js.map +1 -1
  90. package/lib/module/components/v2/PayEngineProvider.js +51 -0
  91. package/lib/module/components/v2/PayEngineProvider.js.map +1 -1
  92. package/lib/module/components/v2/SecureFields/BankAccountView.js +71 -0
  93. package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -1
  94. package/lib/module/components/v2/SecureFields/CreditCardView.js +82 -0
  95. package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -1
  96. package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -1
  97. package/lib/module/components/v2/SecureFields/ITokenizationData.js.map +1 -1
  98. package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -1
  99. package/lib/module/components/v2/SecureFields/PECard.js.map +1 -1
  100. package/lib/module/components/v2/SecureFields/PEKeyboardType.js +16 -1
  101. package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
  102. package/lib/module/index.js +10 -5
  103. package/lib/module/index.js.map +1 -1
  104. package/lib/module/interfaces/index.js +19 -0
  105. package/lib/module/interfaces/index.js.map +1 -1
  106. package/lib/module/utils/index.js +27 -0
  107. package/lib/module/utils/index.js.map +1 -1
  108. package/lib/typescript/components/PayEngine.d.ts +1 -1
  109. package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +217 -12
  110. package/lib/typescript/components/v2/ApplePay/PEApplePayInterfaces.d.ts +180 -1
  111. package/lib/typescript/components/v2/GooglePay/PEGooglePayAddress.d.ts +30 -0
  112. package/lib/typescript/components/v2/GooglePay/PEGooglePayButton.d.ts +99 -0
  113. package/lib/typescript/components/v2/PEPaymentRequest.d.ts +130 -9
  114. package/lib/typescript/components/v2/PayEngineNative.d.ts +165 -7
  115. package/lib/typescript/components/v2/PayEngineProvider.d.ts +51 -0
  116. package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +103 -0
  117. package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +114 -0
  118. package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +49 -0
  119. package/lib/typescript/components/v2/SecureFields/ITokenizationData.d.ts +14 -0
  120. package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +36 -0
  121. package/lib/typescript/components/v2/SecureFields/PECard.d.ts +44 -0
  122. package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +16 -1
  123. package/lib/typescript/index.d.ts +11 -5
  124. package/lib/typescript/interfaces/index.d.ts +35 -1
  125. package/lib/typescript/utils/index.d.ts +21 -0
  126. package/package.json +6 -3
  127. package/react-native-payengine.podspec +1 -1
  128. package/src/components/PayEngine.tsx +1 -1
  129. package/src/components/v2/ApplePay/PEApplePayButton.tsx +225 -12
  130. package/src/components/v2/ApplePay/PEApplePayInterfaces.ts +221 -8
  131. package/src/components/v2/GooglePay/PEGooglePayAddress.ts +39 -1
  132. package/src/components/v2/GooglePay/PEGooglePayButton.tsx +113 -9
  133. package/src/components/v2/PEPaymentRequest.ts +151 -13
  134. package/src/components/v2/PayEngineNative.tsx +196 -9
  135. package/src/components/v2/PayEngineProvider.tsx +52 -1
  136. package/src/components/v2/SecureFields/BankAccountView.tsx +108 -1
  137. package/src/components/v2/SecureFields/CreditCardView.tsx +118 -1
  138. package/src/components/v2/SecureFields/IPEField.ts +55 -0
  139. package/src/components/v2/SecureFields/ITokenizationData.ts +17 -2
  140. package/src/components/v2/SecureFields/PEBankAccount.ts +42 -0
  141. package/src/components/v2/SecureFields/PECard.ts +52 -0
  142. package/src/components/v2/SecureFields/PEKeyboardType.ts +18 -1
  143. package/src/index.tsx +23 -5
  144. package/src/interfaces/index.ts +40 -2
  145. package/src/utils/index.ts +21 -0
  146. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  147. package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
  148. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  149. package/android/.gradle/6.1.1/gc.properties +0 -0
  150. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
  151. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
  152. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
  153. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
  154. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
  155. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
@@ -285,11 +285,8 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
285
285
  @import ObjectiveC;
286
286
  @import PassKit;
287
287
  @import UIKit;
288
- @import WebKit;
289
288
  #endif
290
289
 
291
- #import <PayEngineSDK/PayEngineSDK.h>
292
-
293
290
  #endif
294
291
  #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
295
292
  #pragma clang diagnostic ignored "-Wduplicate-method-arg"
@@ -309,7 +306,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
309
306
  #endif
310
307
 
311
308
  #if defined(__OBJC__)
309
+ /// Represents the supported Apple Pay payment networks.
312
310
  typedef SWIFT_ENUM(NSInteger, ApplePayPaymentNetwork, open) {
311
+ /// Supported Apple Pay payment networks.
313
312
  ApplePayPaymentNetworkAmex = 0,
314
313
  ApplePayPaymentNetworkCartesBancaires = 1,
315
314
  ApplePayPaymentNetworkDiscover = 2,
@@ -333,98 +332,234 @@ typedef SWIFT_ENUM(NSInteger, ApplePayPaymentNetwork, open) {
333
332
  @class NSString;
334
333
  @class PKShippingMethod;
335
334
 
335
+ /// A class that represents an Apple Pay payment request.
336
336
  SWIFT_CLASS("_TtC12PayEngineSDK22ApplePayPaymentRequest")
337
337
  @interface ApplePayPaymentRequest : NSObject
338
- /// Creates a Apple Pay request that can be used afterards to make an apple pay request
339
- /// <ul>
340
- /// <li>
341
- /// </li>
342
- /// </ul>
343
- /// \param currencyCode The currency code the transaction has default .USD
338
+ /// Configures the <code>ApplePayPaymentRequest</code> object to prepare for an Apple Pay transaction.
339
+ /// Use this method to set up the necessary details for an Apple Pay request, including the payment items, total amount, currency, and required contact fields.
340
+ /// This method initializes the payment details and configures the Apple Pay request accordingly.
341
+ /// \param paymentItems An array of <code>PKPaymentSummaryItem</code> representing the items to be displayed in the Apple Pay sheet. Defaults to an empty array.
344
342
  ///
345
- /// \param var paymentItems What are the items you want to show in the apple pay sheet default []
343
+ /// \param paymentAmount The total amount to be collected in the transaction.
346
344
  ///
347
- /// \param paymentAmount The total amount you want to collect
345
+ /// \param currencyCode The currency code for the transaction. Defaults to <code>"USD"</code>.
346
+ ///
347
+ /// \param requiredBillingContactFields A set of <code>PKContactField</code> values specifying the required billing contact fields. Defaults to an empty set.
348
+ ///
349
+ /// \param requiredShippingContactFields A set of <code>PKContactField</code> values specifying the required shipping contact fields. Defaults to an empty set.
350
+ ///
351
+ /// \param shippingMethods An array of <code>PKShippingMethod</code> representing the available shipping options. Defaults to an empty array .
348
352
  ///
349
353
  - (void)buildWithPaymentItems:(NSArray<PKPaymentSummaryItem *> * _Nonnull)paymentItems paymentAmount:(double)paymentAmount currencyCode:(NSString * _Nonnull)currencyCode requiredBillingContactFields:(NSSet<PKContactField> * _Nonnull)requiredBillingContactFields requiredShippingContactFields:(NSSet<PKContactField> * _Nonnull)requiredShippingContactFields shippingMethods:(NSArray<PKShippingMethod *> * _Nonnull)shippingMethods;
350
354
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
351
355
  @end
352
356
 
357
+ /// Represents the Apple Pay eligibility status for the current device and user.
353
358
  typedef SWIFT_ENUM(NSInteger, ApplePayStatus, open) {
354
- /// This means the current device/user has Apple pay activated and a card belongs to the given payment networks
359
+ /// The current device/user has Apple pay activated and a card belongs to the given payment networks
355
360
  ApplePayStatusEligible = 0,
356
- /// This means the current device/user has Apple pay activated but has no card belongs to the given payment networks
361
+ /// The current device/user has Apple pay activated but has no card belongs to the given payment networks
357
362
  ApplePayStatusNeedSetup = 1,
358
- /// This means the current device/user cannot use Apple pay from Apple
363
+ /// The current device/user cannot use Apple pay from Apple
359
364
  ApplePayStatusNotEligible = 2,
360
365
  };
361
366
 
362
367
 
368
+ /// Represents the details of a bank account.
369
+ /// This class stores essential bank account information such as routing number,
370
+ /// last four digits of the account number, and the account holder’s name.
363
371
  SWIFT_CLASS("_TtC12PayEngineSDK15BankAccountData")
364
372
  @interface BankAccountData : NSObject
365
- @property (nonatomic, copy) NSString * _Nonnull routingNumber;
366
- @property (nonatomic, copy) NSString * _Nonnull last4;
367
- @property (nonatomic, copy) NSString * _Nonnull firstName;
368
- @property (nonatomic, copy) NSString * _Nonnull lastName;
369
- - (nullable instancetype)initWithRoutingNumber:(NSString * _Nonnull)routingNumber last4:(NSString * _Nonnull)last4 firstName:(NSString * _Nonnull)firstName lastName:(NSString * _Nonnull)lastName error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
370
- - (nonnull instancetype)init SWIFT_UNAVAILABLE;
371
- + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
372
- @end
373
-
374
- @class PEBankAccount;
375
-
376
- SWIFT_CLASS("_TtC12PayEngineSDK19BankAccountResponse")
377
- @interface BankAccountResponse : NSObject
378
- - (nullable instancetype)initWithMessage:(NSString * _Nonnull)message data:(PEBankAccount * _Nonnull)data error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
373
+ /// The bank’s routing number.
374
+ @property (nonatomic, readonly, copy) NSString * _Nonnull routingNumber;
375
+ /// The last four digits of the bank account number.
376
+ @property (nonatomic, readonly, copy) NSString * _Nonnull last4;
377
+ /// The first name of the account holder.
378
+ @property (nonatomic, readonly, copy) NSString * _Nonnull firstName;
379
+ /// The last name of the account holder.
380
+ @property (nonatomic, readonly, copy) NSString * _Nonnull lastName;
379
381
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
380
382
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
381
383
  @end
382
384
 
383
385
 
386
+ /// Represents the details of a payment card.
387
+ /// This class stores essential card information such as brand, last four digits,
388
+ /// expiration date, and the cardholder’s name.
384
389
  SWIFT_CLASS("_TtC12PayEngineSDK8CardData")
385
390
  @interface CardData : NSObject
386
- @property (nonatomic, copy) NSString * _Nonnull id;
387
- @property (nonatomic, copy) NSString * _Nonnull brand;
388
- @property (nonatomic, copy) NSString * _Nonnull last4;
389
- @property (nonatomic) NSInteger expMonth;
390
- @property (nonatomic) NSInteger expYear;
391
- @property (nonatomic, copy) NSString * _Nonnull name;
392
- @property (nonatomic, copy) NSString * _Nullable addressZip;
393
- - (nullable instancetype)initWithId:(NSString * _Nonnull)id brand:(NSString * _Nonnull)brand last4:(NSString * _Nonnull)last4 expMonth:(NSInteger)expMonth expYear:(NSInteger)expYear name:(NSString * _Nonnull)name addressZip:(NSString * _Nullable)addressZip error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
391
+ /// The unique identifier for the card.
392
+ @property (nonatomic, readonly, copy) NSString * _Nonnull id;
393
+ /// The brand of the card (e.g., Visa, MasterCard).
394
+ @property (nonatomic, readonly, copy) NSString * _Nonnull brand;
395
+ /// The last four digits of the card number.
396
+ @property (nonatomic, readonly, copy) NSString * _Nonnull last4;
397
+ /// The expiration month of the card.
398
+ @property (nonatomic, readonly) NSInteger expMonth;
399
+ /// The expiration year of the card.
400
+ @property (nonatomic, readonly) NSInteger expYear;
401
+ /// The name of the cardholder.
402
+ @property (nonatomic, readonly, copy) NSString * _Nonnull name;
403
+ /// The ZIP code associated with the card’s billing address (optional).
404
+ @property (nonatomic, readonly, copy) NSString * _Nullable addressZip;
394
405
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
395
406
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
396
407
  @end
397
408
 
398
- @class PECard;
399
409
 
400
- SWIFT_CLASS("_TtC12PayEngineSDK12CardResponse")
401
- @interface CardResponse : NSObject
402
- - (nullable instancetype)initWithMessage:(NSString * _Nonnull)message data:(PECard * _Nonnull)data error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
403
- - (nonnull instancetype)init SWIFT_UNAVAILABLE;
404
- + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
405
- @end
406
-
407
-
408
- @class NSBundle;
410
+ @class PEBankAccount;
409
411
  @class NSCoder;
410
412
 
411
- SWIFT_CLASS("_TtC12PayEngineSDK28FraudAnalyticsViewController")
412
- @interface FraudAnalyticsViewController : KountAnalyticsViewController
413
- - (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER;
414
- - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
415
- @end
416
-
417
-
413
+ /// A secure view for entering a customer’s bank account information safely.
414
+ /// This view displays input fields required to securely collect bank account details.
415
+ /// It also provides methods to validate the provided information and saving a customer’s bank acount by securely storing the information in PayEngine’s system.
416
+ /// This view complies with PCI standards and does not store data locally.
417
+ /// Instead, it forwards the information to a PCI-compliant third party, which encrypts and transfers the bank account details to PayEngine’s system.
418
+ /// In addition to the required fields that the view sets up for you, you can also pass additional fields and specify whether they are required.
419
+ /// <h2>How It Works</h2>
420
+ /// Call the <code>PayEngine/createBankAccountView(additionalFields:completion:)-3gn3i</code> method on the <code>PayEngine</code> object to obtain an instance of <code>IBankAccountView</code>. You can also include additional fields if needed.
421
+ /// Use the <code>validate()</code> method to check if all fields pass validation.
422
+ /// Once all fields are valid, call the <code>createBankAccount(merchantId:completion:)</code> method to save the bank account in the PayEngine system.
423
+ /// <h2>Usage Example</h2>
424
+ /// \code
425
+ /// payengine.createBankAccountView(additionalFields: []) { [unowned self] result in
426
+ /// switch result {
427
+ /// case .success(let view): // This is where you get the `IBankAccountView` instance
428
+ /// DispatchQueue.main.async {
429
+ /// self.secureField = view
430
+ /// self.stackView.spacing = 20
431
+ /// self.stackView.addArrangedSubview(self.secureField)
432
+ ///
433
+ /// let button = UIButton(type: .system)
434
+ /// button.setTitle("Create Bank Account", for: .normal)
435
+ ///
436
+ /// // Register tap action, which will send the createBankAccount request
437
+ /// button.addTarget(self, action: #selector(self.onButtonTap), for: .touchUpInside)
438
+ ///
439
+ /// self.stackView.addArrangedSubview(button)
440
+ /// }
441
+ ///
442
+ /// case .failure(let error):
443
+ /// debugPrint("Error: \(error)")
444
+ /// }
445
+ /// }
446
+ ///
447
+ /// @objc func onButtonTap() {
448
+ /// secureField.createBankAccount(merchantId: MERCHANT_ID) { [unowned self] result in
449
+ /// switch result {
450
+ /// case .success(let data):
451
+ /// let alert = UIAlertController(
452
+ /// title: "Bank Account Created",
453
+ /// message: data.token,
454
+ /// preferredStyle: .alert
455
+ /// )
456
+ /// alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
457
+ /// self.present(alert, animated: true, completion: nil)
458
+ ///
459
+ /// case .failure(let error):
460
+ /// debugPrint("Error: \(error)")
461
+ /// }
462
+ /// }
463
+ /// }
464
+ ///
465
+ /// \endcode
418
466
  SWIFT_CLASS("_TtC12PayEngineSDK16IBankAccountView")
419
467
  @interface IBankAccountView : UIStackView
468
+ /// After the user has entered and validated their bank accoount information, this method can be called to save the bank account in the PayEngine system.
469
+ /// \param merchantId Your merchant’s ID.
470
+ ///
471
+ /// \param additionalData Additional data to be included along with the bank account information.
472
+ ///
473
+ /// \param completion Callback that provides an instance of the newly created <code>PEBankAccount</code> object.
474
+ ///
475
+ /// \param failure Callback that returns an error if the request fails.
476
+ ///
420
477
  - (void)createBankAccountWithMerchantId:(NSString * _Nullable)merchantId additionalData:(NSDictionary<NSString *, id> * _Nonnull)additionalData completion:(void (^ _Nonnull)(PEBankAccount * _Nonnull))completion failure:(void (^ _Nonnull)(NSError * _Nonnull))failure;
421
478
  - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
422
479
  - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
423
480
  @end
424
481
 
482
+ @class PECard;
425
483
 
484
+ /// A secure view for entering a customer’s payment card information safely.
485
+ /// This view displays input fields required to securely collect payment card details.
486
+ /// It also provides methods to validate the provided information and saving a customer’s card by securely storing the information in PayEngine’s system.
487
+ /// This view complies with PCI standards and does not store data locally.
488
+ /// Instead, it forwards the information to a PCI-compliant third party, which encrypts and transfers the card details to PayEngine’s system.
489
+ /// In addition to the required fields that the view sets up for you, you can also pass additional fields and specify whether they are required.
490
+ /// <h2>How It Works</h2>
491
+ /// Call the <code>PayEngine/createSecureView(additionalFields:completion:)-5x9ky</code> method on the <code>PayEngine</code> object to obtain an instance of <code>ICardNumberView</code>. You can also include additional fields if needed.
492
+ /// Use the <code>validate()</code> method to check if all fields pass validation.
493
+ /// Once all fields are valid, call the <code>createCard(merchantId:completion:)</code> method to save the card in the PayEngine system.
494
+ /// <h2>Usage Example</h2>
495
+ /// \code
496
+ /// let zipField = PEField(
497
+ /// name: "address_zip",
498
+ /// type: "text",
499
+ /// placeholder: "Zip code",
500
+ /// isRequired: true,
501
+ /// keyboardType: .alphabet,
502
+ /// pattern: #"^(?:\d{5}(?:-\d{4})?|[ABCEGHJKLMNPRSTVXY]\d[A-Z] ?\d[A-Z]\d)$"#
503
+ /// )
504
+ ///
505
+ /// payengine.createSecureView(additionalFields: [zipField]) { [unowned self] result in
506
+ /// switch result {
507
+ /// case .success(let view): // This is where you get the `ICardNumberView` instance
508
+ /// DispatchQueue.main.async {
509
+ /// self.secureField = view
510
+ /// self.stackView.spacing = 20
511
+ /// self.stackView.addArrangedSubview(self.secureField)
512
+ ///
513
+ /// let button = UIButton(type: .system)
514
+ /// button.setTitle("Create Card", for: .normal)
515
+ ///
516
+ /// // Register tap action, which will send the createCard request
517
+ /// button.addTarget(self, action: #selector(self.onButtonTap), for: .touchUpInside)
518
+ /// self.stackView.addArrangedSubview(button)
519
+ /// }
520
+ ///
521
+ /// case .failure(let error):
522
+ /// debugPrint("Error: \(error)")
523
+ /// }
524
+ /// }
525
+ ///
526
+ /// @objc func onButtonTap() {
527
+ /// let additionalData = ["test_data": true]
528
+ ///
529
+ /// secureField.createCard(merchantId: MERCHANT_ID, additionalData: additionalData) { [unowned self] result in
530
+ /// switch result {
531
+ /// case .success(let data):
532
+ /// let alert = UIAlertController(
533
+ /// title: "Card Created",
534
+ /// message: data.token,
535
+ /// preferredStyle: .alert
536
+ /// )
537
+ /// alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
538
+ ///
539
+ /// self.present(alert, animated: true, completion: nil)
540
+ /// self.cardToken = data.token
541
+ ///
542
+ /// debugPrint("Card token: \(data.token)")
543
+ /// self.saleButton.isHidden = false
544
+ ///
545
+ /// case .failure(let error):
546
+ /// debugPrint("Error: \(error)")
547
+ /// }
548
+ /// }
549
+ /// }
550
+ ///
551
+ /// \endcode
426
552
  SWIFT_CLASS("_TtC12PayEngineSDK15ICardNumberView")
427
553
  @interface ICardNumberView : UIStackView
554
+ /// After the user has entered and validated their card information, this method can be called to save the card in the PayEngine system.
555
+ /// \param merchantId Your merchant’s ID.
556
+ ///
557
+ /// \param additionalData Additional data to be included along with the card information.
558
+ ///
559
+ /// \param completion Callback that provides an instance of the newly created <code>PECard</code> object.
560
+ ///
561
+ /// \param failure Callback that returns an error if the request fails.
562
+ ///
428
563
  - (void)createCardWithMerchantId:(NSString * _Nullable)merchantId additionalData:(NSDictionary<NSString *, id> * _Nonnull)additionalData completion:(void (^ _Nonnull)(PECard * _Nonnull))completion failure:(void (^ _Nonnull)(NSError * _Nonnull))failure;
429
564
  - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
430
565
  - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
@@ -433,12 +568,62 @@ SWIFT_CLASS("_TtC12PayEngineSDK15ICardNumberView")
433
568
  @protocol PEApplePayDelegate;
434
569
  @class UIButton;
435
570
 
571
+ /// A class that facilitates Apple Pay transactions.
572
+ /// <blockquote>
573
+ /// Important: Making the object for this class is not allowed. The shared instance of this class provides methods to configure and initiate Apple Pay payments. The shared instance is managed internally and you don’t need to access it directly.
574
+ ///
575
+ /// </blockquote>
576
+ /// When you call the <code>PayEngine/setupApplePay(merchantId:completion:)</code> the shared instance gets returned to you in a completion callback.
577
+ /// Once you get the shared instance call this method <code>setupApplePayButton(for:type:style:)</code> to get a <code>UIButton</code> that triggers the Apple Pay payment flow when tapped.
578
+ /// <h2>Usage Example</h2>
579
+ /// \code
580
+ /// // The payengineSDK instance
581
+ /// let payengine = PayEngine(config: CONFIG)
582
+ /// payengine.setupApplePay(merchantId: "Your merchant's id") { result in
583
+ /// switch result {
584
+ /// case .success(let applePay): // This is where you get the singleton instance of `PEApplePay`
585
+ /// applePay.delegate = self
586
+ ///
587
+ /// let request = ApplePayPaymentRequest()
588
+ /// request.build(
589
+ /// paymentItems: [],
590
+ /// paymentAmount: 1.0,
591
+ /// currencyCode: "USD",
592
+ /// requiredBillingContactFields: [.name, .postalAddress],
593
+ /// requiredShippingContactFields: [.name, .emailAddress, .postalAddress],
594
+ /// shippingMethods: shippingMethods
595
+ /// )
596
+ ///
597
+ /// DispatchQueue.main.async {
598
+ /// if let applePayButton = applePay.setupApplePayButton(for: request, type: .checkout) {
599
+ /// // Add this button to your view hierarchy.
600
+ /// // When tapped, it will automatically start the Apple Pay payment flow.
601
+ /// }
602
+ /// }
603
+ ///
604
+ /// case .failure(let error):
605
+ /// print("Unable to setup Apple Pay: \(error)")
606
+ /// }
607
+ /// }
608
+ ///
609
+ /// \endcode
436
610
  SWIFT_CLASS("_TtC12PayEngineSDK10PEApplePay")
437
611
  @interface PEApplePay : NSObject
612
+ /// A delegate conforming to the <code>PEApplePayDelegate</code> protocol that handles Apple Pay events.
438
613
  @property (nonatomic, strong) id <PEApplePayDelegate> _Nullable delegate;
614
+ /// Creates and returns a <code>UIButton</code> styled as an Apple Pay button.
615
+ /// When the button is tapped, it initiates the Apple Pay authorization flow. Depending on the supported payment network,
616
+ /// the button may direct users to set up Apple Pay or proceed with a payment.
617
+ /// \param paymentRequest An <code>ApplePayPaymentRequest</code> containing details of the payment request.
618
+ ///
619
+ /// \param type The type of Apple Pay button (e.g., <code>.checkout</code>, <code>.book</code>). Default is <code>.checkout</code>.
620
+ ///
621
+ /// \param style The style of the button (e.g., <code>.black</code>, <code>.white</code>). Default is <code>.black</code>.
622
+ ///
623
+ ///
624
+ /// returns:
625
+ /// A <code>UIButton</code> configured for Apple Pay, or <code>nil</code> if Apple Pay is not available.
439
626
  - (UIButton * _Nullable)setupApplePayButtonFor:(ApplePayPaymentRequest * _Nonnull)paymentRequest type:(PKPaymentButtonType)type style:(PKPaymentButtonStyle)style SWIFT_WARN_UNUSED_RESULT;
440
- - (BOOL)startApplePayPaymentAndReturnError:(NSError * _Nullable * _Nullable)error;
441
- - (void)startApplePaySetup;
442
627
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
443
628
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
444
629
  @end
@@ -461,158 +646,270 @@ SWIFT_CLASS("_TtC12PayEngineSDK10PEApplePay")
461
646
 
462
647
  enum PEApplePayResult : NSInteger;
463
648
 
649
+ /// A delegate protocol that provides callbacks for various events during the Apple Pay transaction process.
650
+ /// This protocol notifies the conforming delegate about errors, UI status updates, payment token retrieval,
651
+ /// and optional user interactions such as selecting shipping or payment methods.
464
652
  SWIFT_PROTOCOL("_TtP12PayEngineSDK18PEApplePayDelegate_")
465
653
  @protocol PEApplePayDelegate
654
+ /// Called when an error occurs during the Apple Pay transaction.
655
+ /// \param error The error that occurred.
656
+ ///
466
657
  - (void)paymentErrorWithError:(NSError * _Nonnull)error;
658
+ /// Called when the Apple Pay payment sheet is dismissed.
659
+ /// This can occur when the user cancels the payment request or when the payment is successfully completed.
467
660
  - (void)paymentSheetDidMDismiss;
661
+ /// Called when a payment token is successfully received after Apple Pay authorization.
662
+ /// \param token The payment token received from Apple Pay.
663
+ ///
664
+ /// \param metadata Additional metadata related to the transaction, if available.
665
+ ///
666
+ /// \param billingContact The user’s billing contact information.
667
+ ///
668
+ /// \param shippingContact The user’s shipping contact information.
669
+ ///
670
+ /// \param completion A completion handler that must be called with a <code>PEApplePayResult</code> value.
671
+ ///
468
672
  - (void)paymentTokenDidReturnWithToken:(NSString * _Nonnull)token metadata:(NSDictionary<NSString *, id> * _Nullable)metadata billingContact:(PKContact * _Nullable)billingContact shippingContact:(PKContact * _Nullable)shippingContact completion:(void (^ _Nonnull)(enum PEApplePayResult))completion;
673
+ /// Called when a payment token is unavailable due to an error during token exchange.
674
+ /// \param error The error that occurred, if available.
675
+ ///
469
676
  - (void)paymentTokenNotAvailableWithError:(NSError * _Nullable)error;
470
677
  @optional
678
+ /// Called when the user selects a shipping contact during checkout.
679
+ /// \param contact The selected shipping contact.
680
+ ///
681
+ /// \param completion A handler that must be called with a <code>PKPaymentRequestShippingContactUpdate</code> to update the shipping details.
682
+ ///
471
683
  - (void)didSelectShippingContact:(PKContact * _Nonnull)contact handler:(void (^ _Nonnull)(PKPaymentRequestShippingContactUpdate * _Nonnull))completion SWIFT_AVAILABILITY(ios,introduced=11.0);
684
+ /// Called when the user selects a shipping method.
685
+ /// \param shippingMethod The selected shipping method.
686
+ ///
687
+ /// \param completion A handler that must be called with a <code>PKPaymentRequestShippingMethodUpdate</code> to update the shipping method details.
688
+ ///
472
689
  - (void)didSelectShippingMethod:(PKShippingMethod * _Nonnull)shippingMethod handler:(void (^ _Nonnull)(PKPaymentRequestShippingMethodUpdate * _Nonnull))completion SWIFT_AVAILABILITY(ios,introduced=11.0);
690
+ /// Called when the user selects a payment method.
691
+ /// \param paymentMethod The selected payment method.
692
+ ///
693
+ /// \param completion A handler that must be called with a <code>PKPaymentRequestPaymentMethodUpdate</code> to update the payment method details.
694
+ ///
473
695
  - (void)didSelectPaymentMethod:(PKPaymentMethod * _Nonnull)paymentMethod handler:(void (^ _Nonnull)(PKPaymentRequestPaymentMethodUpdate * _Nonnull))completion SWIFT_AVAILABILITY(ios,introduced=11.0);
474
696
  @end
475
697
 
698
+ /// An enum representing the Apple Payment Result’s success or failure.
476
699
  typedef SWIFT_ENUM(NSInteger, PEApplePayResult, open) {
700
+ /// Success if the payment was successful..
477
701
  PEApplePayResultSuccess = 0,
702
+ /// Failiure if the payment was not successful.
478
703
  PEApplePayResultFailure = 1,
479
704
  };
480
705
 
481
706
 
482
- /// PayEngine Card object
707
+ /// A PayEngine bank account object.
708
+ /// This class represents a bank account stored within PayEngine, containing a secure token
709
+ /// and account details.
483
710
  SWIFT_CLASS("_TtC12PayEngineSDK13PEBankAccount")
484
711
  @interface PEBankAccount : NSObject
485
- @property (nonatomic, copy) NSString * _Nonnull token;
486
- @property (nonatomic, strong) BankAccountData * _Nonnull bankAccountData;
487
- - (nullable instancetype)initWithToken:(NSString * _Nonnull)token bankAccountData:(BankAccountData * _Nonnull)bankAccountData error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
712
+ /// A unique token representing the bank account.
713
+ @property (nonatomic, readonly, copy) NSString * _Nonnull token;
714
+ /// The associated bank account details.
715
+ @property (nonatomic, readonly, strong) BankAccountData * _Nonnull bankAccountData;
488
716
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
489
717
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
490
718
  @end
491
719
 
492
720
 
493
- SWIFT_CLASS("_TtC12PayEngineSDK17PEBankAccountView")
494
- @interface PEBankAccountView : IBankAccountView
495
- - (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
496
- - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
497
- - (void)didMoveToSuperview;
498
- - (void)layoutSubviews;
499
- @end
500
-
501
-
502
- /// PayEngine Card object
721
+ /// A PayEngine card object.
722
+ /// This class represents a payment card stored with PayEngine, containing a secure token
723
+ /// and associated card details.
503
724
  SWIFT_CLASS("_TtC12PayEngineSDK6PECard")
504
725
  @interface PECard : NSObject
505
- @property (nonatomic, copy) NSString * _Nonnull token;
506
- @property (nonatomic, strong) CardData * _Nonnull cardData;
507
- - (nullable instancetype)initWithToken:(NSString * _Nonnull)token cardData:(CardData * _Nonnull)cardData error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
726
+ /// A unique token representing the card.
727
+ @property (nonatomic, readonly, copy) NSString * _Nonnull token;
728
+ /// The associated card details.
729
+ @property (nonatomic, readonly, strong) CardData * _Nonnull cardData;
508
730
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
509
731
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
510
732
  @end
511
733
 
512
- @class PEConfig;
513
- @class WKUserContentController;
514
- @class WKScriptMessage;
515
-
516
- /// PEComponent
517
- SWIFT_CLASS("_TtC12PayEngineSDK11PEComponent")
518
- @interface PEComponent : UIView <WKScriptMessageHandler>
519
- - (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
520
- - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
521
- - (void)didMoveToSuperview;
522
- - (void)setupWithConfig:(PEConfig * _Nonnull)config componentName:(NSString * _Nonnull)componentName props:(NSDictionary<NSString *, NSString *> * _Nonnull)props;
523
- - (void)pinToView:(UIView * _Nonnull)view;
524
- - (void)registerEventWithName:(NSString * _Nonnull)name handler:(void (^ _Nonnull)(id _Nonnull))handler;
525
- - (void)removeEventWithName:(NSString * _Nonnull)name;
526
- - (void)userContentController:(WKUserContentController * _Nonnull)userContentController didReceiveScriptMessage:(WKScriptMessage * _Nonnull)message;
527
- @end
528
-
529
734
 
530
- /// PayEngine configuration
735
+ /// A class that is used to configure the <code>PayEngine</code> object.
736
+ /// This class stores the authentication key that is generated by PayEngine. It also defines the PayEngine’s backend environement which the <code>PayEngine</code> object will interact with.
531
737
  SWIFT_CLASS("_TtC12PayEngineSDK8PEConfig")
532
738
  @interface PEConfig : NSObject
739
+ /// Constructor for the <code>PEConfig</code> class
740
+ /// \param publicKey PayEngine public key.
741
+ ///
742
+ /// \param baseURL Base URL for your custom environemnt. Default is <code>nil</code>. If set as <code>nil</code> the object will setup the environment based on the value of the <code>publicKey</code>.
743
+ ///
533
744
  - (nonnull instancetype)initWithPublicKey:(NSString * _Nonnull)publicKey baseURL:(NSString * _Nullable)baseURL OBJC_DESIGNATED_INITIALIZER;
745
+ /// Returns the base url with which the <code>PayEngine</code> object interacts with.
746
+ ///
747
+ /// returns:
748
+ /// A Base URL. If no url was provided when constructing the object, then this method will return a url based on the <code>publicKey</code> provided in the <code>init(publicKey:baseURL:)</code>
534
749
  - (NSString * _Nonnull)getBaseURL SWIFT_WARN_UNUSED_RESULT;
750
+ /// To check if the environment is set as production.
751
+ ///
752
+ /// returns:
753
+ /// Returns <code>true</code> if the environment is set as live. Returns <code>false</code> otherwise.
535
754
  - (BOOL)isProduction SWIFT_WARN_UNUSED_RESULT;
536
755
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
537
756
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
538
757
  @end
539
758
 
540
759
 
760
+ /// A type that represents an input field.
761
+ /// This class defines an input field with properties that determine its behavior, such as its name, type, placeholder,
762
+ /// whether it is required, keyboard type, and optional validation pattern.
763
+ /// Internal UI components use this type to create input fields that adhere to the specified input criteria.
541
764
  SWIFT_CLASS("_TtC12PayEngineSDK7PEField")
542
765
  @interface PEField : NSObject
766
+ /// The name of the field.
767
+ @property (nonatomic, copy) NSString * _Nonnull name;
768
+ /// The type of the field.
769
+ @property (nonatomic, copy) NSString * _Nonnull type;
770
+ /// The placeholder text displayed when the field is empty.
771
+ @property (nonatomic, copy) NSString * _Nonnull placeholder;
772
+ /// A Boolean value indicating whether the field is required.
773
+ /// If <code>true</code>, the field must contain a value before submission.
774
+ @property (nonatomic) BOOL isRequired;
775
+ /// A regular expression pattern used to validate the field’s input.
776
+ /// If <code>nil</code>, no validation is performed.
777
+ @property (nonatomic, copy) NSString * _Nullable pattern;
543
778
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
544
779
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
545
780
  @end
546
781
 
547
-
548
- /// PEPaymentView
549
- SWIFT_CLASS("_TtC12PayEngineSDK13PEPaymentView")
550
- @interface PEPaymentView : ICardNumberView
551
- - (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
552
- - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
553
- - (void)didMoveToSuperview;
554
- - (void)layoutSubviews;
555
- - (void)setupWithVaultId:(NSString * _Nonnull)vaultId env:(NSString * _Nonnull)env publicKey:(NSString * _Nonnull)publicKey additionalFields:(NSArray<PEField *> * _Nonnull)additionalFields;
556
- - (BOOL)validate SWIFT_WARN_UNUSED_RESULT;
557
- - (void)showKeyboard;
558
- @end
559
-
782
+ /// Color Theme for the SDK.
560
783
  typedef SWIFT_ENUM(NSInteger, PEThemeMode, open) {
561
784
  PEThemeModeSystem = 0,
562
785
  PEThemeModeDark = 1,
563
786
  PEThemeModeLight = 2,
564
787
  };
565
788
 
789
+ @class UIView;
566
790
  @class ThreeDSResult;
567
791
 
568
- /// PayEngine Main Class
792
+ /// <code>PayEngine</code> is the main entry point for integrating PayEngine’s payment processing features.
793
+ /// This class provides a centralized interface for:
794
+ /// <ul>
795
+ /// <li>
796
+ /// Secure card and bank account entry
797
+ /// </li>
798
+ /// <li>
799
+ /// Apple Pay integration
800
+ /// </li>
801
+ /// <li>
802
+ /// Fraud monitoring and 3D Secure authentication
803
+ /// </li>
804
+ /// </ul>
805
+ /// <h2>Key Features</h2>
806
+ /// <h3>Secure Payment Views</h3>
807
+ /// <ul>
808
+ /// <li>
809
+ /// Supports secure card entry via <code>createSecureView(additionalFields:completion:)</code>
810
+ /// </li>
811
+ /// <li>
812
+ /// Supports secure bank account entry via <code>createBankAccountView(additionalFields:completion:)</code>
813
+ /// </li>
814
+ /// <li>
815
+ /// PCI-compliant data handling with external encryption and tokenization
816
+ /// </li>
817
+ /// </ul>
818
+ /// <h3>Apple Pay Integration</h3>
819
+ /// <ul>
820
+ /// <li>
821
+ /// Detects Apple Pay availability
822
+ /// </li>
823
+ /// <li>
824
+ /// Provides Apple Pay button creation
825
+ /// </li>
826
+ /// <li>
827
+ /// Manages Apple Pay transaction processing
828
+ /// </li>
829
+ /// </ul>
830
+ /// <h3>Fraud Monitoring & 3D Secure</h3>
831
+ /// <ul>
832
+ /// <li>
833
+ /// Creates fraud monitoring sessions via <code>createFraudMonitorSession(merchantId:completion:)</code>
834
+ /// </li>
835
+ /// <li>
836
+ /// Supports 3D Secure authentication via <code>perform3DSFlow(view:threeDSData:handler:)</code>
837
+ /// </li>
838
+ /// </ul>
839
+ /// <h2>Usage Example</h2>
840
+ /// \code
841
+ /// // Initialize PayEngine
842
+ /// let payEngine = PayEngine(config: config)
843
+ ///
844
+ /// // Create a secure card entry view
845
+ /// payEngine.createSecureView(additionalFields: []) { result in
846
+ /// switch result {
847
+ /// case .success(let view):
848
+ /// self.view.addSubview(view)
849
+ /// case .failure(let error):
850
+ /// print("Error: \(error)")
851
+ /// }
852
+ /// }
853
+ ///
854
+ /// \endcodeseealso:
855
+ /// <code>ICardNumberView</code>, <code>IBankAccountView</code>, <code>PEApplePay</code>
569
856
  SWIFT_CLASS("_TtC12PayEngineSDK9PayEngine")
570
857
  @interface PayEngine : NSObject
571
- /// Constructor
572
- /// \param config PayEngine configuration
858
+ /// Initializes the <code>PayEngine</code> with the given configuration.
859
+ /// \param config The configuration object <code>PEConfig</code> containing necessary settings.
573
860
  ///
574
861
  - (nonnull instancetype)initWithConfig:(PEConfig * _Nonnull)config OBJC_DESIGNATED_INITIALIZER;
862
+ /// Sets the theme mode for the PayEngine UI components.
863
+ /// \param themeMode The desired theme mode <code>PEThemeMode</code>.
864
+ ///
575
865
  + (void)setThemeMode:(enum PEThemeMode)themMode;
576
- - (PEComponent * _Nonnull)createComponentWithName:(NSString * _Nonnull)name props:(NSDictionary<NSString *, NSString *> * _Nonnull)props SWIFT_WARN_UNUSED_RESULT;
866
+ /// Creates a secure card entry view for collecting payment details.
867
+ /// \param additionalFields Optional additional fields to be included of type <code>PEField</code>.
868
+ ///
869
+ /// \param completion A closure returning the <code>ICardNumberView</code> instance.
870
+ ///
577
871
  - (void)createSecureViewWithAdditionalFields:(NSArray<PEField *> * _Nullable)additionalFields completion:(void (^ _Nonnull)(ICardNumberView * _Nonnull))completion;
872
+ /// Creates a secure bank account entry view.
873
+ /// \param additionalFields Optional additional fields to be included.
874
+ ///
875
+ /// \param completion A closure returning the <code>IBankAccountView</code> instance.
876
+ ///
578
877
  - (void)createBankAccountViewWithAdditionalFields:(NSArray<PEField *> * _Nullable)additionalFields completion:(void (^ _Nonnull)(IBankAccountView * _Nonnull))completion;
878
+ /// Retrieves browser-related information.
879
+ /// \param view The UI view in which the web view is embedded.
880
+ ///
881
+ /// \param handler A closure returning browser details as a <code>String</code>.
882
+ ///
579
883
  - (void)getBrowserInfoWithView:(UIView * _Nonnull)view handler:(void (^ _Nonnull)(NSString * _Nonnull))handler;
884
+ /// Initiates a 3D Secure authentication process.
885
+ /// \param view The UI view in which the 3D Secure flow should be presented.
886
+ ///
887
+ /// \param threeDSData The authentication data required for 3D Secure.
888
+ ///
889
+ /// \param handler A closure returning the <code>ThreeDSResult</code> upon completion.
890
+ ///
580
891
  - (void)perform3DSFlowWithView:(UIView * _Nonnull)view threeDSData:(NSString * _Nonnull)threeDSData handler:(void (^ _Nonnull)(ThreeDSResult * _Nonnull))handler;
892
+ /// Creates a fraud monitoring session.
893
+ /// \param merchantId The merchant’s unique identifier.
894
+ ///
895
+ /// \param completion A closure returning the fraud monitoring session ID as a <code>String</code>.
896
+ ///
581
897
  - (void)createFraudMonitorSessionWithMerchantId:(NSString * _Nonnull)merchantId completion:(void (^ _Nonnull)(NSString * _Nonnull))completion;
582
898
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
583
899
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
584
900
  @end
585
901
 
586
902
 
587
- SWIFT_CLASS("_TtC12PayEngineSDK14ThreeDSMessage")
588
- @interface ThreeDSMessage : NSObject
589
- - (nullable instancetype)initWithType:(NSString * _Nonnull)type subtype:(NSString * _Nonnull)subtype data:(ThreeDSResult * _Nullable)data error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
590
- - (nonnull instancetype)init SWIFT_UNAVAILABLE;
591
- + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
592
- @end
593
-
594
- @class WKWebView;
595
- @class WKNavigationAction;
596
- @class WKNavigation;
597
-
598
- SWIFT_CLASS("_TtC12PayEngineSDK12ThreeDSModal")
599
- @interface ThreeDSModal : UIView <WKNavigationDelegate, WKScriptMessageHandler>
600
- - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
601
- - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
602
- - (void)setupWithConfig:(PEConfig * _Nonnull)config threeDSData:(NSString * _Nonnull)threeDSData handler:(void (^ _Nonnull)(ThreeDSResult * _Nonnull))handler;
603
- - (void)setupWebView;
604
- - (void)webView:(WKWebView * _Nonnull)webView decidePolicyForNavigationAction:(WKNavigationAction * _Nonnull)navigationAction decisionHandler:(void (^ _Nonnull)(WKNavigationActionPolicy))decisionHandler;
605
- - (void)webView:(WKWebView * _Nonnull)webView didFinishNavigation:(WKNavigation * _Null_unspecified)navigation;
606
- - (void)userContentController:(WKUserContentController * _Nonnull)userContentController didReceiveScriptMessage:(WKScriptMessage * _Nonnull)message;
607
- @end
608
-
609
903
 
904
+ /// Type that represents the result for the ThreeDS process
610
905
  SWIFT_CLASS("_TtC12PayEngineSDK13ThreeDSResult")
611
906
  @interface ThreeDSResult : NSObject
612
- @property (nonatomic, copy) NSString * _Nullable message;
613
- @property (nonatomic) BOOL success;
614
- @property (nonatomic, copy) NSString * _Nullable transactionId;
615
- - (nullable instancetype)initWithMessage:(NSString * _Nullable)message success:(BOOL)success transactionId:(NSString * _Nullable)transactionId error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
907
+ /// The message for the result
908
+ @property (nonatomic, readonly, copy) NSString * _Nullable message;
909
+ /// Bool indicating whether the transaction was successful or not
910
+ @property (nonatomic, readonly) BOOL success;
911
+ /// Transaction ID resulting after the ThreeDS Flow completion
912
+ @property (nonatomic, readonly, copy) NSString * _Nullable transactionId;
616
913
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
617
914
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
618
915
  @end
@@ -920,11 +1217,8 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
920
1217
  @import ObjectiveC;
921
1218
  @import PassKit;
922
1219
  @import UIKit;
923
- @import WebKit;
924
1220
  #endif
925
1221
 
926
- #import <PayEngineSDK/PayEngineSDK.h>
927
-
928
1222
  #endif
929
1223
  #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
930
1224
  #pragma clang diagnostic ignored "-Wduplicate-method-arg"
@@ -944,7 +1238,9 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
944
1238
  #endif
945
1239
 
946
1240
  #if defined(__OBJC__)
1241
+ /// Represents the supported Apple Pay payment networks.
947
1242
  typedef SWIFT_ENUM(NSInteger, ApplePayPaymentNetwork, open) {
1243
+ /// Supported Apple Pay payment networks.
948
1244
  ApplePayPaymentNetworkAmex = 0,
949
1245
  ApplePayPaymentNetworkCartesBancaires = 1,
950
1246
  ApplePayPaymentNetworkDiscover = 2,
@@ -968,98 +1264,234 @@ typedef SWIFT_ENUM(NSInteger, ApplePayPaymentNetwork, open) {
968
1264
  @class NSString;
969
1265
  @class PKShippingMethod;
970
1266
 
1267
+ /// A class that represents an Apple Pay payment request.
971
1268
  SWIFT_CLASS("_TtC12PayEngineSDK22ApplePayPaymentRequest")
972
1269
  @interface ApplePayPaymentRequest : NSObject
973
- /// Creates a Apple Pay request that can be used afterards to make an apple pay request
974
- /// <ul>
975
- /// <li>
976
- /// </li>
977
- /// </ul>
978
- /// \param currencyCode The currency code the transaction has default .USD
1270
+ /// Configures the <code>ApplePayPaymentRequest</code> object to prepare for an Apple Pay transaction.
1271
+ /// Use this method to set up the necessary details for an Apple Pay request, including the payment items, total amount, currency, and required contact fields.
1272
+ /// This method initializes the payment details and configures the Apple Pay request accordingly.
1273
+ /// \param paymentItems An array of <code>PKPaymentSummaryItem</code> representing the items to be displayed in the Apple Pay sheet. Defaults to an empty array.
979
1274
  ///
980
- /// \param var paymentItems What are the items you want to show in the apple pay sheet default []
1275
+ /// \param paymentAmount The total amount to be collected in the transaction.
981
1276
  ///
982
- /// \param paymentAmount The total amount you want to collect
1277
+ /// \param currencyCode The currency code for the transaction. Defaults to <code>"USD"</code>.
1278
+ ///
1279
+ /// \param requiredBillingContactFields A set of <code>PKContactField</code> values specifying the required billing contact fields. Defaults to an empty set.
1280
+ ///
1281
+ /// \param requiredShippingContactFields A set of <code>PKContactField</code> values specifying the required shipping contact fields. Defaults to an empty set.
1282
+ ///
1283
+ /// \param shippingMethods An array of <code>PKShippingMethod</code> representing the available shipping options. Defaults to an empty array .
983
1284
  ///
984
1285
  - (void)buildWithPaymentItems:(NSArray<PKPaymentSummaryItem *> * _Nonnull)paymentItems paymentAmount:(double)paymentAmount currencyCode:(NSString * _Nonnull)currencyCode requiredBillingContactFields:(NSSet<PKContactField> * _Nonnull)requiredBillingContactFields requiredShippingContactFields:(NSSet<PKContactField> * _Nonnull)requiredShippingContactFields shippingMethods:(NSArray<PKShippingMethod *> * _Nonnull)shippingMethods;
985
1286
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
986
1287
  @end
987
1288
 
1289
+ /// Represents the Apple Pay eligibility status for the current device and user.
988
1290
  typedef SWIFT_ENUM(NSInteger, ApplePayStatus, open) {
989
- /// This means the current device/user has Apple pay activated and a card belongs to the given payment networks
1291
+ /// The current device/user has Apple pay activated and a card belongs to the given payment networks
990
1292
  ApplePayStatusEligible = 0,
991
- /// This means the current device/user has Apple pay activated but has no card belongs to the given payment networks
1293
+ /// The current device/user has Apple pay activated but has no card belongs to the given payment networks
992
1294
  ApplePayStatusNeedSetup = 1,
993
- /// This means the current device/user cannot use Apple pay from Apple
1295
+ /// The current device/user cannot use Apple pay from Apple
994
1296
  ApplePayStatusNotEligible = 2,
995
1297
  };
996
1298
 
997
1299
 
1300
+ /// Represents the details of a bank account.
1301
+ /// This class stores essential bank account information such as routing number,
1302
+ /// last four digits of the account number, and the account holder’s name.
998
1303
  SWIFT_CLASS("_TtC12PayEngineSDK15BankAccountData")
999
1304
  @interface BankAccountData : NSObject
1000
- @property (nonatomic, copy) NSString * _Nonnull routingNumber;
1001
- @property (nonatomic, copy) NSString * _Nonnull last4;
1002
- @property (nonatomic, copy) NSString * _Nonnull firstName;
1003
- @property (nonatomic, copy) NSString * _Nonnull lastName;
1004
- - (nullable instancetype)initWithRoutingNumber:(NSString * _Nonnull)routingNumber last4:(NSString * _Nonnull)last4 firstName:(NSString * _Nonnull)firstName lastName:(NSString * _Nonnull)lastName error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1005
- - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1006
- + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1007
- @end
1008
-
1009
- @class PEBankAccount;
1010
-
1011
- SWIFT_CLASS("_TtC12PayEngineSDK19BankAccountResponse")
1012
- @interface BankAccountResponse : NSObject
1013
- - (nullable instancetype)initWithMessage:(NSString * _Nonnull)message data:(PEBankAccount * _Nonnull)data error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1305
+ /// The bank’s routing number.
1306
+ @property (nonatomic, readonly, copy) NSString * _Nonnull routingNumber;
1307
+ /// The last four digits of the bank account number.
1308
+ @property (nonatomic, readonly, copy) NSString * _Nonnull last4;
1309
+ /// The first name of the account holder.
1310
+ @property (nonatomic, readonly, copy) NSString * _Nonnull firstName;
1311
+ /// The last name of the account holder.
1312
+ @property (nonatomic, readonly, copy) NSString * _Nonnull lastName;
1014
1313
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1015
1314
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1016
1315
  @end
1017
1316
 
1018
1317
 
1318
+ /// Represents the details of a payment card.
1319
+ /// This class stores essential card information such as brand, last four digits,
1320
+ /// expiration date, and the cardholder’s name.
1019
1321
  SWIFT_CLASS("_TtC12PayEngineSDK8CardData")
1020
1322
  @interface CardData : NSObject
1021
- @property (nonatomic, copy) NSString * _Nonnull id;
1022
- @property (nonatomic, copy) NSString * _Nonnull brand;
1023
- @property (nonatomic, copy) NSString * _Nonnull last4;
1024
- @property (nonatomic) NSInteger expMonth;
1025
- @property (nonatomic) NSInteger expYear;
1026
- @property (nonatomic, copy) NSString * _Nonnull name;
1027
- @property (nonatomic, copy) NSString * _Nullable addressZip;
1028
- - (nullable instancetype)initWithId:(NSString * _Nonnull)id brand:(NSString * _Nonnull)brand last4:(NSString * _Nonnull)last4 expMonth:(NSInteger)expMonth expYear:(NSInteger)expYear name:(NSString * _Nonnull)name addressZip:(NSString * _Nullable)addressZip error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1323
+ /// The unique identifier for the card.
1324
+ @property (nonatomic, readonly, copy) NSString * _Nonnull id;
1325
+ /// The brand of the card (e.g., Visa, MasterCard).
1326
+ @property (nonatomic, readonly, copy) NSString * _Nonnull brand;
1327
+ /// The last four digits of the card number.
1328
+ @property (nonatomic, readonly, copy) NSString * _Nonnull last4;
1329
+ /// The expiration month of the card.
1330
+ @property (nonatomic, readonly) NSInteger expMonth;
1331
+ /// The expiration year of the card.
1332
+ @property (nonatomic, readonly) NSInteger expYear;
1333
+ /// The name of the cardholder.
1334
+ @property (nonatomic, readonly, copy) NSString * _Nonnull name;
1335
+ /// The ZIP code associated with the card’s billing address (optional).
1336
+ @property (nonatomic, readonly, copy) NSString * _Nullable addressZip;
1029
1337
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1030
1338
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1031
1339
  @end
1032
1340
 
1033
- @class PECard;
1034
1341
 
1035
- SWIFT_CLASS("_TtC12PayEngineSDK12CardResponse")
1036
- @interface CardResponse : NSObject
1037
- - (nullable instancetype)initWithMessage:(NSString * _Nonnull)message data:(PECard * _Nonnull)data error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1038
- - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1039
- + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1040
- @end
1041
-
1042
-
1043
- @class NSBundle;
1342
+ @class PEBankAccount;
1044
1343
  @class NSCoder;
1045
1344
 
1046
- SWIFT_CLASS("_TtC12PayEngineSDK28FraudAnalyticsViewController")
1047
- @interface FraudAnalyticsViewController : KountAnalyticsViewController
1048
- - (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER;
1049
- - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
1050
- @end
1051
-
1052
-
1345
+ /// A secure view for entering a customer’s bank account information safely.
1346
+ /// This view displays input fields required to securely collect bank account details.
1347
+ /// It also provides methods to validate the provided information and saving a customer’s bank acount by securely storing the information in PayEngine’s system.
1348
+ /// This view complies with PCI standards and does not store data locally.
1349
+ /// Instead, it forwards the information to a PCI-compliant third party, which encrypts and transfers the bank account details to PayEngine’s system.
1350
+ /// In addition to the required fields that the view sets up for you, you can also pass additional fields and specify whether they are required.
1351
+ /// <h2>How It Works</h2>
1352
+ /// Call the <code>PayEngine/createBankAccountView(additionalFields:completion:)-3gn3i</code> method on the <code>PayEngine</code> object to obtain an instance of <code>IBankAccountView</code>. You can also include additional fields if needed.
1353
+ /// Use the <code>validate()</code> method to check if all fields pass validation.
1354
+ /// Once all fields are valid, call the <code>createBankAccount(merchantId:completion:)</code> method to save the bank account in the PayEngine system.
1355
+ /// <h2>Usage Example</h2>
1356
+ /// \code
1357
+ /// payengine.createBankAccountView(additionalFields: []) { [unowned self] result in
1358
+ /// switch result {
1359
+ /// case .success(let view): // This is where you get the `IBankAccountView` instance
1360
+ /// DispatchQueue.main.async {
1361
+ /// self.secureField = view
1362
+ /// self.stackView.spacing = 20
1363
+ /// self.stackView.addArrangedSubview(self.secureField)
1364
+ ///
1365
+ /// let button = UIButton(type: .system)
1366
+ /// button.setTitle("Create Bank Account", for: .normal)
1367
+ ///
1368
+ /// // Register tap action, which will send the createBankAccount request
1369
+ /// button.addTarget(self, action: #selector(self.onButtonTap), for: .touchUpInside)
1370
+ ///
1371
+ /// self.stackView.addArrangedSubview(button)
1372
+ /// }
1373
+ ///
1374
+ /// case .failure(let error):
1375
+ /// debugPrint("Error: \(error)")
1376
+ /// }
1377
+ /// }
1378
+ ///
1379
+ /// @objc func onButtonTap() {
1380
+ /// secureField.createBankAccount(merchantId: MERCHANT_ID) { [unowned self] result in
1381
+ /// switch result {
1382
+ /// case .success(let data):
1383
+ /// let alert = UIAlertController(
1384
+ /// title: "Bank Account Created",
1385
+ /// message: data.token,
1386
+ /// preferredStyle: .alert
1387
+ /// )
1388
+ /// alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
1389
+ /// self.present(alert, animated: true, completion: nil)
1390
+ ///
1391
+ /// case .failure(let error):
1392
+ /// debugPrint("Error: \(error)")
1393
+ /// }
1394
+ /// }
1395
+ /// }
1396
+ ///
1397
+ /// \endcode
1053
1398
  SWIFT_CLASS("_TtC12PayEngineSDK16IBankAccountView")
1054
1399
  @interface IBankAccountView : UIStackView
1400
+ /// After the user has entered and validated their bank accoount information, this method can be called to save the bank account in the PayEngine system.
1401
+ /// \param merchantId Your merchant’s ID.
1402
+ ///
1403
+ /// \param additionalData Additional data to be included along with the bank account information.
1404
+ ///
1405
+ /// \param completion Callback that provides an instance of the newly created <code>PEBankAccount</code> object.
1406
+ ///
1407
+ /// \param failure Callback that returns an error if the request fails.
1408
+ ///
1055
1409
  - (void)createBankAccountWithMerchantId:(NSString * _Nullable)merchantId additionalData:(NSDictionary<NSString *, id> * _Nonnull)additionalData completion:(void (^ _Nonnull)(PEBankAccount * _Nonnull))completion failure:(void (^ _Nonnull)(NSError * _Nonnull))failure;
1056
1410
  - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
1057
1411
  - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
1058
1412
  @end
1059
1413
 
1414
+ @class PECard;
1060
1415
 
1416
+ /// A secure view for entering a customer’s payment card information safely.
1417
+ /// This view displays input fields required to securely collect payment card details.
1418
+ /// It also provides methods to validate the provided information and saving a customer’s card by securely storing the information in PayEngine’s system.
1419
+ /// This view complies with PCI standards and does not store data locally.
1420
+ /// Instead, it forwards the information to a PCI-compliant third party, which encrypts and transfers the card details to PayEngine’s system.
1421
+ /// In addition to the required fields that the view sets up for you, you can also pass additional fields and specify whether they are required.
1422
+ /// <h2>How It Works</h2>
1423
+ /// Call the <code>PayEngine/createSecureView(additionalFields:completion:)-5x9ky</code> method on the <code>PayEngine</code> object to obtain an instance of <code>ICardNumberView</code>. You can also include additional fields if needed.
1424
+ /// Use the <code>validate()</code> method to check if all fields pass validation.
1425
+ /// Once all fields are valid, call the <code>createCard(merchantId:completion:)</code> method to save the card in the PayEngine system.
1426
+ /// <h2>Usage Example</h2>
1427
+ /// \code
1428
+ /// let zipField = PEField(
1429
+ /// name: "address_zip",
1430
+ /// type: "text",
1431
+ /// placeholder: "Zip code",
1432
+ /// isRequired: true,
1433
+ /// keyboardType: .alphabet,
1434
+ /// pattern: #"^(?:\d{5}(?:-\d{4})?|[ABCEGHJKLMNPRSTVXY]\d[A-Z] ?\d[A-Z]\d)$"#
1435
+ /// )
1436
+ ///
1437
+ /// payengine.createSecureView(additionalFields: [zipField]) { [unowned self] result in
1438
+ /// switch result {
1439
+ /// case .success(let view): // This is where you get the `ICardNumberView` instance
1440
+ /// DispatchQueue.main.async {
1441
+ /// self.secureField = view
1442
+ /// self.stackView.spacing = 20
1443
+ /// self.stackView.addArrangedSubview(self.secureField)
1444
+ ///
1445
+ /// let button = UIButton(type: .system)
1446
+ /// button.setTitle("Create Card", for: .normal)
1447
+ ///
1448
+ /// // Register tap action, which will send the createCard request
1449
+ /// button.addTarget(self, action: #selector(self.onButtonTap), for: .touchUpInside)
1450
+ /// self.stackView.addArrangedSubview(button)
1451
+ /// }
1452
+ ///
1453
+ /// case .failure(let error):
1454
+ /// debugPrint("Error: \(error)")
1455
+ /// }
1456
+ /// }
1457
+ ///
1458
+ /// @objc func onButtonTap() {
1459
+ /// let additionalData = ["test_data": true]
1460
+ ///
1461
+ /// secureField.createCard(merchantId: MERCHANT_ID, additionalData: additionalData) { [unowned self] result in
1462
+ /// switch result {
1463
+ /// case .success(let data):
1464
+ /// let alert = UIAlertController(
1465
+ /// title: "Card Created",
1466
+ /// message: data.token,
1467
+ /// preferredStyle: .alert
1468
+ /// )
1469
+ /// alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
1470
+ ///
1471
+ /// self.present(alert, animated: true, completion: nil)
1472
+ /// self.cardToken = data.token
1473
+ ///
1474
+ /// debugPrint("Card token: \(data.token)")
1475
+ /// self.saleButton.isHidden = false
1476
+ ///
1477
+ /// case .failure(let error):
1478
+ /// debugPrint("Error: \(error)")
1479
+ /// }
1480
+ /// }
1481
+ /// }
1482
+ ///
1483
+ /// \endcode
1061
1484
  SWIFT_CLASS("_TtC12PayEngineSDK15ICardNumberView")
1062
1485
  @interface ICardNumberView : UIStackView
1486
+ /// After the user has entered and validated their card information, this method can be called to save the card in the PayEngine system.
1487
+ /// \param merchantId Your merchant’s ID.
1488
+ ///
1489
+ /// \param additionalData Additional data to be included along with the card information.
1490
+ ///
1491
+ /// \param completion Callback that provides an instance of the newly created <code>PECard</code> object.
1492
+ ///
1493
+ /// \param failure Callback that returns an error if the request fails.
1494
+ ///
1063
1495
  - (void)createCardWithMerchantId:(NSString * _Nullable)merchantId additionalData:(NSDictionary<NSString *, id> * _Nonnull)additionalData completion:(void (^ _Nonnull)(PECard * _Nonnull))completion failure:(void (^ _Nonnull)(NSError * _Nonnull))failure;
1064
1496
  - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
1065
1497
  - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
@@ -1068,12 +1500,62 @@ SWIFT_CLASS("_TtC12PayEngineSDK15ICardNumberView")
1068
1500
  @protocol PEApplePayDelegate;
1069
1501
  @class UIButton;
1070
1502
 
1503
+ /// A class that facilitates Apple Pay transactions.
1504
+ /// <blockquote>
1505
+ /// Important: Making the object for this class is not allowed. The shared instance of this class provides methods to configure and initiate Apple Pay payments. The shared instance is managed internally and you don’t need to access it directly.
1506
+ ///
1507
+ /// </blockquote>
1508
+ /// When you call the <code>PayEngine/setupApplePay(merchantId:completion:)</code> the shared instance gets returned to you in a completion callback.
1509
+ /// Once you get the shared instance call this method <code>setupApplePayButton(for:type:style:)</code> to get a <code>UIButton</code> that triggers the Apple Pay payment flow when tapped.
1510
+ /// <h2>Usage Example</h2>
1511
+ /// \code
1512
+ /// // The payengineSDK instance
1513
+ /// let payengine = PayEngine(config: CONFIG)
1514
+ /// payengine.setupApplePay(merchantId: "Your merchant's id") { result in
1515
+ /// switch result {
1516
+ /// case .success(let applePay): // This is where you get the singleton instance of `PEApplePay`
1517
+ /// applePay.delegate = self
1518
+ ///
1519
+ /// let request = ApplePayPaymentRequest()
1520
+ /// request.build(
1521
+ /// paymentItems: [],
1522
+ /// paymentAmount: 1.0,
1523
+ /// currencyCode: "USD",
1524
+ /// requiredBillingContactFields: [.name, .postalAddress],
1525
+ /// requiredShippingContactFields: [.name, .emailAddress, .postalAddress],
1526
+ /// shippingMethods: shippingMethods
1527
+ /// )
1528
+ ///
1529
+ /// DispatchQueue.main.async {
1530
+ /// if let applePayButton = applePay.setupApplePayButton(for: request, type: .checkout) {
1531
+ /// // Add this button to your view hierarchy.
1532
+ /// // When tapped, it will automatically start the Apple Pay payment flow.
1533
+ /// }
1534
+ /// }
1535
+ ///
1536
+ /// case .failure(let error):
1537
+ /// print("Unable to setup Apple Pay: \(error)")
1538
+ /// }
1539
+ /// }
1540
+ ///
1541
+ /// \endcode
1071
1542
  SWIFT_CLASS("_TtC12PayEngineSDK10PEApplePay")
1072
1543
  @interface PEApplePay : NSObject
1544
+ /// A delegate conforming to the <code>PEApplePayDelegate</code> protocol that handles Apple Pay events.
1073
1545
  @property (nonatomic, strong) id <PEApplePayDelegate> _Nullable delegate;
1546
+ /// Creates and returns a <code>UIButton</code> styled as an Apple Pay button.
1547
+ /// When the button is tapped, it initiates the Apple Pay authorization flow. Depending on the supported payment network,
1548
+ /// the button may direct users to set up Apple Pay or proceed with a payment.
1549
+ /// \param paymentRequest An <code>ApplePayPaymentRequest</code> containing details of the payment request.
1550
+ ///
1551
+ /// \param type The type of Apple Pay button (e.g., <code>.checkout</code>, <code>.book</code>). Default is <code>.checkout</code>.
1552
+ ///
1553
+ /// \param style The style of the button (e.g., <code>.black</code>, <code>.white</code>). Default is <code>.black</code>.
1554
+ ///
1555
+ ///
1556
+ /// returns:
1557
+ /// A <code>UIButton</code> configured for Apple Pay, or <code>nil</code> if Apple Pay is not available.
1074
1558
  - (UIButton * _Nullable)setupApplePayButtonFor:(ApplePayPaymentRequest * _Nonnull)paymentRequest type:(PKPaymentButtonType)type style:(PKPaymentButtonStyle)style SWIFT_WARN_UNUSED_RESULT;
1075
- - (BOOL)startApplePayPaymentAndReturnError:(NSError * _Nullable * _Nullable)error;
1076
- - (void)startApplePaySetup;
1077
1559
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1078
1560
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1079
1561
  @end
@@ -1096,158 +1578,270 @@ SWIFT_CLASS("_TtC12PayEngineSDK10PEApplePay")
1096
1578
 
1097
1579
  enum PEApplePayResult : NSInteger;
1098
1580
 
1581
+ /// A delegate protocol that provides callbacks for various events during the Apple Pay transaction process.
1582
+ /// This protocol notifies the conforming delegate about errors, UI status updates, payment token retrieval,
1583
+ /// and optional user interactions such as selecting shipping or payment methods.
1099
1584
  SWIFT_PROTOCOL("_TtP12PayEngineSDK18PEApplePayDelegate_")
1100
1585
  @protocol PEApplePayDelegate
1586
+ /// Called when an error occurs during the Apple Pay transaction.
1587
+ /// \param error The error that occurred.
1588
+ ///
1101
1589
  - (void)paymentErrorWithError:(NSError * _Nonnull)error;
1590
+ /// Called when the Apple Pay payment sheet is dismissed.
1591
+ /// This can occur when the user cancels the payment request or when the payment is successfully completed.
1102
1592
  - (void)paymentSheetDidMDismiss;
1593
+ /// Called when a payment token is successfully received after Apple Pay authorization.
1594
+ /// \param token The payment token received from Apple Pay.
1595
+ ///
1596
+ /// \param metadata Additional metadata related to the transaction, if available.
1597
+ ///
1598
+ /// \param billingContact The user’s billing contact information.
1599
+ ///
1600
+ /// \param shippingContact The user’s shipping contact information.
1601
+ ///
1602
+ /// \param completion A completion handler that must be called with a <code>PEApplePayResult</code> value.
1603
+ ///
1103
1604
  - (void)paymentTokenDidReturnWithToken:(NSString * _Nonnull)token metadata:(NSDictionary<NSString *, id> * _Nullable)metadata billingContact:(PKContact * _Nullable)billingContact shippingContact:(PKContact * _Nullable)shippingContact completion:(void (^ _Nonnull)(enum PEApplePayResult))completion;
1605
+ /// Called when a payment token is unavailable due to an error during token exchange.
1606
+ /// \param error The error that occurred, if available.
1607
+ ///
1104
1608
  - (void)paymentTokenNotAvailableWithError:(NSError * _Nullable)error;
1105
1609
  @optional
1610
+ /// Called when the user selects a shipping contact during checkout.
1611
+ /// \param contact The selected shipping contact.
1612
+ ///
1613
+ /// \param completion A handler that must be called with a <code>PKPaymentRequestShippingContactUpdate</code> to update the shipping details.
1614
+ ///
1106
1615
  - (void)didSelectShippingContact:(PKContact * _Nonnull)contact handler:(void (^ _Nonnull)(PKPaymentRequestShippingContactUpdate * _Nonnull))completion SWIFT_AVAILABILITY(ios,introduced=11.0);
1616
+ /// Called when the user selects a shipping method.
1617
+ /// \param shippingMethod The selected shipping method.
1618
+ ///
1619
+ /// \param completion A handler that must be called with a <code>PKPaymentRequestShippingMethodUpdate</code> to update the shipping method details.
1620
+ ///
1107
1621
  - (void)didSelectShippingMethod:(PKShippingMethod * _Nonnull)shippingMethod handler:(void (^ _Nonnull)(PKPaymentRequestShippingMethodUpdate * _Nonnull))completion SWIFT_AVAILABILITY(ios,introduced=11.0);
1622
+ /// Called when the user selects a payment method.
1623
+ /// \param paymentMethod The selected payment method.
1624
+ ///
1625
+ /// \param completion A handler that must be called with a <code>PKPaymentRequestPaymentMethodUpdate</code> to update the payment method details.
1626
+ ///
1108
1627
  - (void)didSelectPaymentMethod:(PKPaymentMethod * _Nonnull)paymentMethod handler:(void (^ _Nonnull)(PKPaymentRequestPaymentMethodUpdate * _Nonnull))completion SWIFT_AVAILABILITY(ios,introduced=11.0);
1109
1628
  @end
1110
1629
 
1630
+ /// An enum representing the Apple Payment Result’s success or failure.
1111
1631
  typedef SWIFT_ENUM(NSInteger, PEApplePayResult, open) {
1632
+ /// Success if the payment was successful..
1112
1633
  PEApplePayResultSuccess = 0,
1634
+ /// Failiure if the payment was not successful.
1113
1635
  PEApplePayResultFailure = 1,
1114
1636
  };
1115
1637
 
1116
1638
 
1117
- /// PayEngine Card object
1639
+ /// A PayEngine bank account object.
1640
+ /// This class represents a bank account stored within PayEngine, containing a secure token
1641
+ /// and account details.
1118
1642
  SWIFT_CLASS("_TtC12PayEngineSDK13PEBankAccount")
1119
1643
  @interface PEBankAccount : NSObject
1120
- @property (nonatomic, copy) NSString * _Nonnull token;
1121
- @property (nonatomic, strong) BankAccountData * _Nonnull bankAccountData;
1122
- - (nullable instancetype)initWithToken:(NSString * _Nonnull)token bankAccountData:(BankAccountData * _Nonnull)bankAccountData error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1644
+ /// A unique token representing the bank account.
1645
+ @property (nonatomic, readonly, copy) NSString * _Nonnull token;
1646
+ /// The associated bank account details.
1647
+ @property (nonatomic, readonly, strong) BankAccountData * _Nonnull bankAccountData;
1123
1648
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1124
1649
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1125
1650
  @end
1126
1651
 
1127
1652
 
1128
- SWIFT_CLASS("_TtC12PayEngineSDK17PEBankAccountView")
1129
- @interface PEBankAccountView : IBankAccountView
1130
- - (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
1131
- - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
1132
- - (void)didMoveToSuperview;
1133
- - (void)layoutSubviews;
1134
- @end
1135
-
1136
-
1137
- /// PayEngine Card object
1653
+ /// A PayEngine card object.
1654
+ /// This class represents a payment card stored with PayEngine, containing a secure token
1655
+ /// and associated card details.
1138
1656
  SWIFT_CLASS("_TtC12PayEngineSDK6PECard")
1139
1657
  @interface PECard : NSObject
1140
- @property (nonatomic, copy) NSString * _Nonnull token;
1141
- @property (nonatomic, strong) CardData * _Nonnull cardData;
1142
- - (nullable instancetype)initWithToken:(NSString * _Nonnull)token cardData:(CardData * _Nonnull)cardData error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1658
+ /// A unique token representing the card.
1659
+ @property (nonatomic, readonly, copy) NSString * _Nonnull token;
1660
+ /// The associated card details.
1661
+ @property (nonatomic, readonly, strong) CardData * _Nonnull cardData;
1143
1662
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1144
1663
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1145
1664
  @end
1146
1665
 
1147
- @class PEConfig;
1148
- @class WKUserContentController;
1149
- @class WKScriptMessage;
1150
-
1151
- /// PEComponent
1152
- SWIFT_CLASS("_TtC12PayEngineSDK11PEComponent")
1153
- @interface PEComponent : UIView <WKScriptMessageHandler>
1154
- - (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
1155
- - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
1156
- - (void)didMoveToSuperview;
1157
- - (void)setupWithConfig:(PEConfig * _Nonnull)config componentName:(NSString * _Nonnull)componentName props:(NSDictionary<NSString *, NSString *> * _Nonnull)props;
1158
- - (void)pinToView:(UIView * _Nonnull)view;
1159
- - (void)registerEventWithName:(NSString * _Nonnull)name handler:(void (^ _Nonnull)(id _Nonnull))handler;
1160
- - (void)removeEventWithName:(NSString * _Nonnull)name;
1161
- - (void)userContentController:(WKUserContentController * _Nonnull)userContentController didReceiveScriptMessage:(WKScriptMessage * _Nonnull)message;
1162
- @end
1163
-
1164
1666
 
1165
- /// PayEngine configuration
1667
+ /// A class that is used to configure the <code>PayEngine</code> object.
1668
+ /// This class stores the authentication key that is generated by PayEngine. It also defines the PayEngine’s backend environement which the <code>PayEngine</code> object will interact with.
1166
1669
  SWIFT_CLASS("_TtC12PayEngineSDK8PEConfig")
1167
1670
  @interface PEConfig : NSObject
1671
+ /// Constructor for the <code>PEConfig</code> class
1672
+ /// \param publicKey PayEngine public key.
1673
+ ///
1674
+ /// \param baseURL Base URL for your custom environemnt. Default is <code>nil</code>. If set as <code>nil</code> the object will setup the environment based on the value of the <code>publicKey</code>.
1675
+ ///
1168
1676
  - (nonnull instancetype)initWithPublicKey:(NSString * _Nonnull)publicKey baseURL:(NSString * _Nullable)baseURL OBJC_DESIGNATED_INITIALIZER;
1677
+ /// Returns the base url with which the <code>PayEngine</code> object interacts with.
1678
+ ///
1679
+ /// returns:
1680
+ /// A Base URL. If no url was provided when constructing the object, then this method will return a url based on the <code>publicKey</code> provided in the <code>init(publicKey:baseURL:)</code>
1169
1681
  - (NSString * _Nonnull)getBaseURL SWIFT_WARN_UNUSED_RESULT;
1682
+ /// To check if the environment is set as production.
1683
+ ///
1684
+ /// returns:
1685
+ /// Returns <code>true</code> if the environment is set as live. Returns <code>false</code> otherwise.
1170
1686
  - (BOOL)isProduction SWIFT_WARN_UNUSED_RESULT;
1171
1687
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1172
1688
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1173
1689
  @end
1174
1690
 
1175
1691
 
1692
+ /// A type that represents an input field.
1693
+ /// This class defines an input field with properties that determine its behavior, such as its name, type, placeholder,
1694
+ /// whether it is required, keyboard type, and optional validation pattern.
1695
+ /// Internal UI components use this type to create input fields that adhere to the specified input criteria.
1176
1696
  SWIFT_CLASS("_TtC12PayEngineSDK7PEField")
1177
1697
  @interface PEField : NSObject
1698
+ /// The name of the field.
1699
+ @property (nonatomic, copy) NSString * _Nonnull name;
1700
+ /// The type of the field.
1701
+ @property (nonatomic, copy) NSString * _Nonnull type;
1702
+ /// The placeholder text displayed when the field is empty.
1703
+ @property (nonatomic, copy) NSString * _Nonnull placeholder;
1704
+ /// A Boolean value indicating whether the field is required.
1705
+ /// If <code>true</code>, the field must contain a value before submission.
1706
+ @property (nonatomic) BOOL isRequired;
1707
+ /// A regular expression pattern used to validate the field’s input.
1708
+ /// If <code>nil</code>, no validation is performed.
1709
+ @property (nonatomic, copy) NSString * _Nullable pattern;
1178
1710
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1179
1711
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1180
1712
  @end
1181
1713
 
1182
-
1183
- /// PEPaymentView
1184
- SWIFT_CLASS("_TtC12PayEngineSDK13PEPaymentView")
1185
- @interface PEPaymentView : ICardNumberView
1186
- - (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
1187
- - (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
1188
- - (void)didMoveToSuperview;
1189
- - (void)layoutSubviews;
1190
- - (void)setupWithVaultId:(NSString * _Nonnull)vaultId env:(NSString * _Nonnull)env publicKey:(NSString * _Nonnull)publicKey additionalFields:(NSArray<PEField *> * _Nonnull)additionalFields;
1191
- - (BOOL)validate SWIFT_WARN_UNUSED_RESULT;
1192
- - (void)showKeyboard;
1193
- @end
1194
-
1714
+ /// Color Theme for the SDK.
1195
1715
  typedef SWIFT_ENUM(NSInteger, PEThemeMode, open) {
1196
1716
  PEThemeModeSystem = 0,
1197
1717
  PEThemeModeDark = 1,
1198
1718
  PEThemeModeLight = 2,
1199
1719
  };
1200
1720
 
1721
+ @class UIView;
1201
1722
  @class ThreeDSResult;
1202
1723
 
1203
- /// PayEngine Main Class
1724
+ /// <code>PayEngine</code> is the main entry point for integrating PayEngine’s payment processing features.
1725
+ /// This class provides a centralized interface for:
1726
+ /// <ul>
1727
+ /// <li>
1728
+ /// Secure card and bank account entry
1729
+ /// </li>
1730
+ /// <li>
1731
+ /// Apple Pay integration
1732
+ /// </li>
1733
+ /// <li>
1734
+ /// Fraud monitoring and 3D Secure authentication
1735
+ /// </li>
1736
+ /// </ul>
1737
+ /// <h2>Key Features</h2>
1738
+ /// <h3>Secure Payment Views</h3>
1739
+ /// <ul>
1740
+ /// <li>
1741
+ /// Supports secure card entry via <code>createSecureView(additionalFields:completion:)</code>
1742
+ /// </li>
1743
+ /// <li>
1744
+ /// Supports secure bank account entry via <code>createBankAccountView(additionalFields:completion:)</code>
1745
+ /// </li>
1746
+ /// <li>
1747
+ /// PCI-compliant data handling with external encryption and tokenization
1748
+ /// </li>
1749
+ /// </ul>
1750
+ /// <h3>Apple Pay Integration</h3>
1751
+ /// <ul>
1752
+ /// <li>
1753
+ /// Detects Apple Pay availability
1754
+ /// </li>
1755
+ /// <li>
1756
+ /// Provides Apple Pay button creation
1757
+ /// </li>
1758
+ /// <li>
1759
+ /// Manages Apple Pay transaction processing
1760
+ /// </li>
1761
+ /// </ul>
1762
+ /// <h3>Fraud Monitoring & 3D Secure</h3>
1763
+ /// <ul>
1764
+ /// <li>
1765
+ /// Creates fraud monitoring sessions via <code>createFraudMonitorSession(merchantId:completion:)</code>
1766
+ /// </li>
1767
+ /// <li>
1768
+ /// Supports 3D Secure authentication via <code>perform3DSFlow(view:threeDSData:handler:)</code>
1769
+ /// </li>
1770
+ /// </ul>
1771
+ /// <h2>Usage Example</h2>
1772
+ /// \code
1773
+ /// // Initialize PayEngine
1774
+ /// let payEngine = PayEngine(config: config)
1775
+ ///
1776
+ /// // Create a secure card entry view
1777
+ /// payEngine.createSecureView(additionalFields: []) { result in
1778
+ /// switch result {
1779
+ /// case .success(let view):
1780
+ /// self.view.addSubview(view)
1781
+ /// case .failure(let error):
1782
+ /// print("Error: \(error)")
1783
+ /// }
1784
+ /// }
1785
+ ///
1786
+ /// \endcodeseealso:
1787
+ /// <code>ICardNumberView</code>, <code>IBankAccountView</code>, <code>PEApplePay</code>
1204
1788
  SWIFT_CLASS("_TtC12PayEngineSDK9PayEngine")
1205
1789
  @interface PayEngine : NSObject
1206
- /// Constructor
1207
- /// \param config PayEngine configuration
1790
+ /// Initializes the <code>PayEngine</code> with the given configuration.
1791
+ /// \param config The configuration object <code>PEConfig</code> containing necessary settings.
1208
1792
  ///
1209
1793
  - (nonnull instancetype)initWithConfig:(PEConfig * _Nonnull)config OBJC_DESIGNATED_INITIALIZER;
1794
+ /// Sets the theme mode for the PayEngine UI components.
1795
+ /// \param themeMode The desired theme mode <code>PEThemeMode</code>.
1796
+ ///
1210
1797
  + (void)setThemeMode:(enum PEThemeMode)themMode;
1211
- - (PEComponent * _Nonnull)createComponentWithName:(NSString * _Nonnull)name props:(NSDictionary<NSString *, NSString *> * _Nonnull)props SWIFT_WARN_UNUSED_RESULT;
1798
+ /// Creates a secure card entry view for collecting payment details.
1799
+ /// \param additionalFields Optional additional fields to be included of type <code>PEField</code>.
1800
+ ///
1801
+ /// \param completion A closure returning the <code>ICardNumberView</code> instance.
1802
+ ///
1212
1803
  - (void)createSecureViewWithAdditionalFields:(NSArray<PEField *> * _Nullable)additionalFields completion:(void (^ _Nonnull)(ICardNumberView * _Nonnull))completion;
1804
+ /// Creates a secure bank account entry view.
1805
+ /// \param additionalFields Optional additional fields to be included.
1806
+ ///
1807
+ /// \param completion A closure returning the <code>IBankAccountView</code> instance.
1808
+ ///
1213
1809
  - (void)createBankAccountViewWithAdditionalFields:(NSArray<PEField *> * _Nullable)additionalFields completion:(void (^ _Nonnull)(IBankAccountView * _Nonnull))completion;
1810
+ /// Retrieves browser-related information.
1811
+ /// \param view The UI view in which the web view is embedded.
1812
+ ///
1813
+ /// \param handler A closure returning browser details as a <code>String</code>.
1814
+ ///
1214
1815
  - (void)getBrowserInfoWithView:(UIView * _Nonnull)view handler:(void (^ _Nonnull)(NSString * _Nonnull))handler;
1816
+ /// Initiates a 3D Secure authentication process.
1817
+ /// \param view The UI view in which the 3D Secure flow should be presented.
1818
+ ///
1819
+ /// \param threeDSData The authentication data required for 3D Secure.
1820
+ ///
1821
+ /// \param handler A closure returning the <code>ThreeDSResult</code> upon completion.
1822
+ ///
1215
1823
  - (void)perform3DSFlowWithView:(UIView * _Nonnull)view threeDSData:(NSString * _Nonnull)threeDSData handler:(void (^ _Nonnull)(ThreeDSResult * _Nonnull))handler;
1824
+ /// Creates a fraud monitoring session.
1825
+ /// \param merchantId The merchant’s unique identifier.
1826
+ ///
1827
+ /// \param completion A closure returning the fraud monitoring session ID as a <code>String</code>.
1828
+ ///
1216
1829
  - (void)createFraudMonitorSessionWithMerchantId:(NSString * _Nonnull)merchantId completion:(void (^ _Nonnull)(NSString * _Nonnull))completion;
1217
1830
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1218
1831
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1219
1832
  @end
1220
1833
 
1221
1834
 
1222
- SWIFT_CLASS("_TtC12PayEngineSDK14ThreeDSMessage")
1223
- @interface ThreeDSMessage : NSObject
1224
- - (nullable instancetype)initWithType:(NSString * _Nonnull)type subtype:(NSString * _Nonnull)subtype data:(ThreeDSResult * _Nullable)data error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1225
- - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1226
- + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1227
- @end
1228
-
1229
- @class WKWebView;
1230
- @class WKNavigationAction;
1231
- @class WKNavigation;
1232
-
1233
- SWIFT_CLASS("_TtC12PayEngineSDK12ThreeDSModal")
1234
- @interface ThreeDSModal : UIView <WKNavigationDelegate, WKScriptMessageHandler>
1235
- - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
1236
- - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
1237
- - (void)setupWithConfig:(PEConfig * _Nonnull)config threeDSData:(NSString * _Nonnull)threeDSData handler:(void (^ _Nonnull)(ThreeDSResult * _Nonnull))handler;
1238
- - (void)setupWebView;
1239
- - (void)webView:(WKWebView * _Nonnull)webView decidePolicyForNavigationAction:(WKNavigationAction * _Nonnull)navigationAction decisionHandler:(void (^ _Nonnull)(WKNavigationActionPolicy))decisionHandler;
1240
- - (void)webView:(WKWebView * _Nonnull)webView didFinishNavigation:(WKNavigation * _Null_unspecified)navigation;
1241
- - (void)userContentController:(WKUserContentController * _Nonnull)userContentController didReceiveScriptMessage:(WKScriptMessage * _Nonnull)message;
1242
- @end
1243
-
1244
1835
 
1836
+ /// Type that represents the result for the ThreeDS process
1245
1837
  SWIFT_CLASS("_TtC12PayEngineSDK13ThreeDSResult")
1246
1838
  @interface ThreeDSResult : NSObject
1247
- @property (nonatomic, copy) NSString * _Nullable message;
1248
- @property (nonatomic) BOOL success;
1249
- @property (nonatomic, copy) NSString * _Nullable transactionId;
1250
- - (nullable instancetype)initWithMessage:(NSString * _Nullable)message success:(BOOL)success transactionId:(NSString * _Nullable)transactionId error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
1839
+ /// The message for the result
1840
+ @property (nonatomic, readonly, copy) NSString * _Nullable message;
1841
+ /// Bool indicating whether the transaction was successful or not
1842
+ @property (nonatomic, readonly) BOOL success;
1843
+ /// Transaction ID resulting after the ThreeDS Flow completion
1844
+ @property (nonatomic, readonly, copy) NSString * _Nullable transactionId;
1251
1845
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1252
1846
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1253
1847
  @end