If you are using CocoaPods, update your Podfile:
pod 'StripeTerminal', '1.0.0-rc1'
DiscoveryConfiguration
The initializers for DiscoveryConfiguration have changed. Rather than specifying a readerSimulator
device type, you can now specify that the configuration is simulated
. This allows for the SDK to simulate all device type and discovery method combinations. The readerSimulator
device type has been removed.
Previously, the init(deviceType:method:)
was nullable, and would return nil if an invalid device type and discovery method combination was provided. That method has been replaced with init(deviceType:discoveryMethod:simulator:)
, which is no longer nullable. If an invalid device type and discovery method combination is provided, the subsequent call to discoverReaders
will fail with SCPErrorInvalidDiscoveryConfiguration
.
PaymentMethods
This release uses PaymentMethods instead of Sources. They're similar concepts, but it means we've shuffled things around. In b6 (and earlier), a Source
would be added to your PaymentIntent
during Terminal.confirmPaymentIntent()
, or a standalone card_present
Source
could be created via Terminal.readSource()
.
Terminal.processPayment()
The Terminal.confirmPaymentIntent()
method has been replaced by Terminal.processPayment()
. In this flow, the CardPresentSource
class has been replaced by CardPresentDetails
:
- The returned
PaymentIntent
no longer has aCardPresentSource
property. Instead, find theCardPresentDetails
object on theCharge
(s) inPaymentIntent.charges
. - Each
Charge
has aPaymentMethodDetails
object, with transaction-specific details about the payment method used. For the StripeTerminal SDKcollectPaymentMethod
&processPayment
flow, thesePaymentMethodDetails
will be oftype == .cardPresent
, and theircardPresent
property has theCardPresentDetails
. - The
CardPresentSource.stripeId
,CardPresentSource.metadata
, andCardPresentSource.name
properties are not available onCardPresentDetails
. CardPresentSource.receiptData
is nowCardPresentDetails.receipt
, and the class name has changed fromReceiptData
toReceiptDetails
.
There are a couple other misc related changes:
- The
PaymentIntentStatusRequiresSource
status has been renamedPaymentIntentStatusRequiresPaymentMethod
. - The
ReceiptDetails.mid
andReceiptDetails.tid
properties have been removed.
Terminal.readReusableCard()
The Terminal.readSource()
method has been replaced by Terminal.readReusableCard()
. A successful readReusableCard
call returns a PaymentMethod
instead of a CardPresentSource
.
The returned payment method is of type == .card
, instead of cardPresent
. It's no longer necessary to convert the payment method first, these PaymentMethod
s are immediately usable for online charges, and can be reused.
Properties from the CardPresentSource
are now found either on the top-level PaymentMethod
(ex: stripeId
), or inside the PaymentMethod
's card: CardDetails
property (ex: brand
or fingerprint
).
Unexpected reader disconnects
The terminal:didDisconnectUnexpectedlyFromReader:
method has been renamed terminal:didReportUnexpectedReaderDisconnect:
, and is now required. Your app should handle this method, and notify your user that the reader has disconnected. You may also want to start the discoverReaders
process when your app handles this method. Your app can automatically attempt to discover and connect to the previously connected reader, or display UI for your user to re-connect to a reader.
Reader Update API
The terminal:checkForReaderSoftwareUpdate
has been renamed and split into two calls: terminal:checkForUpdate
and terminal:installUpdate
. Instead of calling terminal:checkForReaderSoftwareUpdate
and receiving the update via readerSoftwareUpdateDelegate:readerSoftwareUpdateAvailable
, terminal:checkForUpdate
accepts a completion which is passed the update if one is available. Once you have an update you will have to call terminal:installUpdate
. We are deprecating readerSoftwareUpdateDelegate:didCompleteReaderSoftwareUpdate
. Instead you will pass a completion to terminal:installUpdate
which will be passed nil upon successful completion and an error otherwise.
Other changes
- The SDK will now request location permissions from the user when your app connects to a reader for the first time. (Feedback from #26)
- We've fixed issues where
connectReader
took a long time under certain conditions. - Bugfix: In some situations, the
completion:
blocks forcollectPaymentMethod
andreadSource
could execute more than once: reporting a failure followed by a success #28. - Added a
hasTokenProvider
getter, in case you want to check whether you've set a token provider before accessing theshared
Terminal singleton. (Feedback from #26)