@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.
- package/CapawesomeCapacitorSquareMobilePayments.podspec +17 -0
- package/Package.swift +30 -0
- package/README.md +1183 -0
- package/android/build.gradle +63 -0
- package/android/src/main/AndroidManifest.xml +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/SquareMobilePayments.java +774 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/SquareMobilePaymentsPlugin.java +460 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/CustomException.java +20 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/CustomExceptions.java +41 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/AvailableCardInputMethodsDidChangeEvent.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/PaymentDidCancelEvent.java +24 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/PaymentDidFailEvent.java +34 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/PaymentDidFinishEvent.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderDidChangeEvent.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderPairingDidFailEvent.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderWasAddedEvent.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/events/ReaderWasRemovedEvent.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/AuthorizeOptions.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/ForgetReaderOptions.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/InitializeOptions.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/Money.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/PaymentParameters.java +126 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/PromptParameters.java +47 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/RetryConnectionOptions.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/options/StartPaymentOptions.java +39 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/Card.java +51 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/CardPaymentDetails.java +30 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/GetAvailableCardInputMethodsResult.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/GetReadersResult.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/GetSettingsResult.java +28 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/IsAuthorizedResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/IsPairingInProgressResult.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/MoneyResult.java +27 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/Payment.java +87 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/ReaderInfo.java +82 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/classes/results/UnavailableReasonInfo.java +30 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/EmptyCallback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/NonEmptyCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/NonEmptyResultCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/squaremobilepayments/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +2999 -0
- package/dist/esm/definitions.d.ts +1468 -0
- package/dist/esm/definitions.js +519 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +21 -0
- package/dist/esm/web.js +55 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +588 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +591 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Classes/Options/AuthorizeOptions.swift +17 -0
- package/ios/Plugin/Classes/Options/ForgetReaderOptions.swift +17 -0
- package/ios/Plugin/Classes/Options/InitializeOptions.swift +17 -0
- package/ios/Plugin/Classes/Options/Money.swift +12 -0
- package/ios/Plugin/Classes/Options/PaymentParameters.swift +49 -0
- package/ios/Plugin/Classes/Options/PromptParameters.swift +17 -0
- package/ios/Plugin/Classes/Options/RetryConnectionOptions.swift +17 -0
- package/ios/Plugin/Classes/Options/StartPaymentOptions.swift +19 -0
- package/ios/Plugin/Classes/Results/Card.swift +34 -0
- package/ios/Plugin/Classes/Results/CardPaymentDetails.swift +34 -0
- package/ios/Plugin/Classes/Results/GetAvailableCardInputMethodsResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetReadersResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetSettingsResult.swift +19 -0
- package/ios/Plugin/Classes/Results/IsAuthorizedResult.swift +16 -0
- package/ios/Plugin/Classes/Results/IsPairingInProgressResult.swift +16 -0
- package/ios/Plugin/Classes/Results/MoneyResult.swift +19 -0
- package/ios/Plugin/Classes/Results/Payment.swift +58 -0
- package/ios/Plugin/Classes/Results/ReaderInfo.swift +46 -0
- package/ios/Plugin/Classes/Results/UnavailableReasonInfo.swift +19 -0
- package/ios/Plugin/Enums/CustomError.swift +81 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Protocols/Result.swift +6 -0
- package/ios/Plugin/SquareMobilePayments.swift +632 -0
- package/ios/Plugin/SquareMobilePaymentsHelper.swift +212 -0
- package/ios/Plugin/SquareMobilePaymentsPlugin.swift +347 -0
- package/package.json +93 -0
|
@@ -0,0 +1,1468 @@
|
|
|
1
|
+
import type { PermissionState, PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
/**
|
|
3
|
+
* @since 0.0.1
|
|
4
|
+
*/
|
|
5
|
+
export interface SquareMobilePaymentsPlugin {
|
|
6
|
+
/**
|
|
7
|
+
* Initialize the Square Mobile Payments SDK.
|
|
8
|
+
*
|
|
9
|
+
* This method must be called before any other method.
|
|
10
|
+
*
|
|
11
|
+
* Only available on Android and iOS.
|
|
12
|
+
*
|
|
13
|
+
* @since 0.0.1
|
|
14
|
+
*/
|
|
15
|
+
initialize(options: InitializeOptions): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Authorize the SDK with a Square access token.
|
|
18
|
+
*
|
|
19
|
+
* Only available on Android and iOS.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.0.1
|
|
22
|
+
*/
|
|
23
|
+
authorize(options: AuthorizeOptions): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Check if the SDK is currently authorized.
|
|
26
|
+
*
|
|
27
|
+
* Only available on Android and iOS.
|
|
28
|
+
*
|
|
29
|
+
* @since 0.0.1
|
|
30
|
+
*/
|
|
31
|
+
isAuthorized(): Promise<IsAuthorizedResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Deauthorize the SDK and clear the current authorization.
|
|
34
|
+
*
|
|
35
|
+
* Only available on Android and iOS.
|
|
36
|
+
*
|
|
37
|
+
* @since 0.0.1
|
|
38
|
+
*/
|
|
39
|
+
deauthorize(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Show the Square settings screen.
|
|
42
|
+
*
|
|
43
|
+
* This displays a pre-built settings UI where merchants can view and manage
|
|
44
|
+
* their paired readers.
|
|
45
|
+
*
|
|
46
|
+
* Only available on Android and iOS.
|
|
47
|
+
*
|
|
48
|
+
* @since 0.0.1
|
|
49
|
+
*/
|
|
50
|
+
showSettings(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Get the current SDK settings.
|
|
53
|
+
*
|
|
54
|
+
* Only available on Android and iOS.
|
|
55
|
+
*
|
|
56
|
+
* @since 0.0.1
|
|
57
|
+
*/
|
|
58
|
+
getSettings(): Promise<GetSettingsResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Start pairing with a Square reader.
|
|
61
|
+
*
|
|
62
|
+
* This initiates the reader pairing process. The SDK will search for nearby
|
|
63
|
+
* readers and pair with the first one found.
|
|
64
|
+
*
|
|
65
|
+
* Only available on Android and iOS.
|
|
66
|
+
*
|
|
67
|
+
* @since 0.0.1
|
|
68
|
+
*/
|
|
69
|
+
startPairing(): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Stop the reader pairing process.
|
|
72
|
+
*
|
|
73
|
+
* Only available on Android and iOS.
|
|
74
|
+
*
|
|
75
|
+
* @since 0.0.1
|
|
76
|
+
*/
|
|
77
|
+
stopPairing(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Check if a pairing process is currently in progress.
|
|
80
|
+
*
|
|
81
|
+
* Only available on Android and iOS.
|
|
82
|
+
*
|
|
83
|
+
* @since 0.0.1
|
|
84
|
+
*/
|
|
85
|
+
isPairingInProgress(): Promise<IsPairingInProgressResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Get a list of all paired readers.
|
|
88
|
+
*
|
|
89
|
+
* Only available on Android and iOS.
|
|
90
|
+
*
|
|
91
|
+
* @since 0.0.1
|
|
92
|
+
*/
|
|
93
|
+
getReaders(): Promise<GetReadersResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Forget a paired reader.
|
|
96
|
+
*
|
|
97
|
+
* Only available on Android and iOS.
|
|
98
|
+
*
|
|
99
|
+
* @since 0.0.1
|
|
100
|
+
*/
|
|
101
|
+
forgetReader(options: ForgetReaderOptions): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Retry connecting to a reader.
|
|
104
|
+
*
|
|
105
|
+
* Only available on Android and iOS.
|
|
106
|
+
*
|
|
107
|
+
* @since 0.0.1
|
|
108
|
+
*/
|
|
109
|
+
retryConnection(options: RetryConnectionOptions): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Start a payment flow.
|
|
112
|
+
*
|
|
113
|
+
* This presents the payment UI and processes the payment using the specified
|
|
114
|
+
* parameters. Only one payment can be active at a time.
|
|
115
|
+
*
|
|
116
|
+
* Only available on Android and iOS.
|
|
117
|
+
*
|
|
118
|
+
* @since 0.0.1
|
|
119
|
+
*/
|
|
120
|
+
startPayment(options: StartPaymentOptions): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Cancel an ongoing payment.
|
|
123
|
+
*
|
|
124
|
+
* Only available on Android and iOS.
|
|
125
|
+
*
|
|
126
|
+
* @since 0.0.1
|
|
127
|
+
*/
|
|
128
|
+
cancelPayment(): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Get the currently available card input methods.
|
|
131
|
+
*
|
|
132
|
+
* This returns the card entry methods that are available based on the
|
|
133
|
+
* connected readers (e.g., TAP, DIP, SWIPE, KEYED).
|
|
134
|
+
*
|
|
135
|
+
* Only available on Android and iOS.
|
|
136
|
+
*
|
|
137
|
+
* @since 0.0.1
|
|
138
|
+
*/
|
|
139
|
+
getAvailableCardInputMethods(): Promise<GetAvailableCardInputMethodsResult>;
|
|
140
|
+
/**
|
|
141
|
+
* Check the current permission status.
|
|
142
|
+
*
|
|
143
|
+
* Only available on Android and iOS.
|
|
144
|
+
*
|
|
145
|
+
* @since 0.0.1
|
|
146
|
+
*/
|
|
147
|
+
checkPermissions(): Promise<PermissionStatus>;
|
|
148
|
+
/**
|
|
149
|
+
* Request the required permissions.
|
|
150
|
+
*
|
|
151
|
+
* Only available on Android and iOS.
|
|
152
|
+
*
|
|
153
|
+
* @since 0.0.1
|
|
154
|
+
*/
|
|
155
|
+
requestPermissions(): Promise<PermissionStatus>;
|
|
156
|
+
/**
|
|
157
|
+
* Listen for reader pairing events.
|
|
158
|
+
*
|
|
159
|
+
* Only available on Android and iOS.
|
|
160
|
+
*
|
|
161
|
+
* @since 0.0.1
|
|
162
|
+
*/
|
|
163
|
+
addListener(eventName: 'readerPairingDidBegin', listenerFunc: ReaderPairingDidBeginListener): Promise<PluginListenerHandle>;
|
|
164
|
+
/**
|
|
165
|
+
* Listen for successful reader pairing events.
|
|
166
|
+
*
|
|
167
|
+
* Only available on Android and iOS.
|
|
168
|
+
*
|
|
169
|
+
* @since 0.0.1
|
|
170
|
+
*/
|
|
171
|
+
addListener(eventName: 'readerPairingDidSucceed', listenerFunc: ReaderPairingDidSucceedListener): Promise<PluginListenerHandle>;
|
|
172
|
+
/**
|
|
173
|
+
* Listen for failed reader pairing events.
|
|
174
|
+
*
|
|
175
|
+
* Only available on Android and iOS.
|
|
176
|
+
*
|
|
177
|
+
* @since 0.0.1
|
|
178
|
+
*/
|
|
179
|
+
addListener(eventName: 'readerPairingDidFail', listenerFunc: ReaderPairingDidFailListener): Promise<PluginListenerHandle>;
|
|
180
|
+
/**
|
|
181
|
+
* Listen for reader added events.
|
|
182
|
+
*
|
|
183
|
+
* Only available on Android and iOS.
|
|
184
|
+
*
|
|
185
|
+
* @since 0.0.1
|
|
186
|
+
*/
|
|
187
|
+
addListener(eventName: 'readerWasAdded', listenerFunc: ReaderWasAddedListener): Promise<PluginListenerHandle>;
|
|
188
|
+
/**
|
|
189
|
+
* Listen for reader removed events.
|
|
190
|
+
*
|
|
191
|
+
* Only available on Android and iOS.
|
|
192
|
+
*
|
|
193
|
+
* @since 0.0.1
|
|
194
|
+
*/
|
|
195
|
+
addListener(eventName: 'readerWasRemoved', listenerFunc: ReaderWasRemovedListener): Promise<PluginListenerHandle>;
|
|
196
|
+
/**
|
|
197
|
+
* Listen for reader status and property changes.
|
|
198
|
+
*
|
|
199
|
+
* Only available on Android and iOS.
|
|
200
|
+
*
|
|
201
|
+
* @since 0.0.1
|
|
202
|
+
*/
|
|
203
|
+
addListener(eventName: 'readerDidChange', listenerFunc: ReaderDidChangeListener): Promise<PluginListenerHandle>;
|
|
204
|
+
/**
|
|
205
|
+
* Listen for available card input method changes.
|
|
206
|
+
*
|
|
207
|
+
* Only available on Android and iOS.
|
|
208
|
+
*
|
|
209
|
+
* @since 0.0.1
|
|
210
|
+
*/
|
|
211
|
+
addListener(eventName: 'availableCardInputMethodsDidChange', listenerFunc: AvailableCardInputMethodsDidChangeListener): Promise<PluginListenerHandle>;
|
|
212
|
+
/**
|
|
213
|
+
* Listen for successful payment completion events.
|
|
214
|
+
*
|
|
215
|
+
* Only available on Android and iOS.
|
|
216
|
+
*
|
|
217
|
+
* @since 0.0.1
|
|
218
|
+
*/
|
|
219
|
+
addListener(eventName: 'paymentDidFinish', listenerFunc: PaymentDidFinishListener): Promise<PluginListenerHandle>;
|
|
220
|
+
/**
|
|
221
|
+
* Listen for failed payment events.
|
|
222
|
+
*
|
|
223
|
+
* Only available on Android and iOS.
|
|
224
|
+
*
|
|
225
|
+
* @since 0.0.1
|
|
226
|
+
*/
|
|
227
|
+
addListener(eventName: 'paymentDidFail', listenerFunc: PaymentDidFailListener): Promise<PluginListenerHandle>;
|
|
228
|
+
/**
|
|
229
|
+
* Listen for cancelled payment events.
|
|
230
|
+
*
|
|
231
|
+
* Only available on Android and iOS.
|
|
232
|
+
*
|
|
233
|
+
* @since 0.0.1
|
|
234
|
+
*/
|
|
235
|
+
addListener(eventName: 'paymentDidCancel', listenerFunc: PaymentDidCancelListener): Promise<PluginListenerHandle>;
|
|
236
|
+
/**
|
|
237
|
+
* Remove all listeners for this plugin.
|
|
238
|
+
*
|
|
239
|
+
* Only available on Android and iOS.
|
|
240
|
+
*
|
|
241
|
+
* @since 0.0.1
|
|
242
|
+
*/
|
|
243
|
+
removeAllListeners(): Promise<void>;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @since 0.0.1
|
|
247
|
+
*/
|
|
248
|
+
export interface InitializeOptions {
|
|
249
|
+
/**
|
|
250
|
+
* The Square location ID.
|
|
251
|
+
*
|
|
252
|
+
* @since 0.0.1
|
|
253
|
+
* @example 'LOCATION_ID'
|
|
254
|
+
*/
|
|
255
|
+
locationId: string;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* @since 0.0.1
|
|
259
|
+
*/
|
|
260
|
+
export interface AuthorizeOptions {
|
|
261
|
+
/**
|
|
262
|
+
* The Square access token.
|
|
263
|
+
*
|
|
264
|
+
* @since 0.0.1
|
|
265
|
+
* @example 'EAAAEOuLQPDbLd...'
|
|
266
|
+
*/
|
|
267
|
+
accessToken: string;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* @since 0.0.1
|
|
271
|
+
*/
|
|
272
|
+
export interface IsAuthorizedResult {
|
|
273
|
+
/**
|
|
274
|
+
* Whether the SDK is currently authorized.
|
|
275
|
+
*
|
|
276
|
+
* @since 0.0.1
|
|
277
|
+
*/
|
|
278
|
+
authorized: boolean;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* @since 0.0.1
|
|
282
|
+
*/
|
|
283
|
+
export interface GetSettingsResult {
|
|
284
|
+
/**
|
|
285
|
+
* The SDK version.
|
|
286
|
+
*
|
|
287
|
+
* @since 0.0.1
|
|
288
|
+
* @example '2.0.0'
|
|
289
|
+
*/
|
|
290
|
+
version: string;
|
|
291
|
+
/**
|
|
292
|
+
* The current environment.
|
|
293
|
+
*
|
|
294
|
+
* @since 0.0.1
|
|
295
|
+
* @example 'production'
|
|
296
|
+
*/
|
|
297
|
+
environment: Environment;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* @since 0.0.1
|
|
301
|
+
*/
|
|
302
|
+
export interface IsPairingInProgressResult {
|
|
303
|
+
/**
|
|
304
|
+
* Whether a pairing process is currently in progress.
|
|
305
|
+
*
|
|
306
|
+
* @since 0.0.1
|
|
307
|
+
*/
|
|
308
|
+
inProgress: boolean;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* @since 0.0.1
|
|
312
|
+
*/
|
|
313
|
+
export interface GetReadersResult {
|
|
314
|
+
/**
|
|
315
|
+
* The list of paired readers.
|
|
316
|
+
*
|
|
317
|
+
* @since 0.0.1
|
|
318
|
+
*/
|
|
319
|
+
readers: ReaderInfo[];
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* @since 0.0.1
|
|
323
|
+
*/
|
|
324
|
+
export interface ForgetReaderOptions {
|
|
325
|
+
/**
|
|
326
|
+
* The serial number of the reader to forget.
|
|
327
|
+
*
|
|
328
|
+
* @since 0.0.1
|
|
329
|
+
* @example 'CRR123456789'
|
|
330
|
+
*/
|
|
331
|
+
serialNumber: string;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @since 0.0.1
|
|
335
|
+
*/
|
|
336
|
+
export interface RetryConnectionOptions {
|
|
337
|
+
/**
|
|
338
|
+
* The serial number of the reader to retry connection.
|
|
339
|
+
*
|
|
340
|
+
* @since 0.0.1
|
|
341
|
+
* @example 'CRR123456789'
|
|
342
|
+
*/
|
|
343
|
+
serialNumber: string;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* @since 0.0.1
|
|
347
|
+
*/
|
|
348
|
+
export interface StartPaymentOptions {
|
|
349
|
+
/**
|
|
350
|
+
* The payment parameters.
|
|
351
|
+
*
|
|
352
|
+
* @since 0.0.1
|
|
353
|
+
*/
|
|
354
|
+
paymentParameters: PaymentParameters;
|
|
355
|
+
/**
|
|
356
|
+
* The prompt parameters.
|
|
357
|
+
*
|
|
358
|
+
* @since 0.0.1
|
|
359
|
+
*/
|
|
360
|
+
promptParameters: PromptParameters;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* @since 0.0.1
|
|
364
|
+
*/
|
|
365
|
+
export interface PaymentParameters {
|
|
366
|
+
/**
|
|
367
|
+
* The amount of money to charge.
|
|
368
|
+
*
|
|
369
|
+
* @since 0.0.1
|
|
370
|
+
*/
|
|
371
|
+
amountMoney: Money;
|
|
372
|
+
/**
|
|
373
|
+
* A unique identifier for this payment attempt.
|
|
374
|
+
*
|
|
375
|
+
* This is used for idempotent payment requests.
|
|
376
|
+
*
|
|
377
|
+
* @since 0.0.1
|
|
378
|
+
* @example 'a1b2c3d4-e5f6-4a5b-8c9d-1e2f3a4b5c6d'
|
|
379
|
+
*/
|
|
380
|
+
paymentAttemptId: string;
|
|
381
|
+
/**
|
|
382
|
+
* The processing mode for this payment.
|
|
383
|
+
*
|
|
384
|
+
* @since 0.0.1
|
|
385
|
+
* @default ProcessingMode.AutoDetect
|
|
386
|
+
*/
|
|
387
|
+
processingMode?: ProcessingMode;
|
|
388
|
+
/**
|
|
389
|
+
* A user-defined reference ID to associate with the payment.
|
|
390
|
+
*
|
|
391
|
+
* @since 0.0.1
|
|
392
|
+
* @example 'ORDER-12345'
|
|
393
|
+
*/
|
|
394
|
+
referenceId?: string;
|
|
395
|
+
/**
|
|
396
|
+
* An optional note to add to the payment.
|
|
397
|
+
*
|
|
398
|
+
* @since 0.0.1
|
|
399
|
+
* @example 'Birthday gift'
|
|
400
|
+
*/
|
|
401
|
+
note?: string;
|
|
402
|
+
/**
|
|
403
|
+
* The Square order ID to associate with this payment.
|
|
404
|
+
*
|
|
405
|
+
* @since 0.0.1
|
|
406
|
+
* @example 'CAISENgvlJ6jLWAzERDzjyHVybY'
|
|
407
|
+
*/
|
|
408
|
+
orderId?: string;
|
|
409
|
+
/**
|
|
410
|
+
* The tip amount.
|
|
411
|
+
*
|
|
412
|
+
* @since 0.0.1
|
|
413
|
+
*/
|
|
414
|
+
tipMoney?: Money;
|
|
415
|
+
/**
|
|
416
|
+
* The application fee.
|
|
417
|
+
*
|
|
418
|
+
* @since 0.0.1
|
|
419
|
+
*/
|
|
420
|
+
applicationFee?: Money;
|
|
421
|
+
/**
|
|
422
|
+
* Whether to automatically complete the payment.
|
|
423
|
+
*
|
|
424
|
+
* If false, the payment will be authorized but not captured, requiring
|
|
425
|
+
* manual completion via the Payments API.
|
|
426
|
+
*
|
|
427
|
+
* @since 0.0.1
|
|
428
|
+
* @default true
|
|
429
|
+
*/
|
|
430
|
+
autocomplete?: boolean;
|
|
431
|
+
/**
|
|
432
|
+
* The duration to delay before automatically completing or canceling the payment.
|
|
433
|
+
*
|
|
434
|
+
* Only applicable when autocomplete is false.
|
|
435
|
+
*
|
|
436
|
+
* @since 0.0.1
|
|
437
|
+
* @example 'PT1H'
|
|
438
|
+
*/
|
|
439
|
+
delayDuration?: string;
|
|
440
|
+
/**
|
|
441
|
+
* The action to take when the delay duration expires.
|
|
442
|
+
*
|
|
443
|
+
* Only applicable when autocomplete is false.
|
|
444
|
+
*
|
|
445
|
+
* @since 0.0.1
|
|
446
|
+
*/
|
|
447
|
+
delayAction?: DelayAction;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* @since 0.0.1
|
|
451
|
+
*/
|
|
452
|
+
export interface PromptParameters {
|
|
453
|
+
/**
|
|
454
|
+
* The prompt mode.
|
|
455
|
+
*
|
|
456
|
+
* @since 0.0.1
|
|
457
|
+
* @default PromptMode.Default
|
|
458
|
+
*/
|
|
459
|
+
mode?: PromptMode;
|
|
460
|
+
/**
|
|
461
|
+
* Additional payment methods to allow.
|
|
462
|
+
*
|
|
463
|
+
* @since 0.0.1
|
|
464
|
+
* @default []
|
|
465
|
+
*/
|
|
466
|
+
additionalMethods?: AdditionalPaymentMethod[];
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* @since 0.0.1
|
|
470
|
+
*/
|
|
471
|
+
export interface Money {
|
|
472
|
+
/**
|
|
473
|
+
* The amount in the smallest currency unit (e.g., cents for USD).
|
|
474
|
+
*
|
|
475
|
+
* @since 0.0.1
|
|
476
|
+
* @example 100
|
|
477
|
+
*/
|
|
478
|
+
amount: number;
|
|
479
|
+
/**
|
|
480
|
+
* The ISO 4217 currency code.
|
|
481
|
+
*
|
|
482
|
+
* @since 0.0.1
|
|
483
|
+
* @example 'USD'
|
|
484
|
+
*/
|
|
485
|
+
currency: CurrencyCode;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* @since 0.0.1
|
|
489
|
+
*/
|
|
490
|
+
export interface GetAvailableCardInputMethodsResult {
|
|
491
|
+
/**
|
|
492
|
+
* The available card input methods.
|
|
493
|
+
*
|
|
494
|
+
* @since 0.0.1
|
|
495
|
+
*/
|
|
496
|
+
cardInputMethods: CardInputMethod[];
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* @since 0.0.1
|
|
500
|
+
*/
|
|
501
|
+
export interface ReaderInfo {
|
|
502
|
+
/**
|
|
503
|
+
* The reader's serial number.
|
|
504
|
+
*
|
|
505
|
+
* @since 0.0.1
|
|
506
|
+
* @example 'CRR123456789'
|
|
507
|
+
*/
|
|
508
|
+
serialNumber: string;
|
|
509
|
+
/**
|
|
510
|
+
* The reader's model.
|
|
511
|
+
*
|
|
512
|
+
* @since 0.0.1
|
|
513
|
+
*/
|
|
514
|
+
model: ReaderModel;
|
|
515
|
+
/**
|
|
516
|
+
* The reader's current status.
|
|
517
|
+
*
|
|
518
|
+
* @since 0.0.1
|
|
519
|
+
*/
|
|
520
|
+
status: ReaderStatus;
|
|
521
|
+
/**
|
|
522
|
+
* The reader's firmware version.
|
|
523
|
+
*
|
|
524
|
+
* @since 0.0.1
|
|
525
|
+
* @example '1.2.3'
|
|
526
|
+
*/
|
|
527
|
+
firmwareVersion?: string;
|
|
528
|
+
/**
|
|
529
|
+
* The reader's battery level (0-100).
|
|
530
|
+
*
|
|
531
|
+
* @since 0.0.1
|
|
532
|
+
* @example 85
|
|
533
|
+
*/
|
|
534
|
+
batteryLevel?: number;
|
|
535
|
+
/**
|
|
536
|
+
* Whether the reader is currently charging.
|
|
537
|
+
*
|
|
538
|
+
* @since 0.0.1
|
|
539
|
+
*/
|
|
540
|
+
isCharging?: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* The card input methods supported by this reader.
|
|
543
|
+
*
|
|
544
|
+
* @since 0.0.1
|
|
545
|
+
*/
|
|
546
|
+
supportedCardInputMethods: CardInputMethod[];
|
|
547
|
+
/**
|
|
548
|
+
* Additional information about why the reader is unavailable.
|
|
549
|
+
*
|
|
550
|
+
* Only present when status is ReaderUnavailable.
|
|
551
|
+
*
|
|
552
|
+
* @since 0.0.1
|
|
553
|
+
*/
|
|
554
|
+
unavailableReasonInfo?: UnavailableReasonInfo;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* @since 0.0.1
|
|
558
|
+
*/
|
|
559
|
+
export interface UnavailableReasonInfo {
|
|
560
|
+
/**
|
|
561
|
+
* The reason code why the reader is unavailable.
|
|
562
|
+
*
|
|
563
|
+
* @since 0.0.1
|
|
564
|
+
*/
|
|
565
|
+
reason: UnavailableReason;
|
|
566
|
+
/**
|
|
567
|
+
* A human-readable message describing why the reader is unavailable.
|
|
568
|
+
*
|
|
569
|
+
* @since 0.0.1
|
|
570
|
+
*/
|
|
571
|
+
message?: string;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* @since 0.0.1
|
|
575
|
+
*/
|
|
576
|
+
export interface Payment {
|
|
577
|
+
/**
|
|
578
|
+
* The unique identifier for this payment.
|
|
579
|
+
*
|
|
580
|
+
* For offline payments, this may be null until synced.
|
|
581
|
+
*
|
|
582
|
+
* @since 0.0.1
|
|
583
|
+
* @example 'AbCdEfGhIjKlMnOpQrStUvWxYz'
|
|
584
|
+
*/
|
|
585
|
+
id: string | null;
|
|
586
|
+
/**
|
|
587
|
+
* The payment type.
|
|
588
|
+
*
|
|
589
|
+
* @since 0.0.1
|
|
590
|
+
*/
|
|
591
|
+
type: PaymentType;
|
|
592
|
+
/**
|
|
593
|
+
* The payment status.
|
|
594
|
+
*
|
|
595
|
+
* @since 0.0.1
|
|
596
|
+
*/
|
|
597
|
+
status: PaymentStatus;
|
|
598
|
+
/**
|
|
599
|
+
* The amount paid.
|
|
600
|
+
*
|
|
601
|
+
* @since 0.0.1
|
|
602
|
+
*/
|
|
603
|
+
amountMoney: Money;
|
|
604
|
+
/**
|
|
605
|
+
* The tip amount.
|
|
606
|
+
*
|
|
607
|
+
* @since 0.0.1
|
|
608
|
+
*/
|
|
609
|
+
tipMoney?: Money;
|
|
610
|
+
/**
|
|
611
|
+
* The application fee.
|
|
612
|
+
*
|
|
613
|
+
* @since 0.0.1
|
|
614
|
+
*/
|
|
615
|
+
applicationFee?: Money;
|
|
616
|
+
/**
|
|
617
|
+
* The reference ID provided in the payment parameters.
|
|
618
|
+
*
|
|
619
|
+
* @since 0.0.1
|
|
620
|
+
*/
|
|
621
|
+
referenceId?: string;
|
|
622
|
+
/**
|
|
623
|
+
* The order ID associated with this payment.
|
|
624
|
+
*
|
|
625
|
+
* @since 0.0.1
|
|
626
|
+
*/
|
|
627
|
+
orderId?: string;
|
|
628
|
+
/**
|
|
629
|
+
* Card payment details.
|
|
630
|
+
*
|
|
631
|
+
* Only present for card payments.
|
|
632
|
+
*
|
|
633
|
+
* @since 0.0.1
|
|
634
|
+
*/
|
|
635
|
+
cardDetails?: CardPaymentDetails;
|
|
636
|
+
/**
|
|
637
|
+
* The time the payment was created (ISO 8601 format).
|
|
638
|
+
*
|
|
639
|
+
* @since 0.0.1
|
|
640
|
+
* @example '2024-01-15T10:30:00Z'
|
|
641
|
+
*/
|
|
642
|
+
createdAt?: string;
|
|
643
|
+
/**
|
|
644
|
+
* The time the payment was updated (ISO 8601 format).
|
|
645
|
+
*
|
|
646
|
+
* @since 0.0.1
|
|
647
|
+
* @example '2024-01-15T10:30:00Z'
|
|
648
|
+
*/
|
|
649
|
+
updatedAt?: string;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* @since 0.0.1
|
|
653
|
+
*/
|
|
654
|
+
export interface CardPaymentDetails {
|
|
655
|
+
/**
|
|
656
|
+
* The card information.
|
|
657
|
+
*
|
|
658
|
+
* @since 0.0.1
|
|
659
|
+
*/
|
|
660
|
+
card: Card;
|
|
661
|
+
/**
|
|
662
|
+
* The card entry method used.
|
|
663
|
+
*
|
|
664
|
+
* @since 0.0.1
|
|
665
|
+
*/
|
|
666
|
+
entryMethod: CardInputMethod;
|
|
667
|
+
/**
|
|
668
|
+
* The authorization code.
|
|
669
|
+
*
|
|
670
|
+
* @since 0.0.1
|
|
671
|
+
* @example '123456'
|
|
672
|
+
*/
|
|
673
|
+
authorizationCode?: string;
|
|
674
|
+
/**
|
|
675
|
+
* The EMV application name.
|
|
676
|
+
*
|
|
677
|
+
* @since 0.0.1
|
|
678
|
+
* @example 'VISA CREDIT'
|
|
679
|
+
*/
|
|
680
|
+
applicationName?: string;
|
|
681
|
+
/**
|
|
682
|
+
* The EMV application identifier.
|
|
683
|
+
*
|
|
684
|
+
* @since 0.0.1
|
|
685
|
+
* @example 'A0000000031010'
|
|
686
|
+
*/
|
|
687
|
+
applicationId?: string;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* @since 0.0.1
|
|
691
|
+
*/
|
|
692
|
+
export interface Card {
|
|
693
|
+
/**
|
|
694
|
+
* The card brand.
|
|
695
|
+
*
|
|
696
|
+
* @since 0.0.1
|
|
697
|
+
*/
|
|
698
|
+
brand: CardBrand;
|
|
699
|
+
/**
|
|
700
|
+
* The last four digits of the card number.
|
|
701
|
+
*
|
|
702
|
+
* @since 0.0.1
|
|
703
|
+
* @example '1234'
|
|
704
|
+
*/
|
|
705
|
+
lastFourDigits: string;
|
|
706
|
+
/**
|
|
707
|
+
* The cardholder name.
|
|
708
|
+
*
|
|
709
|
+
* @since 0.0.1
|
|
710
|
+
* @example 'John Doe'
|
|
711
|
+
*/
|
|
712
|
+
cardholderName?: string;
|
|
713
|
+
/**
|
|
714
|
+
* The card expiration month (1-12).
|
|
715
|
+
*
|
|
716
|
+
* @since 0.0.1
|
|
717
|
+
* @example 12
|
|
718
|
+
*/
|
|
719
|
+
expirationMonth?: number;
|
|
720
|
+
/**
|
|
721
|
+
* The card expiration year.
|
|
722
|
+
*
|
|
723
|
+
* @since 0.0.1
|
|
724
|
+
* @example 2025
|
|
725
|
+
*/
|
|
726
|
+
expirationYear?: number;
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Callback to receive reader pairing start notifications.
|
|
730
|
+
*
|
|
731
|
+
* @since 0.0.1
|
|
732
|
+
*/
|
|
733
|
+
export declare type ReaderPairingDidBeginListener = () => void;
|
|
734
|
+
/**
|
|
735
|
+
* Callback to receive reader pairing success notifications.
|
|
736
|
+
*
|
|
737
|
+
* @since 0.0.1
|
|
738
|
+
*/
|
|
739
|
+
export declare type ReaderPairingDidSucceedListener = () => void;
|
|
740
|
+
/**
|
|
741
|
+
* Callback to receive reader pairing failure notifications.
|
|
742
|
+
*
|
|
743
|
+
* @since 0.0.1
|
|
744
|
+
*/
|
|
745
|
+
export declare type ReaderPairingDidFailListener = (event: ReaderPairingDidFailEvent) => void;
|
|
746
|
+
/**
|
|
747
|
+
* @since 0.0.1
|
|
748
|
+
*/
|
|
749
|
+
export interface ReaderPairingDidFailEvent {
|
|
750
|
+
/**
|
|
751
|
+
* The error code.
|
|
752
|
+
*
|
|
753
|
+
* @since 0.0.1
|
|
754
|
+
*/
|
|
755
|
+
code?: string;
|
|
756
|
+
/**
|
|
757
|
+
* The error message.
|
|
758
|
+
*
|
|
759
|
+
* @since 0.0.1
|
|
760
|
+
*/
|
|
761
|
+
message: string;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Callback to receive reader added notifications.
|
|
765
|
+
*
|
|
766
|
+
* @since 0.0.1
|
|
767
|
+
*/
|
|
768
|
+
export declare type ReaderWasAddedListener = (event: ReaderWasAddedEvent) => void;
|
|
769
|
+
/**
|
|
770
|
+
* @since 0.0.1
|
|
771
|
+
*/
|
|
772
|
+
export interface ReaderWasAddedEvent {
|
|
773
|
+
/**
|
|
774
|
+
* The reader that was added.
|
|
775
|
+
*
|
|
776
|
+
* @since 0.0.1
|
|
777
|
+
*/
|
|
778
|
+
reader: ReaderInfo;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Callback to receive reader removed notifications.
|
|
782
|
+
*
|
|
783
|
+
* @since 0.0.1
|
|
784
|
+
*/
|
|
785
|
+
export declare type ReaderWasRemovedListener = (event: ReaderWasRemovedEvent) => void;
|
|
786
|
+
/**
|
|
787
|
+
* @since 0.0.1
|
|
788
|
+
*/
|
|
789
|
+
export interface ReaderWasRemovedEvent {
|
|
790
|
+
/**
|
|
791
|
+
* The reader that was removed.
|
|
792
|
+
*
|
|
793
|
+
* @since 0.0.1
|
|
794
|
+
*/
|
|
795
|
+
reader: ReaderInfo;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Callback to receive reader change notifications.
|
|
799
|
+
*
|
|
800
|
+
* @since 0.0.1
|
|
801
|
+
*/
|
|
802
|
+
export declare type ReaderDidChangeListener = (event: ReaderDidChangeEvent) => void;
|
|
803
|
+
/**
|
|
804
|
+
* @since 0.0.1
|
|
805
|
+
*/
|
|
806
|
+
export interface ReaderDidChangeEvent {
|
|
807
|
+
/**
|
|
808
|
+
* The reader that changed.
|
|
809
|
+
*
|
|
810
|
+
* @since 0.0.1
|
|
811
|
+
*/
|
|
812
|
+
reader: ReaderInfo;
|
|
813
|
+
/**
|
|
814
|
+
* The type of change that occurred.
|
|
815
|
+
*
|
|
816
|
+
* @since 0.0.1
|
|
817
|
+
*/
|
|
818
|
+
change: ReaderChange;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Callback to receive available card input method change notifications.
|
|
822
|
+
*
|
|
823
|
+
* @since 0.0.1
|
|
824
|
+
*/
|
|
825
|
+
export declare type AvailableCardInputMethodsDidChangeListener = (event: AvailableCardInputMethodsDidChangeEvent) => void;
|
|
826
|
+
/**
|
|
827
|
+
* @since 0.0.1
|
|
828
|
+
*/
|
|
829
|
+
export interface AvailableCardInputMethodsDidChangeEvent {
|
|
830
|
+
/**
|
|
831
|
+
* The available card input methods.
|
|
832
|
+
*
|
|
833
|
+
* @since 0.0.1
|
|
834
|
+
*/
|
|
835
|
+
cardInputMethods: CardInputMethod[];
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Callback to receive payment completion notifications.
|
|
839
|
+
*
|
|
840
|
+
* @since 0.0.1
|
|
841
|
+
*/
|
|
842
|
+
export declare type PaymentDidFinishListener = (event: PaymentDidFinishEvent) => void;
|
|
843
|
+
/**
|
|
844
|
+
* @since 0.0.1
|
|
845
|
+
*/
|
|
846
|
+
export interface PaymentDidFinishEvent {
|
|
847
|
+
/**
|
|
848
|
+
* The completed payment.
|
|
849
|
+
*
|
|
850
|
+
* @since 0.0.1
|
|
851
|
+
*/
|
|
852
|
+
payment: Payment;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Callback to receive payment failure notifications.
|
|
856
|
+
*
|
|
857
|
+
* @since 0.0.1
|
|
858
|
+
*/
|
|
859
|
+
export declare type PaymentDidFailListener = (event: PaymentDidFailEvent) => void;
|
|
860
|
+
/**
|
|
861
|
+
* @since 0.0.1
|
|
862
|
+
*/
|
|
863
|
+
export interface PaymentDidFailEvent {
|
|
864
|
+
/**
|
|
865
|
+
* The failed payment.
|
|
866
|
+
*
|
|
867
|
+
* @since 0.0.1
|
|
868
|
+
*/
|
|
869
|
+
payment?: Payment;
|
|
870
|
+
/**
|
|
871
|
+
* The error code.
|
|
872
|
+
*
|
|
873
|
+
* @since 0.0.1
|
|
874
|
+
*/
|
|
875
|
+
code?: string;
|
|
876
|
+
/**
|
|
877
|
+
* The error message.
|
|
878
|
+
*
|
|
879
|
+
* @since 0.0.1
|
|
880
|
+
*/
|
|
881
|
+
message: string;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Callback to receive payment cancellation notifications.
|
|
885
|
+
*
|
|
886
|
+
* @since 0.0.1
|
|
887
|
+
*/
|
|
888
|
+
export declare type PaymentDidCancelListener = (event: PaymentDidCancelEvent) => void;
|
|
889
|
+
/**
|
|
890
|
+
* @since 0.0.1
|
|
891
|
+
*/
|
|
892
|
+
export interface PaymentDidCancelEvent {
|
|
893
|
+
/**
|
|
894
|
+
* The cancelled payment.
|
|
895
|
+
*
|
|
896
|
+
* @since 0.0.1
|
|
897
|
+
*/
|
|
898
|
+
payment?: Payment;
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* @since 0.0.1
|
|
902
|
+
*/
|
|
903
|
+
export declare enum Environment {
|
|
904
|
+
/**
|
|
905
|
+
* Production environment.
|
|
906
|
+
*
|
|
907
|
+
* @since 0.0.1
|
|
908
|
+
*/
|
|
909
|
+
Production = "production",
|
|
910
|
+
/**
|
|
911
|
+
* Sandbox environment for testing.
|
|
912
|
+
*
|
|
913
|
+
* @since 0.0.1
|
|
914
|
+
*/
|
|
915
|
+
Sandbox = "sandbox"
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* @since 0.0.1
|
|
919
|
+
*/
|
|
920
|
+
export declare enum CardInputMethod {
|
|
921
|
+
/**
|
|
922
|
+
* Contactless card tap (NFC).
|
|
923
|
+
*
|
|
924
|
+
* @since 0.0.1
|
|
925
|
+
*/
|
|
926
|
+
Tap = "TAP",
|
|
927
|
+
/**
|
|
928
|
+
* EMV chip card insertion.
|
|
929
|
+
*
|
|
930
|
+
* @since 0.0.1
|
|
931
|
+
*/
|
|
932
|
+
Dip = "DIP",
|
|
933
|
+
/**
|
|
934
|
+
* Magnetic stripe swipe.
|
|
935
|
+
*
|
|
936
|
+
* @since 0.0.1
|
|
937
|
+
*/
|
|
938
|
+
Swipe = "SWIPE",
|
|
939
|
+
/**
|
|
940
|
+
* Manually keyed card entry.
|
|
941
|
+
*
|
|
942
|
+
* @since 0.0.1
|
|
943
|
+
*/
|
|
944
|
+
Keyed = "KEYED"
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* @since 0.0.1
|
|
948
|
+
*/
|
|
949
|
+
export declare enum ProcessingMode {
|
|
950
|
+
/**
|
|
951
|
+
* Automatically detect the best processing mode (online or offline).
|
|
952
|
+
*
|
|
953
|
+
* @since 0.0.1
|
|
954
|
+
*/
|
|
955
|
+
AutoDetect = "AUTO_DETECT",
|
|
956
|
+
/**
|
|
957
|
+
* Process the payment online only.
|
|
958
|
+
*
|
|
959
|
+
* @since 0.0.1
|
|
960
|
+
*/
|
|
961
|
+
OnlineOnly = "ONLINE_ONLY",
|
|
962
|
+
/**
|
|
963
|
+
* Allow offline payment processing.
|
|
964
|
+
*
|
|
965
|
+
* @since 0.0.1
|
|
966
|
+
*/
|
|
967
|
+
OfflineOnly = "OFFLINE_ONLY"
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* @since 0.0.1
|
|
971
|
+
*/
|
|
972
|
+
export declare enum PromptMode {
|
|
973
|
+
/**
|
|
974
|
+
* Use the default Square payment UI.
|
|
975
|
+
*
|
|
976
|
+
* @since 0.0.1
|
|
977
|
+
*/
|
|
978
|
+
Default = "DEFAULT",
|
|
979
|
+
/**
|
|
980
|
+
* Use a custom payment UI.
|
|
981
|
+
*
|
|
982
|
+
* @since 0.0.1
|
|
983
|
+
*/
|
|
984
|
+
Custom = "CUSTOM"
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* @since 0.0.1
|
|
988
|
+
*/
|
|
989
|
+
export declare enum AdditionalPaymentMethod {
|
|
990
|
+
/**
|
|
991
|
+
* Allow manually keyed card entry.
|
|
992
|
+
*
|
|
993
|
+
* @since 0.0.1
|
|
994
|
+
*/
|
|
995
|
+
Keyed = "KEYED",
|
|
996
|
+
/**
|
|
997
|
+
* Allow cash payments.
|
|
998
|
+
*
|
|
999
|
+
* @since 0.0.1
|
|
1000
|
+
*/
|
|
1001
|
+
Cash = "CASH"
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* @since 0.0.1
|
|
1005
|
+
*/
|
|
1006
|
+
export declare enum DelayAction {
|
|
1007
|
+
/**
|
|
1008
|
+
* Automatically complete the payment when the delay expires.
|
|
1009
|
+
*
|
|
1010
|
+
* @since 0.0.1
|
|
1011
|
+
*/
|
|
1012
|
+
Complete = "COMPLETE",
|
|
1013
|
+
/**
|
|
1014
|
+
* Automatically cancel the payment when the delay expires.
|
|
1015
|
+
*
|
|
1016
|
+
* @since 0.0.1
|
|
1017
|
+
*/
|
|
1018
|
+
Cancel = "CANCEL"
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* @since 0.0.1
|
|
1022
|
+
*/
|
|
1023
|
+
export declare enum ReaderModel {
|
|
1024
|
+
/**
|
|
1025
|
+
* Square Reader for contactless and chip.
|
|
1026
|
+
*
|
|
1027
|
+
* @since 0.0.1
|
|
1028
|
+
*/
|
|
1029
|
+
ContactlessAndChip = "CONTACTLESS_AND_CHIP",
|
|
1030
|
+
/**
|
|
1031
|
+
* Square Reader for magstripe.
|
|
1032
|
+
*
|
|
1033
|
+
* @since 0.0.1
|
|
1034
|
+
*/
|
|
1035
|
+
Magstripe = "MAGSTRIPE",
|
|
1036
|
+
/**
|
|
1037
|
+
* Square Stand.
|
|
1038
|
+
*
|
|
1039
|
+
* @since 0.0.1
|
|
1040
|
+
*/
|
|
1041
|
+
Stand = "STAND",
|
|
1042
|
+
/**
|
|
1043
|
+
* Unknown reader model.
|
|
1044
|
+
*
|
|
1045
|
+
* @since 0.0.1
|
|
1046
|
+
*/
|
|
1047
|
+
Unknown = "UNKNOWN"
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* @since 0.0.1
|
|
1051
|
+
*/
|
|
1052
|
+
export declare enum ReaderStatus {
|
|
1053
|
+
/**
|
|
1054
|
+
* Reader is paired, connected, and ready to accept payments.
|
|
1055
|
+
*
|
|
1056
|
+
* @since 0.0.1
|
|
1057
|
+
*/
|
|
1058
|
+
Ready = "READY",
|
|
1059
|
+
/**
|
|
1060
|
+
* Reader is connecting to Square servers.
|
|
1061
|
+
*
|
|
1062
|
+
* @since 0.0.1
|
|
1063
|
+
*/
|
|
1064
|
+
ConnectingToSquare = "CONNECTING_TO_SQUARE",
|
|
1065
|
+
/**
|
|
1066
|
+
* Reader is connecting to the mobile device.
|
|
1067
|
+
*
|
|
1068
|
+
* @since 0.0.1
|
|
1069
|
+
*/
|
|
1070
|
+
ConnectingToDevice = "CONNECTING_TO_DEVICE",
|
|
1071
|
+
/**
|
|
1072
|
+
* Reader has a hardware or connection error in an unrecoverable state.
|
|
1073
|
+
*
|
|
1074
|
+
* @since 0.0.1
|
|
1075
|
+
*/
|
|
1076
|
+
Faulty = "FAULTY",
|
|
1077
|
+
/**
|
|
1078
|
+
* Reader is connected but unable to process payments.
|
|
1079
|
+
*
|
|
1080
|
+
* @since 0.0.1
|
|
1081
|
+
*/
|
|
1082
|
+
ReaderUnavailable = "READER_UNAVAILABLE"
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* @since 0.0.1
|
|
1086
|
+
*/
|
|
1087
|
+
export declare enum ReaderChange {
|
|
1088
|
+
/**
|
|
1089
|
+
* Reader battery started charging.
|
|
1090
|
+
*
|
|
1091
|
+
* Only available on iOS.
|
|
1092
|
+
*
|
|
1093
|
+
* @since 0.0.1
|
|
1094
|
+
*/
|
|
1095
|
+
BatteryDidBeginCharging = "BATTERY_DID_BEGIN_CHARGING",
|
|
1096
|
+
/**
|
|
1097
|
+
* Reader battery stopped charging.
|
|
1098
|
+
*
|
|
1099
|
+
* Only available on iOS.
|
|
1100
|
+
*
|
|
1101
|
+
* @since 0.0.1
|
|
1102
|
+
*/
|
|
1103
|
+
BatteryDidEndCharging = "BATTERY_DID_END_CHARGING",
|
|
1104
|
+
/**
|
|
1105
|
+
* Reader battery level changed.
|
|
1106
|
+
*
|
|
1107
|
+
* Only available on iOS.
|
|
1108
|
+
*
|
|
1109
|
+
* @since 0.0.1
|
|
1110
|
+
*/
|
|
1111
|
+
BatteryLevelDidChange = "BATTERY_LEVEL_DID_CHANGE",
|
|
1112
|
+
/**
|
|
1113
|
+
* Reader battery charging status changed.
|
|
1114
|
+
*
|
|
1115
|
+
* Only available on Android.
|
|
1116
|
+
*
|
|
1117
|
+
* @since 0.0.1
|
|
1118
|
+
*/
|
|
1119
|
+
BatteryCharging = "BATTERY_CHARGING",
|
|
1120
|
+
/**
|
|
1121
|
+
* Reader was added.
|
|
1122
|
+
*
|
|
1123
|
+
* Only available on Android.
|
|
1124
|
+
*
|
|
1125
|
+
* @since 0.0.1
|
|
1126
|
+
*/
|
|
1127
|
+
Added = "ADDED",
|
|
1128
|
+
/**
|
|
1129
|
+
* Reader was removed.
|
|
1130
|
+
*
|
|
1131
|
+
* Only available on Android.
|
|
1132
|
+
*
|
|
1133
|
+
* @since 0.0.1
|
|
1134
|
+
*/
|
|
1135
|
+
Removed = "REMOVED",
|
|
1136
|
+
/**
|
|
1137
|
+
* Reader status changed.
|
|
1138
|
+
*
|
|
1139
|
+
* @since 0.0.1
|
|
1140
|
+
*/
|
|
1141
|
+
StatusDidChange = "STATUS_DID_CHANGE"
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* @since 0.0.1
|
|
1145
|
+
*/
|
|
1146
|
+
export declare enum UnavailableReason {
|
|
1147
|
+
/**
|
|
1148
|
+
* Bluetooth connection issue.
|
|
1149
|
+
*
|
|
1150
|
+
* Only available on iOS.
|
|
1151
|
+
*
|
|
1152
|
+
* @since 0.0.1
|
|
1153
|
+
*/
|
|
1154
|
+
BluetoothError = "BLUETOOTH_ERROR",
|
|
1155
|
+
/**
|
|
1156
|
+
* Bluetooth failure.
|
|
1157
|
+
*
|
|
1158
|
+
* Only available on Android.
|
|
1159
|
+
*
|
|
1160
|
+
* @since 0.0.1
|
|
1161
|
+
*/
|
|
1162
|
+
BluetoothFailure = "BLUETOOTH_FAILURE",
|
|
1163
|
+
/**
|
|
1164
|
+
* Bluetooth is disabled.
|
|
1165
|
+
*
|
|
1166
|
+
* Only available on Android.
|
|
1167
|
+
*
|
|
1168
|
+
* @since 0.0.1
|
|
1169
|
+
*/
|
|
1170
|
+
BluetoothDisabled = "BLUETOOTH_DISABLED",
|
|
1171
|
+
/**
|
|
1172
|
+
* Reader firmware is updating.
|
|
1173
|
+
*
|
|
1174
|
+
* Only available on iOS.
|
|
1175
|
+
*
|
|
1176
|
+
* @since 0.0.1
|
|
1177
|
+
*/
|
|
1178
|
+
FirmwareUpdate = "FIRMWARE_UPDATE",
|
|
1179
|
+
/**
|
|
1180
|
+
* Blocking firmware update.
|
|
1181
|
+
*
|
|
1182
|
+
* Only available on Android.
|
|
1183
|
+
*
|
|
1184
|
+
* @since 0.0.1
|
|
1185
|
+
*/
|
|
1186
|
+
BlockingUpdate = "BLOCKING_UPDATE",
|
|
1187
|
+
/**
|
|
1188
|
+
* Reader is unavailable offline.
|
|
1189
|
+
*
|
|
1190
|
+
* Only available on Android.
|
|
1191
|
+
*
|
|
1192
|
+
* @since 0.0.1
|
|
1193
|
+
*/
|
|
1194
|
+
ReaderUnavailableOffline = "READER_UNAVAILABLE_OFFLINE",
|
|
1195
|
+
/**
|
|
1196
|
+
* Device is in developer mode.
|
|
1197
|
+
*
|
|
1198
|
+
* Only available on Android.
|
|
1199
|
+
*
|
|
1200
|
+
* @since 0.0.1
|
|
1201
|
+
*/
|
|
1202
|
+
DeviceDeveloperMode = "DEVICE_DEVELOPER_MODE",
|
|
1203
|
+
/**
|
|
1204
|
+
* Unknown reason.
|
|
1205
|
+
*
|
|
1206
|
+
* @since 0.0.1
|
|
1207
|
+
*/
|
|
1208
|
+
Unknown = "UNKNOWN"
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* @since 0.0.1
|
|
1212
|
+
*/
|
|
1213
|
+
export declare enum PaymentType {
|
|
1214
|
+
/**
|
|
1215
|
+
* Payment processed online.
|
|
1216
|
+
*
|
|
1217
|
+
* @since 0.0.1
|
|
1218
|
+
*/
|
|
1219
|
+
Online = "ONLINE",
|
|
1220
|
+
/**
|
|
1221
|
+
* Payment processed offline.
|
|
1222
|
+
*
|
|
1223
|
+
* @since 0.0.1
|
|
1224
|
+
*/
|
|
1225
|
+
Offline = "OFFLINE"
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* @since 0.0.1
|
|
1229
|
+
*/
|
|
1230
|
+
export declare enum PaymentStatus {
|
|
1231
|
+
/**
|
|
1232
|
+
* Payment was completed successfully.
|
|
1233
|
+
*
|
|
1234
|
+
* @since 0.0.1
|
|
1235
|
+
*/
|
|
1236
|
+
Completed = "COMPLETED",
|
|
1237
|
+
/**
|
|
1238
|
+
* Payment was approved but not yet completed.
|
|
1239
|
+
*
|
|
1240
|
+
* @since 0.0.1
|
|
1241
|
+
*/
|
|
1242
|
+
Approved = "APPROVED",
|
|
1243
|
+
/**
|
|
1244
|
+
* Payment was canceled.
|
|
1245
|
+
*
|
|
1246
|
+
* @since 0.0.1
|
|
1247
|
+
*/
|
|
1248
|
+
Canceled = "CANCELED",
|
|
1249
|
+
/**
|
|
1250
|
+
* Payment failed.
|
|
1251
|
+
*
|
|
1252
|
+
* @since 0.0.1
|
|
1253
|
+
*/
|
|
1254
|
+
Failed = "FAILED",
|
|
1255
|
+
/**
|
|
1256
|
+
* Payment is pending.
|
|
1257
|
+
*
|
|
1258
|
+
* @since 0.0.1
|
|
1259
|
+
*/
|
|
1260
|
+
Pending = "PENDING"
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* @since 0.0.1
|
|
1264
|
+
*/
|
|
1265
|
+
export declare enum CardBrand {
|
|
1266
|
+
/**
|
|
1267
|
+
* Visa card.
|
|
1268
|
+
*
|
|
1269
|
+
* @since 0.0.1
|
|
1270
|
+
*/
|
|
1271
|
+
Visa = "VISA",
|
|
1272
|
+
/**
|
|
1273
|
+
* Mastercard.
|
|
1274
|
+
*
|
|
1275
|
+
* @since 0.0.1
|
|
1276
|
+
*/
|
|
1277
|
+
Mastercard = "MASTERCARD",
|
|
1278
|
+
/**
|
|
1279
|
+
* American Express card.
|
|
1280
|
+
*
|
|
1281
|
+
* @since 0.0.1
|
|
1282
|
+
*/
|
|
1283
|
+
AmericanExpress = "AMERICAN_EXPRESS",
|
|
1284
|
+
/**
|
|
1285
|
+
* Discover card.
|
|
1286
|
+
*
|
|
1287
|
+
* @since 0.0.1
|
|
1288
|
+
*/
|
|
1289
|
+
Discover = "DISCOVER",
|
|
1290
|
+
/**
|
|
1291
|
+
* Discover Diners card.
|
|
1292
|
+
*
|
|
1293
|
+
* @since 0.0.1
|
|
1294
|
+
*/
|
|
1295
|
+
DiscoverDiners = "DISCOVER_DINERS",
|
|
1296
|
+
/**
|
|
1297
|
+
* JCB card.
|
|
1298
|
+
*
|
|
1299
|
+
* @since 0.0.1
|
|
1300
|
+
*/
|
|
1301
|
+
Jcb = "JCB",
|
|
1302
|
+
/**
|
|
1303
|
+
* UnionPay card.
|
|
1304
|
+
*
|
|
1305
|
+
* @since 0.0.1
|
|
1306
|
+
*/
|
|
1307
|
+
UnionPay = "UNION_PAY",
|
|
1308
|
+
/**
|
|
1309
|
+
* Interac card.
|
|
1310
|
+
*
|
|
1311
|
+
* @since 0.0.1
|
|
1312
|
+
*/
|
|
1313
|
+
Interac = "INTERAC",
|
|
1314
|
+
/**
|
|
1315
|
+
* Eftpos card.
|
|
1316
|
+
*
|
|
1317
|
+
* @since 0.0.1
|
|
1318
|
+
*/
|
|
1319
|
+
Eftpos = "EFTPOS",
|
|
1320
|
+
/**
|
|
1321
|
+
* Other or unknown card brand.
|
|
1322
|
+
*
|
|
1323
|
+
* @since 0.0.1
|
|
1324
|
+
*/
|
|
1325
|
+
Other = "OTHER"
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* @since 0.0.1
|
|
1329
|
+
*/
|
|
1330
|
+
export interface PermissionStatus {
|
|
1331
|
+
/**
|
|
1332
|
+
* Permission state for accessing location.
|
|
1333
|
+
*
|
|
1334
|
+
* Required to confirm that payments are occurring in a supported Square location.
|
|
1335
|
+
*
|
|
1336
|
+
* @since 0.0.1
|
|
1337
|
+
*/
|
|
1338
|
+
location: PermissionState;
|
|
1339
|
+
/**
|
|
1340
|
+
* Permission state for recording audio.
|
|
1341
|
+
*
|
|
1342
|
+
* Required to receive data from magstripe readers.
|
|
1343
|
+
*
|
|
1344
|
+
* Only available on Android.
|
|
1345
|
+
*
|
|
1346
|
+
* @since 0.0.1
|
|
1347
|
+
*/
|
|
1348
|
+
recordAudio?: PermissionState;
|
|
1349
|
+
/**
|
|
1350
|
+
* Permission state for Bluetooth connect.
|
|
1351
|
+
*
|
|
1352
|
+
* Required to receive data from contactless and chip readers.
|
|
1353
|
+
*
|
|
1354
|
+
* Only available on Android.
|
|
1355
|
+
*
|
|
1356
|
+
* @since 0.0.1
|
|
1357
|
+
*/
|
|
1358
|
+
bluetoothConnect?: PermissionState;
|
|
1359
|
+
/**
|
|
1360
|
+
* Permission state for Bluetooth scan.
|
|
1361
|
+
*
|
|
1362
|
+
* Required to store information during checkout.
|
|
1363
|
+
*
|
|
1364
|
+
* Only available on Android.
|
|
1365
|
+
*
|
|
1366
|
+
* @since 0.0.1
|
|
1367
|
+
*/
|
|
1368
|
+
bluetoothScan?: PermissionState;
|
|
1369
|
+
/**
|
|
1370
|
+
* Permission state for reading phone state.
|
|
1371
|
+
*
|
|
1372
|
+
* Required to identify the device sending information to Square servers.
|
|
1373
|
+
*
|
|
1374
|
+
* Only available on Android.
|
|
1375
|
+
*
|
|
1376
|
+
* @since 0.0.1
|
|
1377
|
+
*/
|
|
1378
|
+
readPhoneState?: PermissionState;
|
|
1379
|
+
/**
|
|
1380
|
+
* Permission state for using Bluetooth.
|
|
1381
|
+
*
|
|
1382
|
+
* Only available on iOS.
|
|
1383
|
+
*
|
|
1384
|
+
* @since 0.0.1
|
|
1385
|
+
*/
|
|
1386
|
+
bluetooth?: PermissionState;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* @since 0.0.1
|
|
1390
|
+
*/
|
|
1391
|
+
export declare type CurrencyCode = string;
|
|
1392
|
+
/**
|
|
1393
|
+
* @since 0.0.1
|
|
1394
|
+
*/
|
|
1395
|
+
export declare enum ErrorCode {
|
|
1396
|
+
/**
|
|
1397
|
+
* The location ID is missing.
|
|
1398
|
+
*
|
|
1399
|
+
* @since 0.0.1
|
|
1400
|
+
*/
|
|
1401
|
+
LocationIdMissing = "LOCATION_ID_MISSING",
|
|
1402
|
+
/**
|
|
1403
|
+
* The access token is missing.
|
|
1404
|
+
*
|
|
1405
|
+
* @since 0.0.1
|
|
1406
|
+
*/
|
|
1407
|
+
AccessTokenMissing = "ACCESS_TOKEN_MISSING",
|
|
1408
|
+
/**
|
|
1409
|
+
* The serial number is missing.
|
|
1410
|
+
*
|
|
1411
|
+
* @since 0.0.1
|
|
1412
|
+
*/
|
|
1413
|
+
SerialNumberMissing = "SERIAL_NUMBER_MISSING",
|
|
1414
|
+
/**
|
|
1415
|
+
* The payment parameters are missing.
|
|
1416
|
+
*
|
|
1417
|
+
* @since 0.0.1
|
|
1418
|
+
*/
|
|
1419
|
+
PaymentParametersMissing = "PAYMENT_PARAMETERS_MISSING",
|
|
1420
|
+
/**
|
|
1421
|
+
* The prompt parameters are missing.
|
|
1422
|
+
*
|
|
1423
|
+
* @since 0.0.1
|
|
1424
|
+
*/
|
|
1425
|
+
PromptParametersMissing = "PROMPT_PARAMETERS_MISSING",
|
|
1426
|
+
/**
|
|
1427
|
+
* The amount money is missing.
|
|
1428
|
+
*
|
|
1429
|
+
* @since 0.0.1
|
|
1430
|
+
*/
|
|
1431
|
+
AmountMoneyMissing = "AMOUNT_MONEY_MISSING",
|
|
1432
|
+
/**
|
|
1433
|
+
* The payment attempt ID is missing.
|
|
1434
|
+
*
|
|
1435
|
+
* @since 0.0.1
|
|
1436
|
+
*/
|
|
1437
|
+
PaymentAttemptIdMissing = "PAYMENT_ATTEMPT_ID_MISSING",
|
|
1438
|
+
/**
|
|
1439
|
+
* The SDK is not initialized.
|
|
1440
|
+
*
|
|
1441
|
+
* @since 0.0.1
|
|
1442
|
+
*/
|
|
1443
|
+
NotInitialized = "NOT_INITIALIZED",
|
|
1444
|
+
/**
|
|
1445
|
+
* The SDK is not authorized.
|
|
1446
|
+
*
|
|
1447
|
+
* @since 0.0.1
|
|
1448
|
+
*/
|
|
1449
|
+
NotAuthorized = "NOT_AUTHORIZED",
|
|
1450
|
+
/**
|
|
1451
|
+
* A pairing process is already in progress.
|
|
1452
|
+
*
|
|
1453
|
+
* @since 0.0.1
|
|
1454
|
+
*/
|
|
1455
|
+
PairingAlreadyInProgress = "PAIRING_ALREADY_IN_PROGRESS",
|
|
1456
|
+
/**
|
|
1457
|
+
* No payment is in progress.
|
|
1458
|
+
*
|
|
1459
|
+
* @since 0.0.1
|
|
1460
|
+
*/
|
|
1461
|
+
NoPaymentInProgress = "NO_PAYMENT_IN_PROGRESS",
|
|
1462
|
+
/**
|
|
1463
|
+
* Reader not found.
|
|
1464
|
+
*
|
|
1465
|
+
* @since 0.0.1
|
|
1466
|
+
*/
|
|
1467
|
+
ReaderNotFound = "READER_NOT_FOUND"
|
|
1468
|
+
}
|