@@ -140,6 +140,72 @@ public enum UnderlyingError: Error, Equatable {
140140
141141 /// There was no refund in progress to cancel
142142 case noRefundInProgress
143+
144+ // MARK: - Built-in reader related errors
145+
146+ /// The device must have a passcode in order to use the built-in reader
147+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorPasscodeNotEnabled
148+ case passcodeNotEnabled
149+
150+ /// The phone must have a signed-in iCloud account in order to accept the TOS for the built in reader.
151+ /// The signed-in account does not need to be the one used to connect the reader.
152+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderTOSAcceptanceRequiresiCloudSignIn
153+ case appleBuiltInReaderTOSAcceptanceRequiresiCloudSignIn
154+
155+ /// NFC is disabled on the device. This could be a permissions issue, in particular due to a device management profile.
156+ /// It's unlikely that the user can directly correct this issue
157+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorNFCDisabled
158+ case nfcDisabled
159+
160+ /// Preparing the built-in reader failed. This is a retriable error
161+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderFailedToPrepare
162+ case appleBuiltInReaderFailedToPrepare
163+
164+ /// The user cancelled the built-in reader Terms of Service acceptance
165+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderTOSAcceptanceCanceled
166+ case appleBuiltInReaderTOSAcceptanceCanceled
167+
168+ /// The built-in reader Terms of Service have not been accepted. This error is retriable
169+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderTOSNotYetAccepted
170+ case appleBuiltInReaderTOSNotYetAccepted
171+
172+ /// The built-in reader Terms of Service could not be accepted. This may indicate an issue with the Apple ID used.
173+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderTOSAcceptanceFailed
174+ case appleBuiltInReaderTOSAcceptanceFailed
175+
176+ /// This (Stripe) merchant account cannot be used with the built-in reader as it has been blocked
177+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderMerchantBlocked
178+ case appleBuiltInReaderMerchantBlocked
179+
180+ /// The merchant account is invalid and cannot be used with the built-in reader
181+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderInvalidMerchant
182+ case appleBuiltInReaderInvalidMerchant
183+
184+ /// The built-in reader on this device cannot be used because it has been banned
185+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorAppleBuiltInReaderDeviceBanned
186+ case appleBuiltInReaderDeviceBanned
187+
188+ /// The device does not meet the minimum requirements for using the built-in reader
189+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorUnsupportedMobileDeviceConfiguration
190+ case unsupportedMobileDeviceConfiguration
191+
192+ /// The built-in reader cannot be used while the app is in the background
193+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorReaderNotAccessibleInBackground
194+ case readerNotAccessibleInBackground
195+
196+ /// The built-in reader cannot be used during a phone call
197+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorCommandNotAllowedDuringCall
198+ case commandNotAllowedDuringCall
199+
200+ /// The amount charged was not supported by the reader.
201+ /// (This may be a different amount than the minimum for a payment with Stripe. There is a maximum too.)
202+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorInvalidAmount
203+ case invalidAmount
204+
205+ /// The currency used was not supported by the reader.
206+ /// The reader may support a different set of currencies than WCPay or Stripe.
207+ /// https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html#/c:@E@SCPError@SCPErrorInvalidCurrency
208+ case invalidCurrency
143209}
144210
145211extension UnderlyingError {
@@ -328,6 +394,61 @@ extension UnderlyingError: LocalizedError {
328394 return NSLocalizedString ( " Sorry, this refund could not be canceled " ,
329395 comment: " Error message shown when a refund could not be canceled (likely because " +
330396 " it had already completed) " )
397+
398+ // MARK: - Built-in reader errors
399+ case . passcodeNotEnabled:
400+ return NSLocalizedString ( " Your device needs a lock screen passcode set to use the built-in card reader " ,
401+ comment: " Error message shown when the built-in reader cannot be used because " +
402+ " the device does not have a passcode set. " )
403+ case . appleBuiltInReaderTOSAcceptanceRequiresiCloudSignIn:
404+ return NSLocalizedString ( " Please sign in to iCloud on this device, so you can use the built-in card reader " ,
405+ comment: " Error message shown when the built-in reader cannot be used because " +
406+ " the device is not signed in to iCloud. " )
407+ case . nfcDisabled:
408+ return NSLocalizedString ( " The app could not enable the card reader, because the NFC chip is disabled. " +
409+ " Please contact support for more details. " ,
410+ comment: " Error message shown when the built-in reader cannot be used because " +
411+ " the device's NFC chipset has been disabled by a device management policy. " )
412+ case . appleBuiltInReaderFailedToPrepare, . readerNotAccessibleInBackground:
413+ return NSLocalizedString ( " There was an issue preparing the built in reader for payment – please try again. " ,
414+ comment: " Error message shown when the built-in reader cannot be used because " +
415+ " there was some issue with the connection. Retryable. " )
416+ case . appleBuiltInReaderTOSAcceptanceCanceled, . appleBuiltInReaderTOSNotYetAccepted:
417+ return NSLocalizedString ( " Please try again, and accept Apple's Terms of Service, so you can use the " +
418+ " built-in card reader " ,
419+ comment: " Error message shown when the built-in reader cannot be used because " +
420+ " the merchant cancelled or did not complete the Terms of Service acceptance flow " )
421+ case . appleBuiltInReaderTOSAcceptanceFailed:
422+ return NSLocalizedString ( " Please check your Apple ID is valid, and then try again. A valid Apple ID is " +
423+ " required to accept Apple's Terms of Service " ,
424+ comment: " Error message shown when the built-in reader cannot be used because " +
425+ " the Terms of Service acceptance flow failed, possibly due to issues with " +
426+ " the Apple ID " )
427+ case . appleBuiltInReaderMerchantBlocked, . appleBuiltInReaderInvalidMerchant, . appleBuiltInReaderDeviceBanned:
428+ return NSLocalizedString ( " Please contact support – there was an issue connecting to the built-in reader " ,
429+ comment: " Error message shown when the built-in reader cannot be used because " +
430+ " there is an issue with the merchant account or device " )
431+ case . unsupportedMobileDeviceConfiguration:
432+ return NSLocalizedString ( " Please check that your phone meets these requirements: " +
433+ " iPhone XS or newer running iOS 16.0 or above. Contact support if this error " +
434+ " shows on a supported device. " ,
435+ comment: " Error message shown when the built-in reader cannot be used because " +
436+ " the device does not meet minimum requirements. " )
437+ case . commandNotAllowedDuringCall:
438+ return NSLocalizedString ( " The built-in reader cannot be used during a phone call. Please try again after " +
439+ " you finish your call " ,
440+ comment: " Error message shown when the built-in reader cannot be used because " +
441+ " there is a call in progress " )
442+ case . invalidAmount:
443+ return NSLocalizedString ( " The amount is not supported by the built in reader – please try a hardware " +
444+ " reader or another payment method. " ,
445+ comment: " Error message shown when the built-in reader cannot be used because " +
446+ " the amount for payment is not supported by the built in reader. " )
447+ case . invalidCurrency:
448+ return NSLocalizedString ( " The currency is not supported by the built in reader – please try a hardware " +
449+ " reader or another payment method. " ,
450+ comment: " Error message shown when the built-in reader cannot be used because " +
451+ " the currency for payment is not supported by the built in reader. " )
331452 }
332453 }
333454}
0 commit comments