@capawesome/capacitor-square-mobile-payments 0.0.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 (82) hide show
  1. package/CapawesomeCapacitorSquareMobilePayments.podspec +17 -0
  2. package/Package.swift +30 -0
  3. package/README.md +1183 -0
  4. package/android/build.gradle +63 -0
  5. package/android/src/main/AndroidManifest.xml +7 -0
  6. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/SquareMobilePayments.java +774 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/SquareMobilePaymentsPlugin.java +460 -0
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/CustomException.java +20 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/CustomExceptions.java +41 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/AvailableCardInputMethodsDidChangeEvent.java +27 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/PaymentDidCancelEvent.java +24 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/PaymentDidFailEvent.java +34 -0
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/PaymentDidFinishEvent.java +22 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderDidChangeEvent.java +27 -0
  15. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderPairingDidFailEvent.java +28 -0
  16. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderWasAddedEvent.java +22 -0
  17. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderWasRemovedEvent.java +22 -0
  18. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/AuthorizeOptions.java +29 -0
  19. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/ForgetReaderOptions.java +29 -0
  20. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/InitializeOptions.java +29 -0
  21. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/Money.java +29 -0
  22. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/PaymentParameters.java +126 -0
  23. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/PromptParameters.java +47 -0
  24. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/RetryConnectionOptions.java +29 -0
  25. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/StartPaymentOptions.java +39 -0
  26. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/Card.java +51 -0
  27. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/CardPaymentDetails.java +30 -0
  28. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/GetAvailableCardInputMethodsResult.java +29 -0
  29. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/GetReadersResult.java +29 -0
  30. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/GetSettingsResult.java +28 -0
  31. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/IsAuthorizedResult.java +22 -0
  32. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/IsPairingInProgressResult.java +22 -0
  33. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/MoneyResult.java +27 -0
  34. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/Payment.java +87 -0
  35. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/ReaderInfo.java +82 -0
  36. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/UnavailableReasonInfo.java +30 -0
  37. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/Callback.java +5 -0
  38. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/EmptyCallback.java +5 -0
  39. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/NonEmptyCallback.java +7 -0
  40. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/NonEmptyResultCallback.java +7 -0
  41. package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/Result.java +7 -0
  42. package/android/src/main/res/.gitkeep +0 -0
  43. package/dist/docs.json +2999 -0
  44. package/dist/esm/definitions.d.ts +1468 -0
  45. package/dist/esm/definitions.js +519 -0
  46. package/dist/esm/definitions.js.map +1 -0
  47. package/dist/esm/index.d.ts +4 -0
  48. package/dist/esm/index.js +7 -0
  49. package/dist/esm/index.js.map +1 -0
  50. package/dist/esm/web.d.ts +21 -0
  51. package/dist/esm/web.js +55 -0
  52. package/dist/esm/web.js.map +1 -0
  53. package/dist/plugin.cjs.js +588 -0
  54. package/dist/plugin.cjs.js.map +1 -0
  55. package/dist/plugin.js +591 -0
  56. package/dist/plugin.js.map +1 -0
  57. package/ios/Plugin/Classes/Options/AuthorizeOptions.swift +17 -0
  58. package/ios/Plugin/Classes/Options/ForgetReaderOptions.swift +17 -0
  59. package/ios/Plugin/Classes/Options/InitializeOptions.swift +17 -0
  60. package/ios/Plugin/Classes/Options/Money.swift +12 -0
  61. package/ios/Plugin/Classes/Options/PaymentParameters.swift +49 -0
  62. package/ios/Plugin/Classes/Options/PromptParameters.swift +17 -0
  63. package/ios/Plugin/Classes/Options/RetryConnectionOptions.swift +17 -0
  64. package/ios/Plugin/Classes/Options/StartPaymentOptions.swift +19 -0
  65. package/ios/Plugin/Classes/Results/Card.swift +34 -0
  66. package/ios/Plugin/Classes/Results/CardPaymentDetails.swift +34 -0
  67. package/ios/Plugin/Classes/Results/GetAvailableCardInputMethodsResult.swift +16 -0
  68. package/ios/Plugin/Classes/Results/GetReadersResult.swift +16 -0
  69. package/ios/Plugin/Classes/Results/GetSettingsResult.swift +19 -0
  70. package/ios/Plugin/Classes/Results/IsAuthorizedResult.swift +16 -0
  71. package/ios/Plugin/Classes/Results/IsPairingInProgressResult.swift +16 -0
  72. package/ios/Plugin/Classes/Results/MoneyResult.swift +19 -0
  73. package/ios/Plugin/Classes/Results/Payment.swift +58 -0
  74. package/ios/Plugin/Classes/Results/ReaderInfo.swift +46 -0
  75. package/ios/Plugin/Classes/Results/UnavailableReasonInfo.swift +19 -0
  76. package/ios/Plugin/Enums/CustomError.swift +81 -0
  77. package/ios/Plugin/Info.plist +24 -0
  78. package/ios/Plugin/Protocols/Result.swift +6 -0
  79. package/ios/Plugin/SquareMobilePayments.swift +632 -0
  80. package/ios/Plugin/SquareMobilePaymentsHelper.swift +212 -0
  81. package/ios/Plugin/SquareMobilePaymentsPlugin.swift +347 -0
  82. package/package.json +93 -0
package/README.md ADDED
@@ -0,0 +1,1183 @@
1
+ # @capawesome/capacitor-square-mobile-payments
2
+
3
+ Unofficial Capacitor plugin for [Square Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk).[^1]
4
+
5
+ ## Features
6
+
7
+ This plugin provides a comprehensive integration with Square's Mobile Payments SDK for in-person payment processing. Here are some of the key features:
8
+
9
+ - 🖥️ **Cross-platform**: Supports Android and iOS.
10
+ - 💳 **Payment Processing**: Accept in-person payments with Square card readers.
11
+ - 📱 **Reader Management**: Pair, manage, and monitor Square card readers.
12
+ - 🔐 **Secure Authorization**: OAuth-based authorization with Square access tokens.
13
+ - 🎨 **Flexible UI**: Choose between Square's default payment UI or build your own custom interface.
14
+ - 📊 **Real-time Updates**: Listen to reader status changes, pairing events, and payment completion.
15
+ - 💰 **Multiple Payment Methods**: Support for contactless (tap), chip (dip), swipe, and manual entry.
16
+ - 🌐 **Online & Offline**: Process payments online or offline with automatic sync.
17
+ - 🧾 **Receipt Data**: Access card details, authorization codes, and EMV data for compliant receipts.
18
+ - 🔁 **Up-to-date**: Always supports the latest Capacitor version.
19
+
20
+ Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install @capawesome/capacitor-square-mobile-payments
26
+ npx cap sync
27
+ ```
28
+
29
+ ### Android
30
+
31
+ #### Variables
32
+
33
+ If needed, you can define the following project variable in your app's `variables.gradle` file to change the default version of the dependency:
34
+
35
+ - `$squareMobilePaymentsSdkVersion` version of `com.squareup.sdk:mobile-payments-sdk` (default: `2.3.4`)
36
+
37
+ This can be useful if you encounter dependency conflicts with other plugins in your project.
38
+
39
+ ### iOS
40
+
41
+ #### Privacy Descriptions
42
+
43
+ Add the `NSLocationWhenInUseUsageDescription` and `NSBluetoothAlwaysUsageDescription` keys to the `ios/App/App/Info.plist` file, which tells the user why your app is requesting location and Bluetooth permissions:
44
+
45
+ ```xml
46
+ <key>NSBluetoothAlwaysUsageDescription</key>
47
+ <string>We need Bluetooth access to connect to Square card readers.</string>
48
+ <key>NSLocationWhenInUseUsageDescription</key>
49
+ <string>We need your location to confirm payments are occurring in a supported Square location.</string>
50
+ ```
51
+
52
+ ## Usage
53
+
54
+ ```typescript
55
+ import { SquareMobilePayments, CardInputMethod } from '@capawesome/capacitor-square-mobile-payments';
56
+
57
+ const initializeSDK = async () => {
58
+ await SquareMobilePayments.initialize({
59
+ locationId: 'YOUR_LOCATION_ID',
60
+ });
61
+
62
+ await SquareMobilePayments.authorize({
63
+ accessToken: 'YOUR_ACCESS_TOKEN',
64
+ });
65
+ };
66
+
67
+ const checkAuthorization = async () => {
68
+ const { authorized } = await SquareMobilePayments.isAuthorized();
69
+ console.log('Authorized:', authorized);
70
+ };
71
+
72
+ const pairReader = async () => {
73
+ await SquareMobilePayments.startPairing();
74
+ };
75
+
76
+ const getReaders = async () => {
77
+ const { readers } = await SquareMobilePayments.getReaders();
78
+ for (const reader of readers) {
79
+ console.log('Reader:', reader.serialNumber, reader.model, reader.status);
80
+ }
81
+ };
82
+
83
+ const processPayment = async () => {
84
+ await SquareMobilePayments.startPayment({
85
+ paymentParameters: {
86
+ amountMoney: {
87
+ amount: 100,
88
+ currency: 'USD',
89
+ },
90
+ paymentAttemptId: crypto.randomUUID(),
91
+ },
92
+ promptParameters: {
93
+ mode: 'DEFAULT',
94
+ additionalMethods: ['KEYED'],
95
+ },
96
+ });
97
+ };
98
+
99
+ const listenToPaymentEvents = () => {
100
+ SquareMobilePayments.addListener('paymentDidFinish', (event) => {
101
+ console.log('Payment completed:', event.payment.id);
102
+ console.log('Amount:', event.payment.amountMoney.amount);
103
+ console.log('Card:', event.payment.cardDetails?.card.lastFourDigits);
104
+ });
105
+
106
+ SquareMobilePayments.addListener('paymentDidFail', (event) => {
107
+ console.error('Payment failed:', event.message);
108
+ });
109
+
110
+ SquareMobilePayments.addListener('paymentDidCancel', (event) => {
111
+ console.log('Payment cancelled');
112
+ });
113
+ };
114
+
115
+ const listenToReaderEvents = () => {
116
+ SquareMobilePayments.addListener('readerWasAdded', (event) => {
117
+ console.log('Reader added:', event.reader.serialNumber);
118
+ });
119
+
120
+ SquareMobilePayments.addListener('readerDidChange', (event) => {
121
+ console.log('Reader changed:', event.reader.serialNumber, event.change);
122
+ });
123
+
124
+ SquareMobilePayments.addListener('availableCardInputMethodsDidChange', (event) => {
125
+ console.log('Available methods:', event.cardInputMethods);
126
+ });
127
+ };
128
+
129
+ const getAvailableMethods = async () => {
130
+ const { cardInputMethods } = await SquareMobilePayments.getAvailableCardInputMethods();
131
+ console.log('Available card input methods:', cardInputMethods);
132
+ };
133
+ ```
134
+
135
+ ## API
136
+
137
+ <docgen-index>
138
+
139
+ * [`initialize(...)`](#initialize)
140
+ * [`authorize(...)`](#authorize)
141
+ * [`isAuthorized()`](#isauthorized)
142
+ * [`deauthorize()`](#deauthorize)
143
+ * [`showSettings()`](#showsettings)
144
+ * [`getSettings()`](#getsettings)
145
+ * [`startPairing()`](#startpairing)
146
+ * [`stopPairing()`](#stoppairing)
147
+ * [`isPairingInProgress()`](#ispairinginprogress)
148
+ * [`getReaders()`](#getreaders)
149
+ * [`forgetReader(...)`](#forgetreader)
150
+ * [`retryConnection(...)`](#retryconnection)
151
+ * [`startPayment(...)`](#startpayment)
152
+ * [`cancelPayment()`](#cancelpayment)
153
+ * [`getAvailableCardInputMethods()`](#getavailablecardinputmethods)
154
+ * [`checkPermissions()`](#checkpermissions)
155
+ * [`requestPermissions()`](#requestpermissions)
156
+ * [`addListener('readerPairingDidBegin', ...)`](#addlistenerreaderpairingdidbegin-)
157
+ * [`addListener('readerPairingDidSucceed', ...)`](#addlistenerreaderpairingdidsucceed-)
158
+ * [`addListener('readerPairingDidFail', ...)`](#addlistenerreaderpairingdidfail-)
159
+ * [`addListener('readerWasAdded', ...)`](#addlistenerreaderwasadded-)
160
+ * [`addListener('readerWasRemoved', ...)`](#addlistenerreaderwasremoved-)
161
+ * [`addListener('readerDidChange', ...)`](#addlistenerreaderdidchange-)
162
+ * [`addListener('availableCardInputMethodsDidChange', ...)`](#addlisteneravailablecardinputmethodsdidchange-)
163
+ * [`addListener('paymentDidFinish', ...)`](#addlistenerpaymentdidfinish-)
164
+ * [`addListener('paymentDidFail', ...)`](#addlistenerpaymentdidfail-)
165
+ * [`addListener('paymentDidCancel', ...)`](#addlistenerpaymentdidcancel-)
166
+ * [`removeAllListeners()`](#removealllisteners)
167
+ * [Interfaces](#interfaces)
168
+ * [Type Aliases](#type-aliases)
169
+ * [Enums](#enums)
170
+
171
+ </docgen-index>
172
+
173
+ <docgen-api>
174
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
175
+
176
+ ### initialize(...)
177
+
178
+ ```typescript
179
+ initialize(options: InitializeOptions) => Promise<void>
180
+ ```
181
+
182
+ Initialize the Square Mobile Payments SDK.
183
+
184
+ This method must be called before any other method.
185
+
186
+ Only available on Android and iOS.
187
+
188
+ | Param | Type |
189
+ | ------------- | --------------------------------------------------------------- |
190
+ | **`options`** | <code><a href="#initializeoptions">InitializeOptions</a></code> |
191
+
192
+ **Since:** 0.0.1
193
+
194
+ --------------------
195
+
196
+
197
+ ### authorize(...)
198
+
199
+ ```typescript
200
+ authorize(options: AuthorizeOptions) => Promise<void>
201
+ ```
202
+
203
+ Authorize the SDK with a Square access token.
204
+
205
+ Only available on Android and iOS.
206
+
207
+ | Param | Type |
208
+ | ------------- | ------------------------------------------------------------- |
209
+ | **`options`** | <code><a href="#authorizeoptions">AuthorizeOptions</a></code> |
210
+
211
+ **Since:** 0.0.1
212
+
213
+ --------------------
214
+
215
+
216
+ ### isAuthorized()
217
+
218
+ ```typescript
219
+ isAuthorized() => Promise<IsAuthorizedResult>
220
+ ```
221
+
222
+ Check if the SDK is currently authorized.
223
+
224
+ Only available on Android and iOS.
225
+
226
+ **Returns:** <code>Promise&lt;<a href="#isauthorizedresult">IsAuthorizedResult</a>&gt;</code>
227
+
228
+ **Since:** 0.0.1
229
+
230
+ --------------------
231
+
232
+
233
+ ### deauthorize()
234
+
235
+ ```typescript
236
+ deauthorize() => Promise<void>
237
+ ```
238
+
239
+ Deauthorize the SDK and clear the current authorization.
240
+
241
+ Only available on Android and iOS.
242
+
243
+ **Since:** 0.0.1
244
+
245
+ --------------------
246
+
247
+
248
+ ### showSettings()
249
+
250
+ ```typescript
251
+ showSettings() => Promise<void>
252
+ ```
253
+
254
+ Show the Square settings screen.
255
+
256
+ This displays a pre-built settings UI where merchants can view and manage
257
+ their paired readers.
258
+
259
+ Only available on Android and iOS.
260
+
261
+ **Since:** 0.0.1
262
+
263
+ --------------------
264
+
265
+
266
+ ### getSettings()
267
+
268
+ ```typescript
269
+ getSettings() => Promise<GetSettingsResult>
270
+ ```
271
+
272
+ Get the current SDK settings.
273
+
274
+ Only available on Android and iOS.
275
+
276
+ **Returns:** <code>Promise&lt;<a href="#getsettingsresult">GetSettingsResult</a>&gt;</code>
277
+
278
+ **Since:** 0.0.1
279
+
280
+ --------------------
281
+
282
+
283
+ ### startPairing()
284
+
285
+ ```typescript
286
+ startPairing() => Promise<void>
287
+ ```
288
+
289
+ Start pairing with a Square reader.
290
+
291
+ This initiates the reader pairing process. The SDK will search for nearby
292
+ readers and pair with the first one found.
293
+
294
+ Only available on Android and iOS.
295
+
296
+ **Since:** 0.0.1
297
+
298
+ --------------------
299
+
300
+
301
+ ### stopPairing()
302
+
303
+ ```typescript
304
+ stopPairing() => Promise<void>
305
+ ```
306
+
307
+ Stop the reader pairing process.
308
+
309
+ Only available on Android and iOS.
310
+
311
+ **Since:** 0.0.1
312
+
313
+ --------------------
314
+
315
+
316
+ ### isPairingInProgress()
317
+
318
+ ```typescript
319
+ isPairingInProgress() => Promise<IsPairingInProgressResult>
320
+ ```
321
+
322
+ Check if a pairing process is currently in progress.
323
+
324
+ Only available on Android and iOS.
325
+
326
+ **Returns:** <code>Promise&lt;<a href="#ispairinginprogressresult">IsPairingInProgressResult</a>&gt;</code>
327
+
328
+ **Since:** 0.0.1
329
+
330
+ --------------------
331
+
332
+
333
+ ### getReaders()
334
+
335
+ ```typescript
336
+ getReaders() => Promise<GetReadersResult>
337
+ ```
338
+
339
+ Get a list of all paired readers.
340
+
341
+ Only available on Android and iOS.
342
+
343
+ **Returns:** <code>Promise&lt;<a href="#getreadersresult">GetReadersResult</a>&gt;</code>
344
+
345
+ **Since:** 0.0.1
346
+
347
+ --------------------
348
+
349
+
350
+ ### forgetReader(...)
351
+
352
+ ```typescript
353
+ forgetReader(options: ForgetReaderOptions) => Promise<void>
354
+ ```
355
+
356
+ Forget a paired reader.
357
+
358
+ Only available on Android and iOS.
359
+
360
+ | Param | Type |
361
+ | ------------- | ------------------------------------------------------------------- |
362
+ | **`options`** | <code><a href="#forgetreaderoptions">ForgetReaderOptions</a></code> |
363
+
364
+ **Since:** 0.0.1
365
+
366
+ --------------------
367
+
368
+
369
+ ### retryConnection(...)
370
+
371
+ ```typescript
372
+ retryConnection(options: RetryConnectionOptions) => Promise<void>
373
+ ```
374
+
375
+ Retry connecting to a reader.
376
+
377
+ Only available on Android and iOS.
378
+
379
+ | Param | Type |
380
+ | ------------- | ------------------------------------------------------------------------- |
381
+ | **`options`** | <code><a href="#retryconnectionoptions">RetryConnectionOptions</a></code> |
382
+
383
+ **Since:** 0.0.1
384
+
385
+ --------------------
386
+
387
+
388
+ ### startPayment(...)
389
+
390
+ ```typescript
391
+ startPayment(options: StartPaymentOptions) => Promise<void>
392
+ ```
393
+
394
+ Start a payment flow.
395
+
396
+ This presents the payment UI and processes the payment using the specified
397
+ parameters. Only one payment can be active at a time.
398
+
399
+ Only available on Android and iOS.
400
+
401
+ | Param | Type |
402
+ | ------------- | ------------------------------------------------------------------- |
403
+ | **`options`** | <code><a href="#startpaymentoptions">StartPaymentOptions</a></code> |
404
+
405
+ **Since:** 0.0.1
406
+
407
+ --------------------
408
+
409
+
410
+ ### cancelPayment()
411
+
412
+ ```typescript
413
+ cancelPayment() => Promise<void>
414
+ ```
415
+
416
+ Cancel an ongoing payment.
417
+
418
+ Only available on Android and iOS.
419
+
420
+ **Since:** 0.0.1
421
+
422
+ --------------------
423
+
424
+
425
+ ### getAvailableCardInputMethods()
426
+
427
+ ```typescript
428
+ getAvailableCardInputMethods() => Promise<GetAvailableCardInputMethodsResult>
429
+ ```
430
+
431
+ Get the currently available card input methods.
432
+
433
+ This returns the card entry methods that are available based on the
434
+ connected readers (e.g., TAP, DIP, SWIPE, KEYED).
435
+
436
+ Only available on Android and iOS.
437
+
438
+ **Returns:** <code>Promise&lt;<a href="#getavailablecardinputmethodsresult">GetAvailableCardInputMethodsResult</a>&gt;</code>
439
+
440
+ **Since:** 0.0.1
441
+
442
+ --------------------
443
+
444
+
445
+ ### checkPermissions()
446
+
447
+ ```typescript
448
+ checkPermissions() => Promise<PermissionStatus>
449
+ ```
450
+
451
+ Check the current permission status.
452
+
453
+ Only available on Android and iOS.
454
+
455
+ **Returns:** <code>Promise&lt;<a href="#permissionstatus">PermissionStatus</a>&gt;</code>
456
+
457
+ **Since:** 0.0.1
458
+
459
+ --------------------
460
+
461
+
462
+ ### requestPermissions()
463
+
464
+ ```typescript
465
+ requestPermissions() => Promise<PermissionStatus>
466
+ ```
467
+
468
+ Request the required permissions.
469
+
470
+ Only available on Android and iOS.
471
+
472
+ **Returns:** <code>Promise&lt;<a href="#permissionstatus">PermissionStatus</a>&gt;</code>
473
+
474
+ **Since:** 0.0.1
475
+
476
+ --------------------
477
+
478
+
479
+ ### addListener('readerPairingDidBegin', ...)
480
+
481
+ ```typescript
482
+ addListener(eventName: 'readerPairingDidBegin', listenerFunc: ReaderPairingDidBeginListener) => Promise<PluginListenerHandle>
483
+ ```
484
+
485
+ Listen for reader pairing events.
486
+
487
+ Only available on Android and iOS.
488
+
489
+ | Param | Type |
490
+ | ------------------ | --------------------------------------------------------------------------------------- |
491
+ | **`eventName`** | <code>'readerPairingDidBegin'</code> |
492
+ | **`listenerFunc`** | <code><a href="#readerpairingdidbeginlistener">ReaderPairingDidBeginListener</a></code> |
493
+
494
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
495
+
496
+ **Since:** 0.0.1
497
+
498
+ --------------------
499
+
500
+
501
+ ### addListener('readerPairingDidSucceed', ...)
502
+
503
+ ```typescript
504
+ addListener(eventName: 'readerPairingDidSucceed', listenerFunc: ReaderPairingDidSucceedListener) => Promise<PluginListenerHandle>
505
+ ```
506
+
507
+ Listen for successful reader pairing events.
508
+
509
+ Only available on Android and iOS.
510
+
511
+ | Param | Type |
512
+ | ------------------ | ------------------------------------------------------------------------------------------- |
513
+ | **`eventName`** | <code>'readerPairingDidSucceed'</code> |
514
+ | **`listenerFunc`** | <code><a href="#readerpairingdidsucceedlistener">ReaderPairingDidSucceedListener</a></code> |
515
+
516
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
517
+
518
+ **Since:** 0.0.1
519
+
520
+ --------------------
521
+
522
+
523
+ ### addListener('readerPairingDidFail', ...)
524
+
525
+ ```typescript
526
+ addListener(eventName: 'readerPairingDidFail', listenerFunc: ReaderPairingDidFailListener) => Promise<PluginListenerHandle>
527
+ ```
528
+
529
+ Listen for failed reader pairing events.
530
+
531
+ Only available on Android and iOS.
532
+
533
+ | Param | Type |
534
+ | ------------------ | ------------------------------------------------------------------------------------- |
535
+ | **`eventName`** | <code>'readerPairingDidFail'</code> |
536
+ | **`listenerFunc`** | <code><a href="#readerpairingdidfaillistener">ReaderPairingDidFailListener</a></code> |
537
+
538
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
539
+
540
+ **Since:** 0.0.1
541
+
542
+ --------------------
543
+
544
+
545
+ ### addListener('readerWasAdded', ...)
546
+
547
+ ```typescript
548
+ addListener(eventName: 'readerWasAdded', listenerFunc: ReaderWasAddedListener) => Promise<PluginListenerHandle>
549
+ ```
550
+
551
+ Listen for reader added events.
552
+
553
+ Only available on Android and iOS.
554
+
555
+ | Param | Type |
556
+ | ------------------ | ------------------------------------------------------------------------- |
557
+ | **`eventName`** | <code>'readerWasAdded'</code> |
558
+ | **`listenerFunc`** | <code><a href="#readerwasaddedlistener">ReaderWasAddedListener</a></code> |
559
+
560
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
561
+
562
+ **Since:** 0.0.1
563
+
564
+ --------------------
565
+
566
+
567
+ ### addListener('readerWasRemoved', ...)
568
+
569
+ ```typescript
570
+ addListener(eventName: 'readerWasRemoved', listenerFunc: ReaderWasRemovedListener) => Promise<PluginListenerHandle>
571
+ ```
572
+
573
+ Listen for reader removed events.
574
+
575
+ Only available on Android and iOS.
576
+
577
+ | Param | Type |
578
+ | ------------------ | ----------------------------------------------------------------------------- |
579
+ | **`eventName`** | <code>'readerWasRemoved'</code> |
580
+ | **`listenerFunc`** | <code><a href="#readerwasremovedlistener">ReaderWasRemovedListener</a></code> |
581
+
582
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
583
+
584
+ **Since:** 0.0.1
585
+
586
+ --------------------
587
+
588
+
589
+ ### addListener('readerDidChange', ...)
590
+
591
+ ```typescript
592
+ addListener(eventName: 'readerDidChange', listenerFunc: ReaderDidChangeListener) => Promise<PluginListenerHandle>
593
+ ```
594
+
595
+ Listen for reader status and property changes.
596
+
597
+ Only available on Android and iOS.
598
+
599
+ | Param | Type |
600
+ | ------------------ | --------------------------------------------------------------------------- |
601
+ | **`eventName`** | <code>'readerDidChange'</code> |
602
+ | **`listenerFunc`** | <code><a href="#readerdidchangelistener">ReaderDidChangeListener</a></code> |
603
+
604
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
605
+
606
+ **Since:** 0.0.1
607
+
608
+ --------------------
609
+
610
+
611
+ ### addListener('availableCardInputMethodsDidChange', ...)
612
+
613
+ ```typescript
614
+ addListener(eventName: 'availableCardInputMethodsDidChange', listenerFunc: AvailableCardInputMethodsDidChangeListener) => Promise<PluginListenerHandle>
615
+ ```
616
+
617
+ Listen for available card input method changes.
618
+
619
+ Only available on Android and iOS.
620
+
621
+ | Param | Type |
622
+ | ------------------ | ----------------------------------------------------------------------------------------------------------------- |
623
+ | **`eventName`** | <code>'availableCardInputMethodsDidChange'</code> |
624
+ | **`listenerFunc`** | <code><a href="#availablecardinputmethodsdidchangelistener">AvailableCardInputMethodsDidChangeListener</a></code> |
625
+
626
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
627
+
628
+ **Since:** 0.0.1
629
+
630
+ --------------------
631
+
632
+
633
+ ### addListener('paymentDidFinish', ...)
634
+
635
+ ```typescript
636
+ addListener(eventName: 'paymentDidFinish', listenerFunc: PaymentDidFinishListener) => Promise<PluginListenerHandle>
637
+ ```
638
+
639
+ Listen for successful payment completion events.
640
+
641
+ Only available on Android and iOS.
642
+
643
+ | Param | Type |
644
+ | ------------------ | ----------------------------------------------------------------------------- |
645
+ | **`eventName`** | <code>'paymentDidFinish'</code> |
646
+ | **`listenerFunc`** | <code><a href="#paymentdidfinishlistener">PaymentDidFinishListener</a></code> |
647
+
648
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
649
+
650
+ **Since:** 0.0.1
651
+
652
+ --------------------
653
+
654
+
655
+ ### addListener('paymentDidFail', ...)
656
+
657
+ ```typescript
658
+ addListener(eventName: 'paymentDidFail', listenerFunc: PaymentDidFailListener) => Promise<PluginListenerHandle>
659
+ ```
660
+
661
+ Listen for failed payment events.
662
+
663
+ Only available on Android and iOS.
664
+
665
+ | Param | Type |
666
+ | ------------------ | ------------------------------------------------------------------------- |
667
+ | **`eventName`** | <code>'paymentDidFail'</code> |
668
+ | **`listenerFunc`** | <code><a href="#paymentdidfaillistener">PaymentDidFailListener</a></code> |
669
+
670
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
671
+
672
+ **Since:** 0.0.1
673
+
674
+ --------------------
675
+
676
+
677
+ ### addListener('paymentDidCancel', ...)
678
+
679
+ ```typescript
680
+ addListener(eventName: 'paymentDidCancel', listenerFunc: PaymentDidCancelListener) => Promise<PluginListenerHandle>
681
+ ```
682
+
683
+ Listen for cancelled payment events.
684
+
685
+ Only available on Android and iOS.
686
+
687
+ | Param | Type |
688
+ | ------------------ | ----------------------------------------------------------------------------- |
689
+ | **`eventName`** | <code>'paymentDidCancel'</code> |
690
+ | **`listenerFunc`** | <code><a href="#paymentdidcancellistener">PaymentDidCancelListener</a></code> |
691
+
692
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt;</code>
693
+
694
+ **Since:** 0.0.1
695
+
696
+ --------------------
697
+
698
+
699
+ ### removeAllListeners()
700
+
701
+ ```typescript
702
+ removeAllListeners() => Promise<void>
703
+ ```
704
+
705
+ Remove all listeners for this plugin.
706
+
707
+ Only available on Android and iOS.
708
+
709
+ **Since:** 0.0.1
710
+
711
+ --------------------
712
+
713
+
714
+ ### Interfaces
715
+
716
+
717
+ #### InitializeOptions
718
+
719
+ | Prop | Type | Description | Since |
720
+ | ---------------- | ------------------- | ----------------------- | ----- |
721
+ | **`locationId`** | <code>string</code> | The Square location ID. | 0.0.1 |
722
+
723
+
724
+ #### AuthorizeOptions
725
+
726
+ | Prop | Type | Description | Since |
727
+ | ----------------- | ------------------- | ------------------------ | ----- |
728
+ | **`accessToken`** | <code>string</code> | The Square access token. | 0.0.1 |
729
+
730
+
731
+ #### IsAuthorizedResult
732
+
733
+ | Prop | Type | Description | Since |
734
+ | ---------------- | -------------------- | ---------------------------------------- | ----- |
735
+ | **`authorized`** | <code>boolean</code> | Whether the SDK is currently authorized. | 0.0.1 |
736
+
737
+
738
+ #### GetSettingsResult
739
+
740
+ | Prop | Type | Description | Since |
741
+ | ----------------- | --------------------------------------------------- | ------------------------ | ----- |
742
+ | **`version`** | <code>string</code> | The SDK version. | 0.0.1 |
743
+ | **`environment`** | <code><a href="#environment">Environment</a></code> | The current environment. | 0.0.1 |
744
+
745
+
746
+ #### IsPairingInProgressResult
747
+
748
+ | Prop | Type | Description | Since |
749
+ | ---------------- | -------------------- | --------------------------------------------------- | ----- |
750
+ | **`inProgress`** | <code>boolean</code> | Whether a pairing process is currently in progress. | 0.0.1 |
751
+
752
+
753
+ #### GetReadersResult
754
+
755
+ | Prop | Type | Description | Since |
756
+ | ------------- | ------------------------- | --------------------------- | ----- |
757
+ | **`readers`** | <code>ReaderInfo[]</code> | The list of paired readers. | 0.0.1 |
758
+
759
+
760
+ #### ReaderInfo
761
+
762
+ | Prop | Type | Description | Since |
763
+ | ------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ----- |
764
+ | **`serialNumber`** | <code>string</code> | The reader's serial number. | 0.0.1 |
765
+ | **`model`** | <code><a href="#readermodel">ReaderModel</a></code> | The reader's model. | 0.0.1 |
766
+ | **`status`** | <code><a href="#readerstatus">ReaderStatus</a></code> | The reader's current status. | 0.0.1 |
767
+ | **`firmwareVersion`** | <code>string</code> | The reader's firmware version. | 0.0.1 |
768
+ | **`batteryLevel`** | <code>number</code> | The reader's battery level (0-100). | 0.0.1 |
769
+ | **`isCharging`** | <code>boolean</code> | Whether the reader is currently charging. | 0.0.1 |
770
+ | **`supportedCardInputMethods`** | <code>CardInputMethod[]</code> | The card input methods supported by this reader. | 0.0.1 |
771
+ | **`unavailableReasonInfo`** | <code><a href="#unavailablereasoninfo">UnavailableReasonInfo</a></code> | Additional information about why the reader is unavailable. Only present when status is ReaderUnavailable. | 0.0.1 |
772
+
773
+
774
+ #### UnavailableReasonInfo
775
+
776
+ | Prop | Type | Description | Since |
777
+ | ------------- | --------------------------------------------------------------- | ------------------------------------------------------------------ | ----- |
778
+ | **`reason`** | <code><a href="#unavailablereason">UnavailableReason</a></code> | The reason code why the reader is unavailable. | 0.0.1 |
779
+ | **`message`** | <code>string</code> | A human-readable message describing why the reader is unavailable. | 0.0.1 |
780
+
781
+
782
+ #### ForgetReaderOptions
783
+
784
+ | Prop | Type | Description | Since |
785
+ | ------------------ | ------------------- | ------------------------------------------ | ----- |
786
+ | **`serialNumber`** | <code>string</code> | The serial number of the reader to forget. | 0.0.1 |
787
+
788
+
789
+ #### RetryConnectionOptions
790
+
791
+ | Prop | Type | Description | Since |
792
+ | ------------------ | ------------------- | ---------------------------------------------------- | ----- |
793
+ | **`serialNumber`** | <code>string</code> | The serial number of the reader to retry connection. | 0.0.1 |
794
+
795
+
796
+ #### StartPaymentOptions
797
+
798
+ | Prop | Type | Description | Since |
799
+ | ----------------------- | --------------------------------------------------------------- | ----------------------- | ----- |
800
+ | **`paymentParameters`** | <code><a href="#paymentparameters">PaymentParameters</a></code> | The payment parameters. | 0.0.1 |
801
+ | **`promptParameters`** | <code><a href="#promptparameters">PromptParameters</a></code> | The prompt parameters. | 0.0.1 |
802
+
803
+
804
+ #### PaymentParameters
805
+
806
+ | Prop | Type | Description | Default | Since |
807
+ | ---------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ----- |
808
+ | **`amountMoney`** | <code><a href="#money">Money</a></code> | The amount of money to charge. | | 0.0.1 |
809
+ | **`paymentAttemptId`** | <code>string</code> | A unique identifier for this payment attempt. This is used for idempotent payment requests. | | 0.0.1 |
810
+ | **`processingMode`** | <code><a href="#processingmode">ProcessingMode</a></code> | The processing mode for this payment. | <code>ProcessingMode.AutoDetect</code> | 0.0.1 |
811
+ | **`referenceId`** | <code>string</code> | A user-defined reference ID to associate with the payment. | | 0.0.1 |
812
+ | **`note`** | <code>string</code> | An optional note to add to the payment. | | 0.0.1 |
813
+ | **`orderId`** | <code>string</code> | The Square order ID to associate with this payment. | | 0.0.1 |
814
+ | **`tipMoney`** | <code><a href="#money">Money</a></code> | The tip amount. | | 0.0.1 |
815
+ | **`applicationFee`** | <code><a href="#money">Money</a></code> | The application fee. | | 0.0.1 |
816
+ | **`autocomplete`** | <code>boolean</code> | Whether to automatically complete the payment. If false, the payment will be authorized but not captured, requiring manual completion via the Payments API. | <code>true</code> | 0.0.1 |
817
+ | **`delayDuration`** | <code>string</code> | The duration to delay before automatically completing or canceling the payment. Only applicable when autocomplete is false. | | 0.0.1 |
818
+ | **`delayAction`** | <code><a href="#delayaction">DelayAction</a></code> | The action to take when the delay duration expires. Only applicable when autocomplete is false. | | 0.0.1 |
819
+
820
+
821
+ #### Money
822
+
823
+ | Prop | Type | Description | Since |
824
+ | -------------- | ----------------------------------------------------- | --------------------------------------------------------------- | ----- |
825
+ | **`amount`** | <code>number</code> | The amount in the smallest currency unit (e.g., cents for USD). | 0.0.1 |
826
+ | **`currency`** | <code><a href="#currencycode">CurrencyCode</a></code> | The ISO 4217 currency code. | 0.0.1 |
827
+
828
+
829
+ #### PromptParameters
830
+
831
+ | Prop | Type | Description | Default | Since |
832
+ | ----------------------- | ------------------------------------------------- | ------------------------------------ | ------------------------------- | ----- |
833
+ | **`mode`** | <code><a href="#promptmode">PromptMode</a></code> | The prompt mode. | <code>PromptMode.Default</code> | 0.0.1 |
834
+ | **`additionalMethods`** | <code>AdditionalPaymentMethod[]</code> | Additional payment methods to allow. | <code>[]</code> | 0.0.1 |
835
+
836
+
837
+ #### GetAvailableCardInputMethodsResult
838
+
839
+ | Prop | Type | Description | Since |
840
+ | ---------------------- | ------------------------------ | --------------------------------- | ----- |
841
+ | **`cardInputMethods`** | <code>CardInputMethod[]</code> | The available card input methods. | 0.0.1 |
842
+
843
+
844
+ #### PermissionStatus
845
+
846
+ | Prop | Type | Description | Since |
847
+ | ---------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
848
+ | **`location`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state for accessing location. Required to confirm that payments are occurring in a supported Square location. | 0.0.1 |
849
+ | **`recordAudio`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state for recording audio. Required to receive data from magstripe readers. Only available on Android. | 0.0.1 |
850
+ | **`bluetoothConnect`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state for Bluetooth connect. Required to receive data from contactless and chip readers. Only available on Android. | 0.0.1 |
851
+ | **`bluetoothScan`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state for Bluetooth scan. Required to store information during checkout. Only available on Android. | 0.0.1 |
852
+ | **`readPhoneState`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state for reading phone state. Required to identify the device sending information to Square servers. Only available on Android. | 0.0.1 |
853
+ | **`bluetooth`** | <code><a href="#permissionstate">PermissionState</a></code> | Permission state for using Bluetooth. Only available on iOS. | 0.0.1 |
854
+
855
+
856
+ #### PluginListenerHandle
857
+
858
+ | Prop | Type |
859
+ | ------------ | ----------------------------------------- |
860
+ | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
861
+
862
+
863
+ #### ReaderPairingDidFailEvent
864
+
865
+ | Prop | Type | Description | Since |
866
+ | ------------- | ------------------- | ------------------ | ----- |
867
+ | **`code`** | <code>string</code> | The error code. | 0.0.1 |
868
+ | **`message`** | <code>string</code> | The error message. | 0.0.1 |
869
+
870
+
871
+ #### ReaderWasAddedEvent
872
+
873
+ | Prop | Type | Description | Since |
874
+ | ------------ | ------------------------------------------------- | -------------------------- | ----- |
875
+ | **`reader`** | <code><a href="#readerinfo">ReaderInfo</a></code> | The reader that was added. | 0.0.1 |
876
+
877
+
878
+ #### ReaderWasRemovedEvent
879
+
880
+ | Prop | Type | Description | Since |
881
+ | ------------ | ------------------------------------------------- | ---------------------------- | ----- |
882
+ | **`reader`** | <code><a href="#readerinfo">ReaderInfo</a></code> | The reader that was removed. | 0.0.1 |
883
+
884
+
885
+ #### ReaderDidChangeEvent
886
+
887
+ | Prop | Type | Description | Since |
888
+ | ------------ | ----------------------------------------------------- | --------------------------------- | ----- |
889
+ | **`reader`** | <code><a href="#readerinfo">ReaderInfo</a></code> | The reader that changed. | 0.0.1 |
890
+ | **`change`** | <code><a href="#readerchange">ReaderChange</a></code> | The type of change that occurred. | 0.0.1 |
891
+
892
+
893
+ #### AvailableCardInputMethodsDidChangeEvent
894
+
895
+ | Prop | Type | Description | Since |
896
+ | ---------------------- | ------------------------------ | --------------------------------- | ----- |
897
+ | **`cardInputMethods`** | <code>CardInputMethod[]</code> | The available card input methods. | 0.0.1 |
898
+
899
+
900
+ #### PaymentDidFinishEvent
901
+
902
+ | Prop | Type | Description | Since |
903
+ | ------------- | ------------------------------------------- | ---------------------- | ----- |
904
+ | **`payment`** | <code><a href="#payment">Payment</a></code> | The completed payment. | 0.0.1 |
905
+
906
+
907
+ #### Payment
908
+
909
+ | Prop | Type | Description | Since |
910
+ | -------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ----- |
911
+ | **`id`** | <code>string \| null</code> | The unique identifier for this payment. For offline payments, this may be null until synced. | 0.0.1 |
912
+ | **`type`** | <code><a href="#paymenttype">PaymentType</a></code> | The payment type. | 0.0.1 |
913
+ | **`status`** | <code><a href="#paymentstatus">PaymentStatus</a></code> | The payment status. | 0.0.1 |
914
+ | **`amountMoney`** | <code><a href="#money">Money</a></code> | The amount paid. | 0.0.1 |
915
+ | **`tipMoney`** | <code><a href="#money">Money</a></code> | The tip amount. | 0.0.1 |
916
+ | **`applicationFee`** | <code><a href="#money">Money</a></code> | The application fee. | 0.0.1 |
917
+ | **`referenceId`** | <code>string</code> | The reference ID provided in the payment parameters. | 0.0.1 |
918
+ | **`orderId`** | <code>string</code> | The order ID associated with this payment. | 0.0.1 |
919
+ | **`cardDetails`** | <code><a href="#cardpaymentdetails">CardPaymentDetails</a></code> | <a href="#card">Card</a> payment details. Only present for card payments. | 0.0.1 |
920
+ | **`createdAt`** | <code>string</code> | The time the payment was created (ISO 8601 format). | 0.0.1 |
921
+ | **`updatedAt`** | <code>string</code> | The time the payment was updated (ISO 8601 format). | 0.0.1 |
922
+
923
+
924
+ #### CardPaymentDetails
925
+
926
+ | Prop | Type | Description | Since |
927
+ | ----------------------- | ----------------------------------------------------------- | ------------------------------- | ----- |
928
+ | **`card`** | <code><a href="#card">Card</a></code> | The card information. | 0.0.1 |
929
+ | **`entryMethod`** | <code><a href="#cardinputmethod">CardInputMethod</a></code> | The card entry method used. | 0.0.1 |
930
+ | **`authorizationCode`** | <code>string</code> | The authorization code. | 0.0.1 |
931
+ | **`applicationName`** | <code>string</code> | The EMV application name. | 0.0.1 |
932
+ | **`applicationId`** | <code>string</code> | The EMV application identifier. | 0.0.1 |
933
+
934
+
935
+ #### Card
936
+
937
+ | Prop | Type | Description | Since |
938
+ | --------------------- | ----------------------------------------------- | ---------------------------------------- | ----- |
939
+ | **`brand`** | <code><a href="#cardbrand">CardBrand</a></code> | The card brand. | 0.0.1 |
940
+ | **`lastFourDigits`** | <code>string</code> | The last four digits of the card number. | 0.0.1 |
941
+ | **`cardholderName`** | <code>string</code> | The cardholder name. | 0.0.1 |
942
+ | **`expirationMonth`** | <code>number</code> | The card expiration month (1-12). | 0.0.1 |
943
+ | **`expirationYear`** | <code>number</code> | The card expiration year. | 0.0.1 |
944
+
945
+
946
+ #### PaymentDidFailEvent
947
+
948
+ | Prop | Type | Description | Since |
949
+ | ------------- | ------------------------------------------- | ------------------- | ----- |
950
+ | **`payment`** | <code><a href="#payment">Payment</a></code> | The failed payment. | 0.0.1 |
951
+ | **`code`** | <code>string</code> | The error code. | 0.0.1 |
952
+ | **`message`** | <code>string</code> | The error message. | 0.0.1 |
953
+
954
+
955
+ #### PaymentDidCancelEvent
956
+
957
+ | Prop | Type | Description | Since |
958
+ | ------------- | ------------------------------------------- | ---------------------- | ----- |
959
+ | **`payment`** | <code><a href="#payment">Payment</a></code> | The cancelled payment. | 0.0.1 |
960
+
961
+
962
+ ### Type Aliases
963
+
964
+
965
+ #### CurrencyCode
966
+
967
+ <code>string</code>
968
+
969
+
970
+ #### PermissionState
971
+
972
+ <code>'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'</code>
973
+
974
+
975
+ #### ReaderPairingDidBeginListener
976
+
977
+ Callback to receive reader pairing start notifications.
978
+
979
+ <code>(): void</code>
980
+
981
+
982
+ #### ReaderPairingDidSucceedListener
983
+
984
+ Callback to receive reader pairing success notifications.
985
+
986
+ <code>(): void</code>
987
+
988
+
989
+ #### ReaderPairingDidFailListener
990
+
991
+ Callback to receive reader pairing failure notifications.
992
+
993
+ <code>(event: <a href="#readerpairingdidfailevent">ReaderPairingDidFailEvent</a>): void</code>
994
+
995
+
996
+ #### ReaderWasAddedListener
997
+
998
+ Callback to receive reader added notifications.
999
+
1000
+ <code>(event: <a href="#readerwasaddedevent">ReaderWasAddedEvent</a>): void</code>
1001
+
1002
+
1003
+ #### ReaderWasRemovedListener
1004
+
1005
+ Callback to receive reader removed notifications.
1006
+
1007
+ <code>(event: <a href="#readerwasremovedevent">ReaderWasRemovedEvent</a>): void</code>
1008
+
1009
+
1010
+ #### ReaderDidChangeListener
1011
+
1012
+ Callback to receive reader change notifications.
1013
+
1014
+ <code>(event: <a href="#readerdidchangeevent">ReaderDidChangeEvent</a>): void</code>
1015
+
1016
+
1017
+ #### AvailableCardInputMethodsDidChangeListener
1018
+
1019
+ Callback to receive available card input method change notifications.
1020
+
1021
+ <code>(event: <a href="#availablecardinputmethodsdidchangeevent">AvailableCardInputMethodsDidChangeEvent</a>): void</code>
1022
+
1023
+
1024
+ #### PaymentDidFinishListener
1025
+
1026
+ Callback to receive payment completion notifications.
1027
+
1028
+ <code>(event: <a href="#paymentdidfinishevent">PaymentDidFinishEvent</a>): void</code>
1029
+
1030
+
1031
+ #### PaymentDidFailListener
1032
+
1033
+ Callback to receive payment failure notifications.
1034
+
1035
+ <code>(event: <a href="#paymentdidfailevent">PaymentDidFailEvent</a>): void</code>
1036
+
1037
+
1038
+ #### PaymentDidCancelListener
1039
+
1040
+ Callback to receive payment cancellation notifications.
1041
+
1042
+ <code>(event: <a href="#paymentdidcancelevent">PaymentDidCancelEvent</a>): void</code>
1043
+
1044
+
1045
+ ### Enums
1046
+
1047
+
1048
+ #### Environment
1049
+
1050
+ | Members | Value | Description | Since |
1051
+ | ---------------- | ------------------------- | -------------------------------- | ----- |
1052
+ | **`Production`** | <code>'production'</code> | Production environment. | 0.0.1 |
1053
+ | **`Sandbox`** | <code>'sandbox'</code> | Sandbox environment for testing. | 0.0.1 |
1054
+
1055
+
1056
+ #### ReaderModel
1057
+
1058
+ | Members | Value | Description | Since |
1059
+ | ------------------------ | ----------------------------------- | --------------------------------------- | ----- |
1060
+ | **`ContactlessAndChip`** | <code>'CONTACTLESS_AND_CHIP'</code> | Square Reader for contactless and chip. | 0.0.1 |
1061
+ | **`Magstripe`** | <code>'MAGSTRIPE'</code> | Square Reader for magstripe. | 0.0.1 |
1062
+ | **`Stand`** | <code>'STAND'</code> | Square Stand. | 0.0.1 |
1063
+ | **`Unknown`** | <code>'UNKNOWN'</code> | Unknown reader model. | 0.0.1 |
1064
+
1065
+
1066
+ #### ReaderStatus
1067
+
1068
+ | Members | Value | Description | Since |
1069
+ | ------------------------ | ----------------------------------- | -------------------------------------------------------------------- | ----- |
1070
+ | **`Ready`** | <code>'READY'</code> | Reader is paired, connected, and ready to accept payments. | 0.0.1 |
1071
+ | **`ConnectingToSquare`** | <code>'CONNECTING_TO_SQUARE'</code> | Reader is connecting to Square servers. | 0.0.1 |
1072
+ | **`ConnectingToDevice`** | <code>'CONNECTING_TO_DEVICE'</code> | Reader is connecting to the mobile device. | 0.0.1 |
1073
+ | **`Faulty`** | <code>'FAULTY'</code> | Reader has a hardware or connection error in an unrecoverable state. | 0.0.1 |
1074
+ | **`ReaderUnavailable`** | <code>'READER_UNAVAILABLE'</code> | Reader is connected but unable to process payments. | 0.0.1 |
1075
+
1076
+
1077
+ #### CardInputMethod
1078
+
1079
+ | Members | Value | Description | Since |
1080
+ | ----------- | -------------------- | --------------------------- | ----- |
1081
+ | **`Tap`** | <code>'TAP'</code> | Contactless card tap (NFC). | 0.0.1 |
1082
+ | **`Dip`** | <code>'DIP'</code> | EMV chip card insertion. | 0.0.1 |
1083
+ | **`Swipe`** | <code>'SWIPE'</code> | Magnetic stripe swipe. | 0.0.1 |
1084
+ | **`Keyed`** | <code>'KEYED'</code> | Manually keyed card entry. | 0.0.1 |
1085
+
1086
+
1087
+ #### UnavailableReason
1088
+
1089
+ | Members | Value | Description | Since |
1090
+ | ------------------------------ | ----------------------------------------- | --------------------------------------------------------- | ----- |
1091
+ | **`BluetoothError`** | <code>'BLUETOOTH_ERROR'</code> | Bluetooth connection issue. Only available on iOS. | 0.0.1 |
1092
+ | **`BluetoothFailure`** | <code>'BLUETOOTH_FAILURE'</code> | Bluetooth failure. Only available on Android. | 0.0.1 |
1093
+ | **`BluetoothDisabled`** | <code>'BLUETOOTH_DISABLED'</code> | Bluetooth is disabled. Only available on Android. | 0.0.1 |
1094
+ | **`FirmwareUpdate`** | <code>'FIRMWARE_UPDATE'</code> | Reader firmware is updating. Only available on iOS. | 0.0.1 |
1095
+ | **`BlockingUpdate`** | <code>'BLOCKING_UPDATE'</code> | Blocking firmware update. Only available on Android. | 0.0.1 |
1096
+ | **`ReaderUnavailableOffline`** | <code>'READER_UNAVAILABLE_OFFLINE'</code> | Reader is unavailable offline. Only available on Android. | 0.0.1 |
1097
+ | **`DeviceDeveloperMode`** | <code>'DEVICE_DEVELOPER_MODE'</code> | Device is in developer mode. Only available on Android. | 0.0.1 |
1098
+ | **`Unknown`** | <code>'UNKNOWN'</code> | Unknown reason. | 0.0.1 |
1099
+
1100
+
1101
+ #### ProcessingMode
1102
+
1103
+ | Members | Value | Description | Since |
1104
+ | ----------------- | --------------------------- | ------------------------------------------------------------------ | ----- |
1105
+ | **`AutoDetect`** | <code>'AUTO_DETECT'</code> | Automatically detect the best processing mode (online or offline). | 0.0.1 |
1106
+ | **`OnlineOnly`** | <code>'ONLINE_ONLY'</code> | Process the payment online only. | 0.0.1 |
1107
+ | **`OfflineOnly`** | <code>'OFFLINE_ONLY'</code> | Allow offline payment processing. | 0.0.1 |
1108
+
1109
+
1110
+ #### DelayAction
1111
+
1112
+ | Members | Value | Description | Since |
1113
+ | -------------- | ----------------------- | ---------------------------------------------------------- | ----- |
1114
+ | **`Complete`** | <code>'COMPLETE'</code> | Automatically complete the payment when the delay expires. | 0.0.1 |
1115
+ | **`Cancel`** | <code>'CANCEL'</code> | Automatically cancel the payment when the delay expires. | 0.0.1 |
1116
+
1117
+
1118
+ #### PromptMode
1119
+
1120
+ | Members | Value | Description | Since |
1121
+ | ------------- | ---------------------- | ---------------------------------- | ----- |
1122
+ | **`Default`** | <code>'DEFAULT'</code> | Use the default Square payment UI. | 0.0.1 |
1123
+ | **`Custom`** | <code>'CUSTOM'</code> | Use a custom payment UI. | 0.0.1 |
1124
+
1125
+
1126
+ #### AdditionalPaymentMethod
1127
+
1128
+ | Members | Value | Description | Since |
1129
+ | ----------- | -------------------- | -------------------------------- | ----- |
1130
+ | **`Keyed`** | <code>'KEYED'</code> | Allow manually keyed card entry. | 0.0.1 |
1131
+ | **`Cash`** | <code>'CASH'</code> | Allow cash payments. | 0.0.1 |
1132
+
1133
+
1134
+ #### ReaderChange
1135
+
1136
+ | Members | Value | Description | Since |
1137
+ | ----------------------------- | ----------------------------------------- | ------------------------------------------------------------------ | ----- |
1138
+ | **`BatteryDidBeginCharging`** | <code>'BATTERY_DID_BEGIN_CHARGING'</code> | Reader battery started charging. Only available on iOS. | 0.0.1 |
1139
+ | **`BatteryDidEndCharging`** | <code>'BATTERY_DID_END_CHARGING'</code> | Reader battery stopped charging. Only available on iOS. | 0.0.1 |
1140
+ | **`BatteryLevelDidChange`** | <code>'BATTERY_LEVEL_DID_CHANGE'</code> | Reader battery level changed. Only available on iOS. | 0.0.1 |
1141
+ | **`BatteryCharging`** | <code>'BATTERY_CHARGING'</code> | Reader battery charging status changed. Only available on Android. | 0.0.1 |
1142
+ | **`Added`** | <code>'ADDED'</code> | Reader was added. Only available on Android. | 0.0.1 |
1143
+ | **`Removed`** | <code>'REMOVED'</code> | Reader was removed. Only available on Android. | 0.0.1 |
1144
+ | **`StatusDidChange`** | <code>'STATUS_DID_CHANGE'</code> | Reader status changed. | 0.0.1 |
1145
+
1146
+
1147
+ #### PaymentType
1148
+
1149
+ | Members | Value | Description | Since |
1150
+ | ------------- | ---------------------- | ------------------------------------------------- | ----- |
1151
+ | **`Online`** | <code>'ONLINE'</code> | <a href="#payment">Payment</a> processed online. | 0.0.1 |
1152
+ | **`Offline`** | <code>'OFFLINE'</code> | <a href="#payment">Payment</a> processed offline. | 0.0.1 |
1153
+
1154
+
1155
+ #### PaymentStatus
1156
+
1157
+ | Members | Value | Description | Since |
1158
+ | --------------- | ------------------------ | ------------------------------------------------------------------ | ----- |
1159
+ | **`Completed`** | <code>'COMPLETED'</code> | <a href="#payment">Payment</a> was completed successfully. | 0.0.1 |
1160
+ | **`Approved`** | <code>'APPROVED'</code> | <a href="#payment">Payment</a> was approved but not yet completed. | 0.0.1 |
1161
+ | **`Canceled`** | <code>'CANCELED'</code> | <a href="#payment">Payment</a> was canceled. | 0.0.1 |
1162
+ | **`Failed`** | <code>'FAILED'</code> | <a href="#payment">Payment</a> failed. | 0.0.1 |
1163
+ | **`Pending`** | <code>'PENDING'</code> | <a href="#payment">Payment</a> is pending. | 0.0.1 |
1164
+
1165
+
1166
+ #### CardBrand
1167
+
1168
+ | Members | Value | Description | Since |
1169
+ | --------------------- | ------------------------------- | ---------------------------- | ----- |
1170
+ | **`Visa`** | <code>'VISA'</code> | Visa card. | 0.0.1 |
1171
+ | **`Mastercard`** | <code>'MASTERCARD'</code> | Mastercard. | 0.0.1 |
1172
+ | **`AmericanExpress`** | <code>'AMERICAN_EXPRESS'</code> | American Express card. | 0.0.1 |
1173
+ | **`Discover`** | <code>'DISCOVER'</code> | Discover card. | 0.0.1 |
1174
+ | **`DiscoverDiners`** | <code>'DISCOVER_DINERS'</code> | Discover Diners card. | 0.0.1 |
1175
+ | **`Jcb`** | <code>'JCB'</code> | JCB card. | 0.0.1 |
1176
+ | **`UnionPay`** | <code>'UNION_PAY'</code> | UnionPay card. | 0.0.1 |
1177
+ | **`Interac`** | <code>'INTERAC'</code> | Interac card. | 0.0.1 |
1178
+ | **`Eftpos`** | <code>'EFTPOS'</code> | Eftpos card. | 0.0.1 |
1179
+ | **`Other`** | <code>'OTHER'</code> | Other or unknown card brand. | 0.0.1 |
1180
+
1181
+ </docgen-api>
1182
+
1183
+ [^1]: This project is not affiliated with, endorsed by, sponsored by, or approved by Square, Inc. or any of their affiliates or subsidiaries.