@connexup/react-native-square-mobile-payment-sdk 0.1.0

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 (161) hide show
  1. package/LICENSE +20 -0
  2. package/NativeSquareMobilePaymentSDK.podspec +23 -0
  3. package/README.md +66 -0
  4. package/android/build.gradle +81 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/connexup/square/mobilepayment/DateFormatUtils.java +29 -0
  8. package/android/src/main/java/com/connexup/square/mobilepayment/ErrorUtilities.kt +56 -0
  9. package/android/src/main/java/com/connexup/square/mobilepayment/MobilePaymentAuthorization.kt +185 -0
  10. package/android/src/main/java/com/connexup/square/mobilepayment/MobilePaymentException.kt +8 -0
  11. package/android/src/main/java/com/connexup/square/mobilepayment/MobilePaymentPayment.kt +542 -0
  12. package/android/src/main/java/com/connexup/square/mobilepayment/MobilePaymentReader.kt +344 -0
  13. package/android/src/main/java/com/connexup/square/mobilepayment/MobilePaymentSDK.kt +47 -0
  14. package/android/src/main/java/com/connexup/square/mobilepayment/MobilePaymentSDKPackage.kt +77 -0
  15. package/android/src/main/java/com/connexup/square/mobilepayment/MobilePaymentSetting.kt +144 -0
  16. package/android/src/main/java/com/connexup/square/mobilepayment/convert/AdditionalPaymentMethodConvert.kt +46 -0
  17. package/android/src/main/java/com/connexup/square/mobilepayment/convert/AuthorizationStateConvert.kt +26 -0
  18. package/android/src/main/java/com/connexup/square/mobilepayment/convert/CardConvert.kt +53 -0
  19. package/android/src/main/java/com/connexup/square/mobilepayment/convert/CardDetailsConvert.kt +74 -0
  20. package/android/src/main/java/com/connexup/square/mobilepayment/convert/CardEntryMethodConvert.kt +31 -0
  21. package/android/src/main/java/com/connexup/square/mobilepayment/convert/CashPaymentDetailsConvert.kt +18 -0
  22. package/android/src/main/java/com/connexup/square/mobilepayment/convert/CurrencyCodeConvert.kt +204 -0
  23. package/android/src/main/java/com/connexup/square/mobilepayment/convert/DelayActionConvert.kt +33 -0
  24. package/android/src/main/java/com/connexup/square/mobilepayment/convert/DeniedReasonConvert.kt +28 -0
  25. package/android/src/main/java/com/connexup/square/mobilepayment/convert/DigitalWalletDetailsConvert.kt +18 -0
  26. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ErrorDetailsConvert.kt +32 -0
  27. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ExternalPaymentDetailsConvert.kt +25 -0
  28. package/android/src/main/java/com/connexup/square/mobilepayment/convert/LocationConvert.kt +31 -0
  29. package/android/src/main/java/com/connexup/square/mobilepayment/convert/MoneyConvert.kt +31 -0
  30. package/android/src/main/java/com/connexup/square/mobilepayment/convert/OfflineStatusConvert.kt +21 -0
  31. package/android/src/main/java/com/connexup/square/mobilepayment/convert/PaymentConvert.kt +93 -0
  32. package/android/src/main/java/com/connexup/square/mobilepayment/convert/PaymentProcessingFeeConvert.kt +39 -0
  33. package/android/src/main/java/com/connexup/square/mobilepayment/convert/PaymentSettingsConvert.kt +26 -0
  34. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ProcessingModeConvert.kt +28 -0
  35. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ReaderBatteryStatusConvert.kt +19 -0
  36. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ReaderChangeEventConvert.kt +75 -0
  37. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ReaderConnectionTypeConvert.kt +17 -0
  38. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ReaderInfoConvert.kt +51 -0
  39. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ReaderModalConvert.kt +18 -0
  40. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ReaderStateConvert.kt +51 -0
  41. package/android/src/main/java/com/connexup/square/mobilepayment/convert/ReaderStatusConvert.kt +51 -0
  42. package/android/src/main/java/com/connexup/square/mobilepayment/convert/SdkSettingsConvert.kt +30 -0
  43. package/android/src/main/java/com/connexup/square/mobilepayment/convert/SquareAccountDetailsConvert.kt +20 -0
  44. package/android/src/main/java/com/connexup/square/mobilepayment/convert/TrackingConsentStateConvert.kt +17 -0
  45. package/android/src/main/java/com/connexup/square/mobilepayment/convert/WalletBrandConvert.kt +41 -0
  46. package/ios/Converters/AdditionalPaymentMethod+Extension.swift +17 -0
  47. package/ios/Converters/AdditionalPaymentMethodType+Extension.swift +44 -0
  48. package/ios/Converters/AuthorizationState+Extension.swift +22 -0
  49. package/ios/Converters/BatteryLevel+Extension.swift +27 -0
  50. package/ios/Converters/Card+Extension.swift +33 -0
  51. package/ios/Converters/CardBrand+Extension.swift +47 -0
  52. package/ios/Converters/CardCoBrand+Extension.swift +24 -0
  53. package/ios/Converters/CardEntryMethod+Extension.swift +30 -0
  54. package/ios/Converters/CardInputMethods+Extension.swift +35 -0
  55. package/ios/Converters/CardInsertionStatus+Extension.swift +24 -0
  56. package/ios/Converters/CardPaymentDetails+Extensions.swift +31 -0
  57. package/ios/Converters/CardPaymentStatus+Extension.swift +28 -0
  58. package/ios/Converters/Currency+Extension.swift +50 -0
  59. package/ios/Converters/Location+Extension.swift +19 -0
  60. package/ios/Converters/MoneyAmount+Extension.swift +30 -0
  61. package/ios/Converters/Payment+Extension.swift +44 -0
  62. package/ios/Converters/PaymentSettings+Extension.swift +19 -0
  63. package/ios/Converters/PaymentStatus+Extension.swift +53 -0
  64. package/ios/Converters/ProcessingMode+Extension.swift +37 -0
  65. package/ios/Converters/ReaderBatteryStatus+Extension.swift +19 -0
  66. package/ios/Converters/ReaderChange+Extension.swift +41 -0
  67. package/ios/Converters/ReaderConnectionFailureInfo+Extension.swift +20 -0
  68. package/ios/Converters/ReaderConnectionFailureReason+Extension.swift +40 -0
  69. package/ios/Converters/ReaderConnectionFailureRecoverySuggestion+Extension.swift +30 -0
  70. package/ios/Converters/ReaderConnectionInfo+Extension.swift +18 -0
  71. package/ios/Converters/ReaderConnectionStatus+Extension.swift +26 -0
  72. package/ios/Converters/ReaderFirmwareInfo+Extension.swift +19 -0
  73. package/ios/Converters/ReaderInfo+Extension.swift +30 -0
  74. package/ios/Converters/ReaderModel+Extension.swift +28 -0
  75. package/ios/Converters/ReaderState+Extension.swift +30 -0
  76. package/ios/Converters/ReaderStatus+Extension.swift +60 -0
  77. package/ios/Converters/ReaderStatusInfo+Extension.swift +22 -0
  78. package/ios/Converters/SDKSettings+Extension.swift +25 -0
  79. package/ios/Converters/SourceType+Extension.swift +32 -0
  80. package/ios/Converters/TrackingConsentState+Extension.swift +25 -0
  81. package/ios/ErrorUtilities.swift +41 -0
  82. package/ios/MobilePaymentAuthorization.swift +154 -0
  83. package/ios/MobilePaymentDateFormatter.swift +15 -0
  84. package/ios/MobilePaymentPayment.swift +478 -0
  85. package/ios/MobilePaymentReader.swift +248 -0
  86. package/ios/MobilePaymentSDK.swift +36 -0
  87. package/ios/MobilePaymentSetting.swift +86 -0
  88. package/ios/MockReaderUIManage.swift +52 -0
  89. package/ios/Models/NativeErrorInfo.swift +22 -0
  90. package/ios/Models/RCTPaymentMoneyParameter.swift +20 -0
  91. package/ios/Models/RCTPaymentParameters.swift +50 -0
  92. package/ios/Models/RCTPromptParameters.swift +20 -0
  93. package/ios/NotificationKeys.swift +9 -0
  94. package/ios/NotificationUtils.swift +21 -0
  95. package/ios/RCTMobilePaymentAuthorization.h +12 -0
  96. package/ios/RCTMobilePaymentAuthorization.mm +78 -0
  97. package/ios/RCTMobilePaymentPayment.h +12 -0
  98. package/ios/RCTMobilePaymentPayment.mm +116 -0
  99. package/ios/RCTMobilePaymentReader.h +12 -0
  100. package/ios/RCTMobilePaymentReader.mm +114 -0
  101. package/ios/RCTMobilePaymentSetting.h +10 -0
  102. package/ios/RCTMobilePaymentSetting.mm +94 -0
  103. package/ios/UIColor+Extension.swift +81 -0
  104. package/lib/module/authorization/NativeMobilePaymentAuthorization.js +60 -0
  105. package/lib/module/authorization/NativeMobilePaymentAuthorization.js.map +1 -0
  106. package/lib/module/authorization/index.js +44 -0
  107. package/lib/module/authorization/index.js.map +1 -0
  108. package/lib/module/index.js +7 -0
  109. package/lib/module/index.js.map +1 -0
  110. package/lib/module/package.json +1 -0
  111. package/lib/module/payment/NativeMobilePaymentPayment.js +138 -0
  112. package/lib/module/payment/NativeMobilePaymentPayment.js.map +1 -0
  113. package/lib/module/payment/index.js +113 -0
  114. package/lib/module/payment/index.js.map +1 -0
  115. package/lib/module/reader/NativeMobilePaymentReader.js +151 -0
  116. package/lib/module/reader/NativeMobilePaymentReader.js.map +1 -0
  117. package/lib/module/reader/index.js +109 -0
  118. package/lib/module/reader/index.js.map +1 -0
  119. package/lib/module/setting/NativeMobilePaymentSetting.js +5 -0
  120. package/lib/module/setting/NativeMobilePaymentSetting.js.map +1 -0
  121. package/lib/module/setting/index.js +74 -0
  122. package/lib/module/setting/index.js.map +1 -0
  123. package/lib/module/type.js +27 -0
  124. package/lib/module/type.js.map +1 -0
  125. package/lib/module/util.js +32 -0
  126. package/lib/module/util.js.map +1 -0
  127. package/lib/typescript/package.json +1 -0
  128. package/lib/typescript/src/authorization/NativeMobilePaymentAuthorization.d.ts +82 -0
  129. package/lib/typescript/src/authorization/NativeMobilePaymentAuthorization.d.ts.map +1 -0
  130. package/lib/typescript/src/authorization/index.d.ts +14 -0
  131. package/lib/typescript/src/authorization/index.d.ts.map +1 -0
  132. package/lib/typescript/src/index.d.ts +5 -0
  133. package/lib/typescript/src/index.d.ts.map +1 -0
  134. package/lib/typescript/src/payment/NativeMobilePaymentPayment.d.ts +725 -0
  135. package/lib/typescript/src/payment/NativeMobilePaymentPayment.d.ts.map +1 -0
  136. package/lib/typescript/src/payment/index.d.ts +13 -0
  137. package/lib/typescript/src/payment/index.d.ts.map +1 -0
  138. package/lib/typescript/src/reader/NativeMobilePaymentReader.d.ts +318 -0
  139. package/lib/typescript/src/reader/NativeMobilePaymentReader.d.ts.map +1 -0
  140. package/lib/typescript/src/reader/index.d.ts +19 -0
  141. package/lib/typescript/src/reader/index.d.ts.map +1 -0
  142. package/lib/typescript/src/setting/NativeMobilePaymentSetting.d.ts +49 -0
  143. package/lib/typescript/src/setting/NativeMobilePaymentSetting.d.ts.map +1 -0
  144. package/lib/typescript/src/setting/index.d.ts +17 -0
  145. package/lib/typescript/src/setting/index.d.ts.map +1 -0
  146. package/lib/typescript/src/type.d.ts +23 -0
  147. package/lib/typescript/src/type.d.ts.map +1 -0
  148. package/lib/typescript/src/util.d.ts +3 -0
  149. package/lib/typescript/src/util.d.ts.map +1 -0
  150. package/package.json +178 -0
  151. package/src/authorization/NativeMobilePaymentAuthorization.ts +297 -0
  152. package/src/authorization/index.ts +60 -0
  153. package/src/index.ts +4 -0
  154. package/src/payment/NativeMobilePaymentPayment.ts +1220 -0
  155. package/src/payment/index.ts +161 -0
  156. package/src/reader/NativeMobilePaymentReader.ts +463 -0
  157. package/src/reader/index.ts +140 -0
  158. package/src/setting/NativeMobilePaymentSetting.ts +254 -0
  159. package/src/setting/index.ts +91 -0
  160. package/src/type.ts +35 -0
  161. package/src/util.ts +31 -0
@@ -0,0 +1,725 @@
1
+ import { type CodegenTypes, type TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ startPayment(paymentParameters: PaymentParameters, promptParameters: PromptParameters): Promise<void>;
4
+ availableCardInputMethods(): CardInputMethod[];
5
+ additionalPaymentMethods(): AdditionalPaymentMethod[];
6
+ triggerPaymentWithAdditionalPaymentMethod(paymentSource: PaymentSource): Promise<void>;
7
+ currentPayment(): Payment | null;
8
+ isCurrentPaymentCancelable(): boolean;
9
+ cancelCurrentPayment(): Promise<boolean>;
10
+ readonly onAvailableCardInputMethodsChange: CodegenTypes.EventEmitter<CardInputMethod[]>;
11
+ readonly onPaymentFlowStatusChange: CodegenTypes.EventEmitter<PaymentFlowStatusChangedEvent>;
12
+ }
13
+ export declare const NativeMobilePaymentPayment: Spec;
14
+ export type MobilePaymentPayment = {
15
+ startPayment(paymentParameters: PaymentParameters, promptParameters: PromptParameters, listener?: PaymentFlowListener): Promise<PaymentHandle>;
16
+ availableCardInputMethods(): ReturnType<Spec['availableCardInputMethods']>;
17
+ };
18
+ export interface PaymentFlowListener {
19
+ /**
20
+ * only iOS
21
+ * This method is called when payment has been started and the an idempotency key has
22
+ * been generated, but no further action has been taken.
23
+ */
24
+ didStart?: (payment: Payment | null) => void;
25
+ /**
26
+ * This method is called when payment has succeeded and the payment flow has been dismissed.
27
+ * You can now start a new payment.
28
+ */
29
+ didFinish?: (payment: Payment) => void;
30
+ /**
31
+ * This method is called when a payment error occurs.
32
+ */
33
+ didFail?: (payment: Payment | null, error: any) => void;
34
+ /**
35
+ * This method is called when payment has succeeded and the payment flow is about to be dismissed.
36
+ * Use this method to prepare your UI before the payment flow is dismissed.
37
+ */
38
+ didCancel?: (payment: Payment | null) => void;
39
+ /**
40
+ * only iOS
41
+ * This method is called when payment has succeeded and the payment flow is about to be dismissed.
42
+ * Use this method to prepare your UI before the payment flow is dismissed.
43
+ */
44
+ willFinish?: (payment: Payment | null) => void;
45
+ /**
46
+ * only iOS
47
+ * This method is called when payment cancellation is about to be completed. If the payment flow
48
+ * has been presented, use this method to prepare your UI before the payment flow is dismissed.
49
+ */
50
+ willCancel?: (payment: Payment | null) => void;
51
+ }
52
+ export type PaymentHandle = {
53
+ additionalPaymentMethods(): ReturnType<Spec['additionalPaymentMethods']>;
54
+ triggerPaymentWithPaymentSource(parameters: PaymentSource): ReturnType<Spec['triggerPaymentWithAdditionalPaymentMethod']>;
55
+ payment(): ReturnType<Spec['currentPayment']>;
56
+ isPaymentCancelable(): ReturnType<Spec['isCurrentPaymentCancelable']>;
57
+ cancelPayment(): ReturnType<Spec['cancelCurrentPayment']>;
58
+ };
59
+ export type CardInputMethod = 'SWIPE' | 'CHIP' | 'CONTACTLESS';
60
+ export interface Theme {
61
+ /**
62
+ * The color of the title label. (#RRGGBB or #RRGGBBAA)
63
+ */
64
+ titleColor?: string;
65
+ /**
66
+ * The font of the title label.
67
+ */
68
+ titleFont?: Font;
69
+ /**
70
+ * The color of the subtitle label. (#RRGGBB or #RRGGBBAA)
71
+ */
72
+ subtitleColor?: string;
73
+ /**
74
+ * The font of the subtitle label.
75
+ */
76
+ subtitleFont?: Font;
77
+ /**
78
+ * The tint color currently reflected in:
79
+ * - The primary action buttons background color
80
+ * (#RRGGBB or #RRGGBBAA)
81
+ */
82
+ tintColor?: string;
83
+ /**
84
+ * Background color of the payment flow that is displayed.
85
+ * (#RRGGBB or #RRGGBBAA)
86
+ */
87
+ backgroundColor?: string;
88
+ /**
89
+ * Text color of the primary action button
90
+ * (#RRGGBB or #RRGGBBAA)
91
+ */
92
+ buttonTextColor?: string;
93
+ /**
94
+ * Font of the primary action button
95
+ */
96
+ buttonFont?: Font;
97
+ /**
98
+ * Corner radius of the primary action button.
99
+ */
100
+ buttonCornerRadius?: number;
101
+ /**
102
+ * Tint color used on informative icons
103
+ * (#RRGGBB or #RRGGBBAA)
104
+ */
105
+ informationIconColor?: string;
106
+ /**
107
+ * Tint color used on success icons
108
+ * (#RRGGBB or #RRGGBBAA)
109
+ */
110
+ successIconColor?: string;
111
+ /**
112
+ * Tint color used on error icons
113
+ * (#RRGGBB or #RRGGBBAA)
114
+ */
115
+ errorIconColor?: string;
116
+ /**
117
+ * Corner radius of the prompt that is displayed.
118
+ */
119
+ cornerRadius?: number;
120
+ /**
121
+ * Presentation style of the payment flow.
122
+ */
123
+ presentationStyle?: PresentationStyle;
124
+ /**
125
+ * Background color used on input fields
126
+ * (#RRGGBB or #RRGGBBAA)
127
+ */
128
+ inputFieldColor?: string;
129
+ /**
130
+ * Text color used on input fields
131
+ * (#RRGGBB or #RRGGBBAA)
132
+ */
133
+ inputFieldTextColor?: string;
134
+ /**
135
+ * Color used for placeholdertext on input fields
136
+ * (#RRGGBB or #RRGGBBAA)
137
+ */
138
+ inputFieldPlaceholderTextColor?: string;
139
+ /**
140
+ * Color used for errors shown for input fields
141
+ * (#RRGGBB or #RRGGBBAA)
142
+ */
143
+ inputFieldErrorColor?: string;
144
+ }
145
+ /**
146
+ * ios:UIFont
147
+ */
148
+ export interface Font {
149
+ size?: number;
150
+ fontName?: FontName;
151
+ }
152
+ export type FontName = 'Inter-Regular' | 'Inter-Medium' | 'Inter-Bold';
153
+ /**
154
+ * AUTOMATIC:
155
+ * Reader SDK will choose an appropriate presentation style based on the current environment.
156
+ * For example, on iPad the payment flow may be displayed as an overlay instead of fullscreen.
157
+ *
158
+ * ALWAYS_FULLSCREEN:
159
+ * Shows the payment flow over the entire window of the screen.
160
+ */
161
+ export type PresentationStyle = 'AUTOMATIC' | 'ALWAYS_FULLSCREEN';
162
+ export interface PaymentParameters {
163
+ /**
164
+ * allowCardSurcharge: Boolean is now a required parameter
165
+ *
166
+ * Set to false to maintain existing behavior (no surcharge)
167
+ * Set to true to enable card surcharge functionality (requires Beta opt-in and Dashboard configuration)
168
+ */
169
+ allowCardSurcharge: boolean;
170
+ /**
171
+ * A unique identifier for the payment attempt. When provided, Mobile Payments SDK generates a unique idempotency key for the payment request and stores it with the payment attempt ID.
172
+ */
173
+ paymentAttemptId: string;
174
+ /**
175
+ * If set to true and charging a Square Gift Card,
176
+ * a payment may be returned with amountMoney equal to less than what was requested.
177
+ * Example, a request for $20 when charging a Square Gift Card with balance of $5 will result in an APPROVED payment of $5.
178
+ * You may choose to prompt the buyer for an additional payment to cover the remainder, or cancel the gift card payment.
179
+ * Cannot be true when autocomplete = true.
180
+ * If this parameter is passed as true but the buyer selected a payment method for which partial authorization does not apply eg: cash then this parameter is ignored.
181
+ * For more information, see Partial amount with Square gift cards. Defaults to false
182
+ */
183
+ acceptPartialAuthorization?: boolean;
184
+ /**
185
+ * If set to true, this payment will be completed when possible.
186
+ * If set to false, this payment will be held in an approved state until either explicitly completed (captured) or canceled (voided).
187
+ * For more information, see (https://developer.squareup.com/docs/payments-api/take-payments#delayed-payments)
188
+ */
189
+ autocomplete?: boolean;
190
+ /**
191
+ * Actions possible when an authorized payment is neither canceled nor completed in time.
192
+ */
193
+ delayAction?: DelayAction;
194
+ /**
195
+ * iOS:
196
+ * The action to apply to the payment when the <code>delayDuration</code> has elapsed. Defaults to <code>cancel</code>.
197
+ * note:
198
+ * Setting this to <code>complete</code> while the <code>orderID</code> parameter is set will fail validation.
199
+ * To learn more about this behavior, see the <a href="https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold">Delayed Capture: Time threshold</a> section.
200
+ * NSTimeInterval delayDuration
201
+ *
202
+ * android:
203
+ * Sets the duration between payment creation and automatic cancellation, for payments with autocomplete equal to false.
204
+ */
205
+ delayDuration?: number;
206
+ /**
207
+ * The amount of money to accept for this payment, not including [tipMoney]
208
+ */
209
+ amountMoney: Money;
210
+ /**
211
+ * The amount designated as a tip, in addition to [amountMoney]
212
+ */
213
+ tipMoney?: Money;
214
+ /**
215
+ * The amount of money the developer is taking as a fee for facilitating the payment on behalf of the seller.
216
+ * Cannot be more than 90% of the total amount of the Payment.
217
+ */
218
+ appFeeMoney?: Money;
219
+ /**
220
+ * The location ID to associate with the payment. If not specified, the default location is used.
221
+ */
222
+ locationID?: string;
223
+ /**
224
+ * Associate a previously created order with this payment.
225
+ */
226
+ orderID?: string;
227
+ /**
228
+ * A user-defined ID to associate with the payment.
229
+ * You can use this field to associate the payment to an entity in an external system.
230
+ * For example, you might specify an order ID that is generated by a third-party shopping cart
231
+ */
232
+ referenceID?: string;
233
+ /**
234
+ * The ID of the customer associated with the payment.
235
+ * This value is required when using a customer’s card on file to create a payment.
236
+ */
237
+ customerID?: string;
238
+ /**
239
+ * EMPLOYEES_READ permission.
240
+ * An optional ID of the team member associated with taking the payment.
241
+ */
242
+ teamMemberID?: string;
243
+ /**
244
+ * An optional note to be entered by the developer when creating a payment.
245
+ */
246
+ note?: string;
247
+ /**
248
+ * Optional additional payment information to include on the customer’s card statement as part of statement description.
249
+ */
250
+ statementDescriptionIdentifier?: string;
251
+ /**
252
+ * only iOS
253
+ * Optional card handle that references a stored swiped card.
254
+ * When a valid swiped card is set, the stored card will be used as the payment method, and payment selection will be skipped.
255
+ */
256
+ /**
257
+ * PaymentParameters "processingMode" parameter will determine whether the current payment needs to be processed online or offline.
258
+ */
259
+ processingMode: ProcessingMode;
260
+ }
261
+ export interface PromptParameters {
262
+ mode: PromptMode;
263
+ additionalMethods?: 'ALL' | 'KEYED';
264
+ }
265
+ export type PromptMode = 'DEFAULT' | 'CUSTOM';
266
+ export interface Payment {
267
+ /**
268
+ * iOS:
269
+ * The server-side ID for this payment.
270
+ *
271
+ * android:
272
+ * Offline: Unique ID for this payment, assigned by Square.
273
+ * Value stays null until payment is uploaded and gets a server-side ID.
274
+ * Online:
275
+ * Unique ID for this payment, assigned by Square.
276
+ */
277
+ id?: string | null;
278
+ /**
279
+ * date of when the payment was created.(iso8601)
280
+ */
281
+ createdAt: string;
282
+ /**
283
+ * date of when the payment was created.(iso8601)
284
+ */
285
+ updatedAt: string;
286
+ /**
287
+ * Indicates the current payment status.
288
+ */
289
+ status?: PaymentStatus;
290
+ /**
291
+ * The amount of money to accept for this payment, not including [tipMoney]
292
+ */
293
+ amountMoney: Money;
294
+ /**
295
+ * The amount designated as a tip, in addition to [amountMoney]
296
+ */
297
+ tipMoney?: Money;
298
+ /**
299
+ * The amount of money the developer is taking as a fee for facilitating the payment on behalf of the seller.
300
+ */
301
+ appFeeMoney?: Money;
302
+ /**
303
+ * The total money for the payment, including amountMoney and tipMoney.
304
+ */
305
+ totalMoney?: Money;
306
+ /**
307
+ * The location ID to associate with the payment. If not specified, the default location is used.
308
+ */
309
+ locationID?: string;
310
+ /**
311
+ * Associate a previously created order with this payment.
312
+ */
313
+ orderID?: string;
314
+ /**
315
+ * A user-defined ID to associate with the payment.
316
+ * You can use this field to associate the payment to an entity in an external system.
317
+ * For example, you might specify an order ID that is generated by a third-party shopping cart
318
+ */
319
+ referenceID?: string;
320
+ /**
321
+ * The ID of the customer associated with the payment.
322
+ * Required if the sourceID refers to a card on file created using the Customers API.
323
+ *
324
+ * android only Online
325
+ */
326
+ customerID?: string;
327
+ /**
328
+ * An optional note to be entered by the developer when creating a payment.
329
+ *
330
+ * android only Online
331
+ */
332
+ note?: string;
333
+ /**
334
+ * only android Online
335
+ */
336
+ statementDescription?: string;
337
+ /**
338
+ * only android Online
339
+ */
340
+ teamMemberId?: string;
341
+ /**
342
+ * Non-confidential details about the source.
343
+ */
344
+ cardDetails?: CardDetails;
345
+ /**
346
+ * only android
347
+ */
348
+ cashDetails?: CashPaymentDetails;
349
+ /**
350
+ * only android
351
+ */
352
+ externalDetails?: ExternalPaymentDetails;
353
+ processingType?: ProcessingType;
354
+ /**
355
+ * Timestamp of when the payment was uploaded for processing. (iso8601)
356
+ */
357
+ uploadedAt?: string | null;
358
+ /**
359
+ * processingType = OFFLINE
360
+ * Unique ID for this payment, generated when device is offline.
361
+ * Can be used to identify this Payment until it is uploaded to server
362
+ * and id becomes available.
363
+ */
364
+ localId?: string;
365
+ /**
366
+ * processingType = OFFLINE
367
+ * Indicates the [OfflineStatus] of the payment.
368
+ */
369
+ offlineStatus?: OfflineStatus;
370
+ /**
371
+ * only android
372
+ * processingType = ONLINE
373
+ * Processing fees and fee adjustments assessed by Square on this payment.
374
+ */
375
+ processingFee?: PaymentProcessingFee[];
376
+ sourceType?: PaymentSourceType;
377
+ /**
378
+ * only android
379
+ * processingType = ONLINE
380
+ */
381
+ capabilities?: PaymentCapabilities[];
382
+ /**
383
+ * only android
384
+ * processingType = ONLINE
385
+ */
386
+ receiptNumber?: string;
387
+ /**
388
+ * only android
389
+ * processingType = ONLINE
390
+ * Remaining balance on an account.
391
+ */
392
+ remainingBalance?: Money;
393
+ /**
394
+ * only android
395
+ * Details about a Square Account payment. The details are only populated
396
+ * if the [sourceType] is [SourceType.SQUARE_ACCOUNT].
397
+ */
398
+ squareAccountDetails?: SquareAccountDetails | null;
399
+ /**
400
+ * only android
401
+ */
402
+ digitalWalletDetails?: DigitalWalletDetails | null;
403
+ }
404
+ export interface Money {
405
+ /**
406
+ * The amount of money in the smallest denomination of the currency.
407
+ * For example, when currency is .usd, the amount is in cents.
408
+ */
409
+ amount: number;
410
+ /**
411
+ * The currency code.
412
+ */
413
+ currency: Currency;
414
+ }
415
+ export type Currency = 'AUD' | 'CAD' | 'EUR' | 'GBP' | 'JPY' | 'USD' | 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYR' | 'BZD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'FJD' | 'FKP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LTL' | 'LVL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRO' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STD' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USN' | 'USS' | 'UYI' | 'UYU' | 'UZS' | 'VEF' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XTS' | 'XXX' | 'YER' | 'ZAR' | 'ZMK' | 'ZMW' | 'BTC' | 'XUS' | 'SLE' | 'UNKNOWN';
416
+ export interface AdditionalPaymentMethod {
417
+ /**
418
+ * The type of the payment that is being presented
419
+ */
420
+ type: AdditionalPaymentMethodType;
421
+ /**
422
+ * Localized string value of the payment type that is consumer friendly
423
+ */
424
+ name: string;
425
+ }
426
+ export type DelayAction = 'CANCEL' | 'COMPLETE';
427
+ export type ProcessingMode = 'ONLINE_ONLY' | 'OFFLINE_ONLY' | 'AUTO_DETECT';
428
+ export type ProcessingType = 'ONLINE' | 'OFFLINE';
429
+ export type OfflineStatus = 'UNKNOWN' | 'QUEUED' | 'UPLOADED' | 'FAILED_TO_UPLOAD' | 'FAILED_TO_PROCESS' | 'PROCESSED';
430
+ export interface BasePaymentSource {
431
+ type: AdditionalPaymentMethodType;
432
+ }
433
+ export interface CardOnFilePaymentSource extends BasePaymentSource {
434
+ type: 'CARD_ON_FILE';
435
+ cardID: string;
436
+ customerID: string;
437
+ }
438
+ export interface HouseAccountPaymentSourceAndroid extends BasePaymentSource {
439
+ type: 'HOUSE_ACCOUNT';
440
+ paymentSourceToken: string;
441
+ customerId: string;
442
+ }
443
+ export interface HouseAccountPaymentSourceIOS extends BasePaymentSource {
444
+ type: 'HOUSE_ACCOUNT';
445
+ houseAccountPaymentSourceId: string;
446
+ }
447
+ export type HouseAccountPaymentSource = HouseAccountPaymentSourceAndroid | HouseAccountPaymentSourceIOS;
448
+ export interface CashPaymentSource extends BasePaymentSource {
449
+ type: 'CASH';
450
+ buyerSuppliedMoney?: Money;
451
+ }
452
+ export type SimplePaymentSource = {
453
+ type: Exclude<AdditionalPaymentMethodType, 'CARD_ON_FILE' | 'HOUSE_ACCOUNT' | 'CASH' | 'EXTERNAL'>;
454
+ };
455
+ export type ExternalTenderType = 'CHECK' | 'BANK_TRANSFER' | 'OTHER_GIFT_CARD' | 'CRYPTO' | 'SQUARE_CASH' | 'SOCIAL' | 'EXTERNAL' | 'EMONEY' | 'CARD' | 'STORED_BALANCE' | 'FOOD_VOUCHER' | 'OTHER';
456
+ export type PaymentSource = CardOnFilePaymentSource | HouseAccountPaymentSource | CashPaymentSource | SimplePaymentSource;
457
+ export type AdditionalPaymentMethodType = 'KEYED' | 'CARD_ON_FILE' | 'HOUSE_ACCOUNT' | 'TAP_TO_PAY' | 'CASH' | 'UNKNOWN';
458
+ export type PaymentStatus = 'UNKNOWN' | 'PENDING' | 'INITIALIZED' | 'APPROVED' | 'COMPLETED' | 'CANCELED' | 'FAILED';
459
+ export type PaymentSourceType = 'CARD' | 'CASH' | 'EXTERNAL' | 'WALLET' | 'BANK_ACCOUNT' | 'CARD_ON_FILE' | 'SQUARE_ACCOUNT' | 'UNKNOWN';
460
+ export type PaymentCapabilities = 'EDIT_TIP_AMOUNT_UP' | 'EDIT_TIP_AMOUNT_DOWN' | 'EDIT_AMOUNT_UP' | 'EDIT_AMOUNT_DOWN';
461
+ export interface PaymentProcessingFee {
462
+ /**
463
+ * date of the effectiveness.
464
+ */
465
+ effectiveAt: string;
466
+ /**
467
+ * type of the fee defined by Type
468
+ */
469
+ type: PaymentProcessingFeeType;
470
+ /**
471
+ * amount of the fee in for of Money
472
+ */
473
+ amountMoney: Money;
474
+ }
475
+ export type PaymentProcessingFeeType = 'INITIAL' | 'ADJUSTMENT';
476
+ export interface CashPaymentDetails {
477
+ /**
478
+ * The amount and currency of the money supplied by the buyer.
479
+ */
480
+ buyerSuppliedMoney: Money;
481
+ /**
482
+ * The amount of change due back from the buyer.
483
+ */
484
+ changeBackMoney: Money;
485
+ }
486
+ export interface ExternalPaymentDetails {
487
+ /**
488
+ * The type of external payment the seller received. See ExternalTenderType.
489
+ */
490
+ type: string;
491
+ /**
492
+ * A description of the external payment source. For example, "Food Delivery Service"
493
+ */
494
+ source: string;
495
+ /**
496
+ * An ID provided by the developer to associate the payment to its originating source.
497
+ */
498
+ sourceId?: string | null;
499
+ /**
500
+ * The fees paid to the source. The amountMoney minus this field is the net amount seller receives.
501
+ */
502
+ sourceFeeMoney?: Money | null;
503
+ }
504
+ export interface CardDetails {
505
+ /**
506
+ * The status of the card payment.
507
+ */
508
+ status?: CardStatus;
509
+ /** Provides information about the card used for payment. */
510
+ card?: Card;
511
+ /** Indicate how the card information was captured. */
512
+ entryMethod?: EntryMethod;
513
+ /**
514
+ * For EMV payments, identifies the EMV application used for the payment.
515
+ */
516
+ applicationIdentifier?: string;
517
+ /**
518
+ * For EMV payments, the human-readable name of the EMV application used for the payment.
519
+ */
520
+ applicationName?: string;
521
+ /**
522
+ * only android
523
+ * EMV application transaction counter maintained by the application in the ICC.
524
+ */
525
+ applicationCounter?: string;
526
+ /**
527
+ * only android
528
+ * EMV tag 5F34, returned by the issuer to identify and differentiate cards with the same PAN.
529
+ */
530
+ panSequenceNumber?: string;
531
+ /**
532
+ * only android
533
+ * For EMV payments, the method used to verify the cardholder's identity.
534
+ */
535
+ verificationMethod?: EMVVerificationMethod;
536
+ /**
537
+ * only android
538
+ * For EMV payments, the results of the cardholder verification.
539
+ */
540
+ verificationResults?: EMVVerificationResult;
541
+ /**
542
+ * only android
543
+ * The type of account selected by the buyer using an EMV debit card.
544
+ */
545
+ accountType?: EMVAccountType;
546
+ /**
547
+ * only android
548
+ * The amount of money remaining on the card after this payment. Populated only for certain card types, when required for display on receipts.
549
+ */
550
+ remainingBalanceAmountMoney?: Money;
551
+ /**
552
+ * only android
553
+ * Felica SPRWID returned by TMN for Felica(e-money) TRANSPORTATION(Suica) transactions only.
554
+ */
555
+ felicaSprwdId?: Money;
556
+ /**
557
+ * Status code returned by the card issuer that describes the payment’s authorization status.
558
+ */
559
+ authResultCode?: string;
560
+ isOfflineCard?: boolean;
561
+ }
562
+ type CardStatus = 'UNKNOWN' | 'AUTHORIZED' | 'CAPTURED' | 'VOIDED' | 'FAILED';
563
+ export type EntryMethod = 'SWIPED' | 'KEYED' | 'EMV' | 'ON_FILE' | 'CONTACTLESS' | 'UNKNOWN';
564
+ export interface Card {
565
+ /**
566
+ * Unique ID for this card. Generated by Square.
567
+ */
568
+ id?: string;
569
+ /**
570
+ * The card’s brand (such as VISA).
571
+ */
572
+ cardBrand: CardBrand;
573
+ /**
574
+ * The card’s CoBrand (such as Afterpay).
575
+ */
576
+ coBrand?: CardCoBrand;
577
+ /**
578
+ * The last 4 digits of the card number.
579
+ */
580
+ last4?: string;
581
+ /**
582
+ * The expiration month of the associated card as an integer between 1 and 12.
583
+ */
584
+ expMonth?: number;
585
+ /**
586
+ * The four-digit year of the card’s expiration date.
587
+ */
588
+ expYear?: number;
589
+ /**
590
+ * The name of the cardholder.
591
+ */
592
+ cardholderName?: string;
593
+ /**
594
+ * only android
595
+ * The first six digits of the card number.
596
+ */
597
+ bin?: string;
598
+ }
599
+ export type CardBrand = 'UNKNOWN' | 'VISA' | 'MASTERCARD' | 'AMERICAN_EXPRESS' | 'DISCOVER' | 'DISCOVER_DINERS' | 'JCB' | 'CHINA_UNION_PAY' | 'SQUARE_GIFT_CARD' | 'SQUARE_CAPITAL_CARD' | 'INTERAC' | 'EFTPOS' | 'FELICA' | 'EBT' | 'ALIPAY' | 'CASH_APP' | 'SUICA' | 'ID' | 'QUICPAY' | 'OTHER_BRAND';
600
+ export type CardCoBrand = 'UNKNOWN' | 'AFTERPAY' | 'CLEARPAY' | 'NONE';
601
+ export type EMVAccountType = 'SAVINGS' | 'CHECKING' | 'CREDIT';
602
+ export type EMVVerificationMethod = 'PIN' | 'SIGNATURE' | 'PIN_AND_SIGNATURE' | 'ON_DEVICE' | 'NONE';
603
+ export type EMVVerificationResult = 'SUCCESS' | 'FAILURE' | 'UNKNOWN';
604
+ export interface SquareAccountDetails {
605
+ /**
606
+ * Unique identifier for the payment source used for this payment.
607
+ */
608
+ paymentSourceToken: string;
609
+ errors?: ErrorDetails[] | null;
610
+ }
611
+ export interface DigitalWalletDetails {
612
+ walletBrand?: WalletBrand | null;
613
+ buyerId?: string | null;
614
+ }
615
+ export type WalletBrand = 'CashApp' | 'PayPay' | 'Alipay' | 'AuPay' | 'DBarai' | 'MerPay' | 'RakutenPay' | 'WechatPay' | 'Unknown';
616
+ /**
617
+ * Detailed errors to explain a failure.
618
+ * Typically these are returned from Square's Connect v2 REST APIs,
619
+ * and are documented here[https://developer.squareup.com/reference/square/objects/Error].
620
+ * However, there may be conditions where an error is generated by the SDK itself,
621
+ * for example to explain errors that prevented server or cardreader communication.
622
+ */
623
+ export interface ErrorDetails {
624
+ /**
625
+ * The high-level category of the error.
626
+ */
627
+ category: string;
628
+ /**
629
+ * The specific code of the error.
630
+ */
631
+ code: string;
632
+ /**
633
+ * A human-readable description of the error for debugging purposes. This will be localized to the device locale.
634
+ */
635
+ detail: string;
636
+ /**
637
+ * The name of the field provided in the original request, if any, that the error pertains to.
638
+ */
639
+ field?: string | null;
640
+ }
641
+ export interface PaymentFlowStatusChangedEvent {
642
+ name: 'didStart' | 'didFinish' | 'didFail' | 'didCancel' | 'willFinish' | 'willCancel';
643
+ payment?: Payment | null;
644
+ error?: {
645
+ message: string;
646
+ };
647
+ }
648
+ /**
649
+ * Reader SDK could not connect to the network.
650
+ */
651
+ export declare const PaymentErrorNoNetwork = "PAYMENT_ERROR_NO_NETWORK";
652
+ /**
653
+ * Reader SDK is not currently authorized with a Square Seller account.
654
+ */
655
+ export declare const PaymentErrorNotAuthorized = "PAYMENT_ERROR_NOT_AUTHORIZED";
656
+ /**
657
+ * Invalid payment parameters were provided.
658
+ */
659
+ export declare const PaymentErrorInvalidPaymentParameters = "PaymentErrorInvalidPaymentParameters";
660
+ /**
661
+ * The payment timed out.
662
+ */
663
+ export declare const PaymentErrorTimedOut = "PAYMENT_ERROR_TIMED_OUT";
664
+ /**
665
+ * Location permission is needed.
666
+ */
667
+ export declare const PaymentErrorLocationPermissionNeeded = "PAYMENT_ERROR_LOCATION_PERMISSION_NEEDED";
668
+ /**
669
+ * Payment is already in progress.
670
+ */
671
+ export declare const PaymentErrorPaymentAlreadyInProgress = "PAYMENT_ERROR_PAYMENT_ALREADY_IN_PROGRESS";
672
+ /**
673
+ * Idempotency key already in use.
674
+ */
675
+ export declare const PaymentErrorIdempotencyKeyReused = "PAYMENT_ERROR_IDEMPOTENCY_KEY_REUSED";
676
+ /**
677
+ * Invalid Payment Source Provided
678
+ */
679
+ export declare const PaymentErrorInvalidPaymentSource = "PAYMENT_ERROR_INVALID_PAYMENT_SOURCE";
680
+ /**
681
+ * Error that is thrown if a merchant is not opted into offline processing
682
+ */
683
+ export declare const PaymentErrorMerchantNotOptedIntoOfflineProcessing = "PAYMENT_ERROR_MERCHANT_NOT_OPTED_INTO_OFFLINE_PROCESSING";
684
+ /**
685
+ * Error thrown when payment amount is too big and exceeds limit for offline processing
686
+ */
687
+ export declare const PaymentErrorOfflineTransactionAmountExceeded = "PAYMENT_ERROR_OFFLINE_TRANSACTION_AMOUNT_EXCEEDED";
688
+ /**
689
+ * The total stored in the database if this payment is taken offline will exceed the total allowed in offline mode.
690
+ */
691
+ export declare const PaymentErrorOfflineStoredAmountExceeded = "PAYMENT_ERROR_OFFLINE_STORED_AMOUNT_EXCEEDED";
692
+ /**
693
+ * Offline processing is unsupported in sandbox environment
694
+ */
695
+ export declare const PaymentErrorSandboxUnsupportedForOfflineProcessing = "PAYMENT_ERROR_SANDBOX_UNSUPPORTED_FOR_OFFLINE_PROCESSING";
696
+ /**
697
+ * Unexpected Error Returned
698
+ */
699
+ export declare const PaymentErrorUnexpected = "PAYMENT_ERROR_UNEXPECTED";
700
+ /**
701
+ * The device clock is skewed and not matching the server time.
702
+ */
703
+ export declare const PaymentDeviceClockSkewed = "PAYMENT_DEVICE_CLOCK_SKEWED";
704
+ /**
705
+ * Unsupported mode for taking a payment; for example, multitasking mode is not allowed on iPad
706
+ */
707
+ export declare const PaymentErrorUnsupportedMode = "PAYMENT_ERROR_UNSUPPORTED_MODE";
708
+ /**
709
+ * Merchant is in a market that requires consent for analytics and consent has not been provided
710
+ */
711
+ export declare const PaymentConsentNotProvided = "PAYMENT_CONSENT_NOT_PROVIDED";
712
+ /**
713
+ * Consent is required for tracking purposes and the tracking consent selection is pending and waiting on user.
714
+ */
715
+ export declare const PaymentTrackingConsentIsPending = "PAYMENT_TRACKING_CONSENT_IS_PENDING";
716
+ /**
717
+ * Your application provided idempotencyKey in a market where Square will create and manage idempotency keys. Please use paymentAttemptId instead.
718
+ */
719
+ export declare const PaymentAttemptIdRequiredForSca = "PAYMENT_ATTEMPT_ID_REQUIRED_FOR_SCA";
720
+ /**
721
+ * The payment attempt id used for this payment has already been used. Review previous payments to ensure you are not processing a duplicate payment, and then try again with a new payment attempt id.
722
+ */
723
+ export declare const PaymentAttemptIdReused = "PAYMENT_ATTEMPT_ID_REUSED";
724
+ export {};
725
+ //# sourceMappingURL=NativeMobilePaymentPayment.d.ts.map