# Terminal SDK 移行ガイド Stripe Terminal SDK (バージョン 5.0.0) への移行方法を解説します。 Stripe Terminal iOS SDK および Android SDK が更新され、API と動作への重要な変更がいくつか行われました。その一部については Stripe Terminal SDK のシステムアップグレードが必要になります。Stripe は、SDK 間の一貫性を向上させ、アプリケーションロジックとシステムを効率化するために、定期的にメジャーバージョンの更新を行い、システムの機能や動作に影響を与える変更を加えています。このガイドでは、システムのアップグレードに関わる最新の変更について解説します。 > 新しい Stripe Terminal の導入を構築する場合は、[導入を設計する](https://docs.stripe.com/terminal/designing-integration.md)ページをご参照ください。 ## バージョン 5.0.0 への移行 Stripe Terminal iOS および Android の SDK バージョン 5.0.0 に関する変更点は、以下のとおりです。 - シンプルな決済統合 - 収集する手順と確定する手順を組み合わせた 1 回のメソッド呼び出しで、決済、セットアップインテント、返金を処理します。 - Swift の最新非同期バリアントと Kotlin Coroutines をサポートし、複雑な非同期フローを簡素化 - iOS では Swift の並行処理 (async/await)、Android では Kotlin のコルーチン。 - 顧客キャンセルはデフォルトで有効 - サポート対象のリーダーでは、顧客は決済、セットアップ、返金、データ収集フロー中にデフォルトで取引をキャンセルできるようになりました。 - モバイルリーダーと Tap to Pay リーダーの自動再接続の可観測性の向上 - モバイルリーダー (Bluetooth および USB) および Tap to Pay リーダーの接続ステータスの状態を増やし、リーダーの自動再接続処理を強化。 - Android の Tap to Pay の Discover カード受け付けサポート (公開プレビュー) - Android の Tap to Pay で Discover カード決済を受け付けます。 - iOS 14.0 から iOS 15.0 へのミニマムサポートプラットフォームバージョンの更新 # iOS > This is a iOS for when terminal-sdk-platform is ios. View the full page at https://docs.stripe.com/terminal/references/sdk-migration-guide?terminal-sdk-platform=ios. アプリケーションで現在 5.0.0 より前のバージョンの Terminal iOS SDK を使用している場合は、アップグレードするためにいくつかの変更を行う必要があります。バージョン 4.x から 5.0.0 への変更の詳細なリストについては、[SDK 変更ログ](https://github.com/stripe/stripe-terminal-ios/blob/master/CHANGELOG.md)を参照してください。 ## iOS 15 以降のミニマムサポートバージョンに関する更新 Stripe は、開発者サポート業務を効率化するために SDK のミニマムサポートバージョンを定期的に更新しています。 現行の Terminal iOS SDK バージョン 4.X は、引き続き *iOS 14* 以降で動作するデバイスをサポートします。 ## シンプルな決済統合 ### 統合決済処理への更新 v5 SDK には、収集するステップと確定するステップを 1 つの操作に統合するメソッドが含まれています。既存の `collectPaymentMethod` メソッドと `confirmPaymentIntent` メソッドは引き続き機能しますが、よりシンプルな統合には統合メソッドの使用をお勧めします。 #### processPaymentIntent で決済を処理する 2 ステップの収集と確定を、1 つの `processPaymentIntent` メソッド呼び出しに置き換えます。 _導入前 _ #### Swift ```swift // Step 1: Collect payment method Terminal.shared.collectPaymentMethod(paymentIntent, collectConfig: collectConfig) { collectedPaymentIntent, collectError in guard let collectedPaymentIntent = collectedPaymentIntent else { // Payment method collection failed return } // Step 2: Confirm the payment Terminal.shared.confirmPaymentIntent(collectedPaymentIntent) { confirmedPaymentIntent, confirmError in if let confirmedPaymentIntent = confirmedPaymentIntent { // Payment successful } else { // Payment confirmation failed } } } ``` *導入後* #### Swift ```swift // Process and confirm the payment in one step Terminal.shared.processPaymentIntent(paymentIntent, collectConfig: collectConfig) { processedPaymentIntent, processError in if let processedPaymentIntent = processedPaymentIntent { // Payment successful } else { // Payment failed } } ``` #### processRefund で返金を処理する `collectRefundPaymentMethod` メソッドと `confirmRefund` メソッドは非推奨になりました。代わりに `processRefund` を使用してください。 _導入前 _ #### Swift ```swift // Step 1: Collect refund payment method Terminal.shared.collectRefundPaymentMethod(refundParams) { collectError in guard collectError == nil else { // Refund collection failed return } // Step 2: Confirm the refund Terminal.shared.confirmRefund { refund, confirmError in if let refund = refund { // Refund successful } else { // Refund confirmation failed } } } ``` *導入後* #### Swift ```swift // Process the refund in one step Terminal.shared.processRefund(refundParams) { refund, refundError in if let refund = refund { // Refund successful } else { // Refund failed } } ``` #### processSetupIntent を使用してセットアップインテントを処理する 2 ステップの収集と確定を、1 つの `processSetupIntent` メソッド呼び出しに置き換えます。 _導入前 _ #### Swift ```swift // Step 1: Collect setup intent payment method Terminal.shared.collectSetupIntentPaymentMethod(setupIntent, customerConsentCollected: true) { collectedSetupIntent, collectError in guard let collectedSetupIntent = collectedSetupIntent else { // Setup intent collection failed return } // Step 2: Confirm the setup intent Terminal.shared.confirmSetupIntent(collectedSetupIntent) { confirmedSetupIntent, confirmError in if let confirmedSetupIntent = confirmedSetupIntent { // Setup intent successful } else { // Setup intent confirmation failed } } } ``` *導入後* #### Swift ```swift // Configure with allowRedisplay let config = try CollectSetupIntentConfigurationBuilder() .setAllowRedisplay(.always) .build() // Process the setup intent in one step Terminal.shared.processSetupIntent(setupIntent, collectConfig: config) { processedSetupIntent, setupError in if let processedSetupIntent = processedSetupIntent { // Setup intent successful } else { // Setup intent failed } } ``` ### Swift 非同期バリアントサポート SDK は Terminal メソッドに非同期バリアントを提供するようになりました。補完ハンドラを入れ子にする代わりに、よりすっきりとした連続的なコードを作成できます。 _導入前 _ ```swift let cancelable = Terminal.shared.collectPaymentMethod(paymentIntent, collectConfig: collectConfig) { collectedPaymentIntent, collectError in guard let collectedPaymentIntent = collectedPaymentIntent else { // Payment method collection failed return } Terminal.shared.confirmPaymentIntent(collectedPaymentIntent) { confirmedPaymentIntent, confirmError in // Handle confirmation } } ``` *導入後* ```swift let collectTask = Task { do { let collectedIntent = try await Terminal.shared.collectPaymentMethod(paymentIntent, collectConfig: collectConfig) let confirmedIntent = try await Terminal.shared.confirmPaymentIntent(collectedIntent) // Payment successful } catch { // Handle error } } // Use collectTask.cancel() to cancel the operation when needed ``` ## プラットフォームと初期化 ### Terminal 初期化の更新 `setTokenProvider` メソッドは削除されました。`Terminal.shared` シングルトンにアクセスする前に、静的な `Terminal.initWithTokenProvider(_tokenProvider:)` メソッドを使用して SDK を初期化する必要があります。 _導入前 _ #### Swift ```swift // In your AppDelegate or scene delegate Terminal.setTokenProvider(yourTokenProvider) ``` *導入後* #### Swift ```swift // In your AppDelegate or scene delegate, at app launch Terminal.initWithTokenProvider(yourTokenProvider) ``` ## リーダーの検出と接続 ### DiscoveryConfiguration 初期化の更新 `DiscoveryConfiguration` オブジェクトを `init` または `new` で直接初期化できなくなりました。関連するビルダークラスを使用する必要があります。 _導入前 _ #### Swift ```swift let config = SCPInternetDiscoveryConfiguration(isSimulated: true) ``` *導入後* #### Swift ```swift let config = InternetDiscoveryConfiguration.Builder() .setSimulated(true) .build() ``` ### 再接続ステータス変更の処理 新しい `.reconnecting` 値が `ConnectionStatus` 列挙型に追加されました。再接続中は、再接続が成功するまで `Terminal.shared.connectedReader` は `nil` になります。 _導入前 _ #### Swift ```swift func terminal(_ terminal: Terminal, didChange connectionStatus: ConnectionStatus) { switch connectionStatus { case .notConnected: // Handle not connected case .connected: // Handle connected @unknown default: break } } ``` *導入後* #### Swift ```swift func terminal(_ terminal: Terminal, didChange connectionStatus: ConnectionStatus) { switch connectionStatus { case .notConnected: // Handle not connected case .connected: // Handle connected case .reconnecting: // Handle reconnection in progress @unknown default: break } } ``` ### easyConnect による効率的な接続 iOS SDK 5.1 以降を使用したスマートリーダーと Tap to Pay の実装では、検出と接続を 1 つのメソッド呼び出しにまとめた `Terminal.shared.easyConnect` を使用できるようになりました。 _導入前 _ #### Swift ```swift // Step 1: Discover the reader Terminal.shared.discoverReaders(config, delegate: discoveryDelegate) { error in if let error = error { // Handle discovery error } } // In your DiscoveryDelegate func terminal(_ terminal: Terminal, didUpdateDiscoveredReaders readers: [Reader]) { guard let selectedReader = readers.first else { return } // Step 2: Connect to the reader Terminal.shared.connectReader(selectedReader, connectionConfig: connectionConfig) { reader, error in if let reader = reader { // Handle successful connection } else if let error = error { // Handle connection error } } } ``` *導入後* #### Swift ```swift // Discover and connect in one step by providing discovery filter let discoveryConfig = try InternetDiscoveryConfigurationBuilder() .setLocationId("tml_1234567890") // optional, specify your location ID .setDiscoveryFilter(.bySerial("YOUR-READER-SERIAL-NUMBER")) .build() let connectionConfig = try InternetConnectionConfigurationBuilder() .setFailIfInUse(false) .build() let easyConnectConfig = InternetEasyConnectConfiguration( discoveryConfiguration: discoveryConfig, connectionConfiguration: connectionConfig ) Terminal.shared.easyConnect( easyConnectConfig, delegate: internetReaderDelegate ) { reader, error in if let reader = reader { // Handle successful connection } else if let error = error { // Handle failure } } ``` ### インターネットリーダーの検出フィルタリング インターネットリーダーの検出で、リーダー ID またはシリアル番号によるフィルタリングがサポートされるようになりました。特定のリーダーを検出するには、`InternetDiscoveryConfigurationBuilder` の `discoveryFilter` プロパティを設定します。 _導入前 _ #### Swift ```swift let config = InternetDiscoveryConfigurationBuilder() .setLocationId("tml_1234567890") .build() ``` *導入後* #### Swift ```swift let config = try InternetDiscoveryConfigurationBuilder() .setLocationId("tml_1234567890") // optional .setDiscoveryFilter(.bySerial("READER-SERIAL-NUMBER")) // or .byReaderId("tmr_YOUR-READER-STRIPE-ID") to filter by reader id .build() ``` ## 決済の受け付けとデータ収集 ### 顧客キャンセルがデフォルトで有効になりました サポート対象のリーダーでは、顧客が取引をキャンセルする機能が *デフォルトで有効* になりました。`customerCancellation` プロパティは `Bool` から新しい `SCPCustomerCancellation` 列挙型に変更されました。 _導入前 _ #### Swift ```swift let collectConfig = try CollectConfigurationBuilder() .setEnableCustomerCancellation(false) .build() ``` *導入後* #### Swift ```swift let collectConfig = try CollectPaymentIntentConfigurationBuilder() .setCustomerCancellation(.disableIfAvailable) .build() ``` ### Interac 返金パラメーターの更新 PaymentIntent ID を使用して Interac 返金の `SCPRefundParameters` を作成する場合は、PaymentIntent の `clientSecret` も渡す必要があります。`clientSecret` を必要としない請求 ID を引き続き使用することもできます。 _導入前 _ #### Swift ```swift let refundParams = try RefundParametersBuilder( paymentIntentId: "pi_123", amount: 1000, currency: "cad" ).build() ``` *導入後* #### Swift ```swift let refundParams = try RefundParametersBuilder( paymentIntentId: "pi_123", clientSecret: "pi_123_secret_abc", amount: 1000, currency: "cad" ).build() ``` # Android > This is a Android for when terminal-sdk-platform is android. View the full page at https://docs.stripe.com/terminal/references/sdk-migration-guide?terminal-sdk-platform=android. アプリケーションで現在 5.0.0 より前のバージョンの Terminal Android SDK を使用している場合は、アップグレードするためにいくつかの変更を行う必要があります。バージョン 4.x から 5.0.0 への変更の詳細なリストについては、[SDK 変更ログ](https://github.com/stripe/stripe-terminal-android/blob/master/CHANGELOG.md)を参照してください。 ## シンプルな決済統合 ### 統合決済処理への更新 v5 SDK では、収集するステップと確定するステップを 1 つの操作に統合する効率的な方法が導入されています。既存の `collectPaymentMethod` メソッドと `confirmPaymentIntent` メソッドは引き続き機能しますが、よりシンプルな統合には新しい統合メソッドの使用をお勧めします。 #### processPaymentIntent で決済を処理する 2 ステップの収集と確定を、1 つの `processPaymentIntent` メソッド呼び出しに置き換えます。 _導入前 _ #### Kotlin ```kotlin // Step 1: Collect payment method Terminal.getInstance().collectPaymentMethod( paymentIntent, collectConfig, object : PaymentIntentCallback { override fun onSuccess(paymentIntent: PaymentIntent) { // Step 2: Confirm the payment Terminal.getInstance().confirmPaymentIntent(paymentIntent, object : PaymentIntentCallback { override fun onSuccess(confirmedPaymentIntent: PaymentIntent) { // Payment successful } override fun onFailure(e: TerminalException) { // Payment confirmation failed } }) } override fun onFailure(e: TerminalException) { // Payment method collection failed } } ) ``` *導入後* #### Kotlin ```kotlin // Process and confirm the payment in one step Terminal.getInstance().processPaymentIntent( paymentIntent, collectConfig, confirmConfig, object : PaymentIntentCallback { override fun onSuccess(paymentIntent: PaymentIntent) { // Payment successful } override fun onFailure(e: TerminalException) { // Payment failed } } ) ``` #### processRefund で返金を処理する `collectRefundPaymentMethod` メソッドと `confirmRefund` メソッドは非推奨になりました。代わりに `processRefund` を使用してください。 _導入前 _ #### Kotlin ```kotlin // Step 1: Collect refund payment method val refundParams = RefundParameters.ByChargeId( id = "ch_123", amount = 1000L, currency = "cad" ).build() Terminal.getInstance().collectRefundPaymentMethod( refundParams, object : Callback { override fun onSuccess() { // Step 2: Confirm the refund Terminal.getInstance().confirmRefund(object : RefundCallback { override fun onSuccess(refund: Refund) { // Refund successful } override fun onFailure(e: TerminalException) { // Refund confirmation failed } }) } override fun onFailure(e: TerminalException) { // Refund collection failed } } ) ``` *導入後* #### Kotlin ```kotlin val refundParams = RefundParameters.ByChargeId( id = "ch_123", amount = 1000, currency = "cad" ).build() // Process the refund in one step Terminal.getInstance().processRefund( refundParams, object : RefundCallback { override fun onSuccess(refund: Refund) { // Refund successful } override fun onFailure(e: TerminalException) { // Refund failed } } ) ``` #### processSetupIntent を使用してセットアップインテントを処理する 2 ステップの収集と確定を、1 つの `processSetupIntent` メソッド呼び出しに置き換えます。 _導入前 _ #### Kotlin ```kotlin // Step 1: Collect setup intent payment method Terminal.getInstance().collectSetupIntentPaymentMethod( intent = setupIntent, allowRedisplay = AllowRedisplay.ALWAYS, callback = object : SetupIntentCallback { override fun onSuccess(setupIntent: SetupIntent) { // Step 2: Confirm the setup intent Terminal.getInstance().confirmSetupIntent(setupIntent, object : SetupIntentCallback { override fun onSuccess(confirmedSetupIntent: SetupIntent) { // Setup intent successful } override fun onFailure(e: TerminalException) { // Setup intent confirmation failed } }) } override fun onFailure(e: TerminalException) { // Setup intent collection failed } } ) ``` *導入後* #### Kotlin ```kotlin // Configure with allowRedisplay val config = CollectSetupIntentConfiguration.Builder() .build() // Process the setup intent in one step Terminal.getInstance().processSetupIntent( intent = setupIntent, allowRedisplay = AllowRedisplay.ALWAYS, collectConfig = config, callback = object : SetupIntentCallback { override fun onSuccess(setupIntent: SetupIntent) { // Setup intent successful } override fun onFailure(e: TerminalException) { // Setup intent failed } } ) ``` ### Kotlin Coroutines サポート Kotlin 開発者向けには、新しいオプションモジュール `stripeterminal-ktx` が非同期 Terminal API の `suspend` 関数ラッパーを提供します。 > 次の依存関係を追加します: `implementation("com.stripe:stripeterminal-ktx:5.0.0")` _導入前 _ ```kotlin Terminal.getInstance().discoverReaders(config, object : DiscoveryListener { override fun onUpdateDiscoveredReaders(readers: List) { val selectedReader = readers[0] Terminal.getInstance().connectReader(selectedReader, connectionConfig, object : ReaderCallback { override fun onSuccess(reader: Reader) { // Handle successful connection } override fun onFailure(e: TerminalException) { // Handle connection failure } }) } }) ``` *導入後* ```kotlin // Add dependency: implementation("com.stripe:stripeterminal-ktx:5.0.0") coroutineScope { try { val readers = Terminal.getInstance().discoverReaders(discoveryConfig) .filter { it.isNotEmpty() } .first() val selectedReader = readers.first() val reader = Terminal.getInstance().connectReader(selectedReader, connectConfig) // Handle successful connection } catch(e: TerminalException) { // Handle failures on discovery or connect } } ``` ## プラットフォームと初期化 ### Terminal 初期化の更新 `Terminal.initTerminal` メソッドの名前が `Terminal.init` に変更されました。null 可能な `OfflineListener` パラメーターが必要になりました。 _導入前 _ #### Kotlin ```kotlin Terminal.initTerminal(applicationContext, LogLevel.VERBOSE, tokenProvider, terminalListener) ``` *導入後* #### Kotlin ```kotlin Terminal.init(applicationContext, LogLevel.VERBOSE, tokenProvider, terminalListener, offlineListener) ``` ## リーダーの検出と接続 ### 再接続ステータス変更の処理 新しい `RECONNECTING` 値が `ConnectionStatus` 列挙型に追加されました。最初の接続時に `Terminal.getInstance().getConnectedReader()` は、接続が成功するまで `null` になります。 _導入前 _ #### Kotlin ```kotlin override fun onConnectionStatusChange(status: ConnectionStatus) { when (status) { ConnectionStatus.NOT_CONNECTED -> { // Handle not connected } ConnectionStatus.CONNECTED -> { // Handle connected } } } ``` *導入後* #### Kotlin ```kotlin override fun onConnectionStatusChange(status: ConnectionStatus) { when (status) { ConnectionStatus.NOT_CONNECTED -> { // Handle not connected } ConnectionStatus.CONNECTED -> { // Handle connected } ConnectionStatus.RECONNECTING -> { // Handle reconnection in progress } } } ``` ### easyConnect による効率的な接続 スマートリーダー、Tap to Pay、および Apps on Devices の統合では、検出と接続を 1 つのメソッド呼び出しにまとめた `Terminal.easyConnect` を使用できるようになりました。 _導入前 _ #### Kotlin ```kotlin // Step 1: Discover the reader Terminal.getInstance().discoverReaders(config, object : DiscoveryListener { override fun onUpdateDiscoveredReaders(readers: List) { val selectedReader = readers[0] // Step 2: Connect to the reader Terminal.getInstance().connectReader(selectedReader, connectionConfig, readerCallback) } }) ``` *導入後* #### Kotlin ```kotlin // Discover and connect in one step by providing discovery filter val easyConnectConfig = InternetEasyConnectConfiguration( discoveryConfiguration = DiscoveryConfiguration.InternetDiscoveryConfiguration( location = "YOUR-LOCATION-ID", // optional discoveryFilter = DiscoveryFilter.BySerial("YOUR-READER-SERIAL-NUMBER"), ), connectionConfiguration = ConnectionConfiguration.InternetConnectionConfiguration( internetReaderListener = internetReaderListener, ) ) Terminal.getInstance().easyConnect( easyConnectConfig, object : ReaderCallback { override fun onSuccess(reader: Reader) { // Handle successful connection } override fun onFailure(e: TerminalException) { // Handle failure } } ) ``` ### インターネットリーダーの検出フィルタリング インターネットリーダーの検出で、リーダー ID またはシリアル番号によるフィルタリングがサポートされるようになりました。特定のリーダーを検出するには、`InternetDiscoveryConfiguration` の `discoveryFilter` プロパティを設定します。 _導入前 _ #### Kotlin ```kotlin val config = InternetDiscoveryConfiguration(location = "tml_1234567890") ``` *導入後* #### Kotlin ```kotlin val config = InternetDiscoveryConfiguration( location = "tml_1234567890", // optional discoveryFilter = DiscoveryFilter.BySerial("READER-SERIAL-NUMBER"), // or DiscoveryFilter.ByReaderId("tmr_YOUR-READER-STRIPE-ID) to filter by reader id ) ``` ## 決済の受け付けとデータ収集 ### 顧客キャンセルがデフォルトで有効になりました Android ベースのリーダーでは、顧客が取引をキャンセルする機能が *デフォルトで有効* になりました。この機能を無効にするには、`customerCancellation` を `DISABLE_IF_AVAILABLE` に設定します。 _導入前 _ #### Kotlin ```kotlin val config = CollectConfiguration.Builder() .setEnableCustomerCancellation(false) .build() ``` *導入後* #### Kotlin ```kotlin val config = CollectPaymentIntentConfiguration.Builder() .setCustomerCancellation(CustomerCancellation.DISABLE_IF_AVAILABLE) .build() ``` ### Interac 返金パラメーターの更新 PaymentIntent ID を使用して Interac 返金の `RefundParameters` を作成する場合は、PaymentIntent の `clientSecret` も渡す必要があります。`clientSecret` を必要としない請求 ID を引き続き使用することもできます。 _導入前 _ #### Kotlin ```kotlin val refundParams = RefundParameters.Builder( RefundParameters.Id.PaymentIntent("pi_123"), 1000, "cad" ).build() ``` *導入後* #### Kotlin ```kotlin val refundParams = RefundParameters.ByPaymentIntentId( paymentIntentId = "pi_123", clientSecret = "pi_123_secret_abc", amount = 1000, currency = "cad" ).build() ``` ## Apps on Devices 実装を更新する Apps on Devices 機能の Maven 座標が `com.stripe:stripeterminal-appsondevices:5.0.0` に変更されました。ビルドの依存関係を更新して、新しいアーティファクト名を指定してください。Stripe は以前の `handoffclient` アーティファクトを更新しなくなります。 機能をより適切に説明するために、すべての `Handoff` クラス名を `AppsOnDevices` に変更しました。 _導入前 _ #### Kotlin ```kotlin dependencies { implementation("com.stripe:stripeterminal-handoffclient:4.0.0") } ``` *導入後* #### Kotlin ```kotlin dependencies { implementation("com.stripe:stripeterminal-appsondevices:5.0.0") } ``` ### Handoff クラスを AppsOnDevices に名前変更する 検出設定、接続設定、リスナー、トークンプロバイダーで、すべての `Handoff` クラス名が `AppsOnDevices` に変更されました。 _導入前 _ #### Kotlin ```kotlin val discoveryConfig = HandoffDiscoveryConfiguration() Terminal.getInstance().discoverReaders( discoveryConfig, object : DiscoveryListener { override fun onUpdateDiscoveredReaders(readers: List) { val reader = readers.first() val connectionConfig = HandoffConnectionConfiguration( handoffReaderListener = object : HandoffReaderListener { override fun onDisconnect(reason: DisconnectReason) { // Handle disconnect } } ) Terminal.getInstance().connectReader(reader, connectionConfig, readerCallback) } } ) val tokenProvider = HandoffConnectionTokenProvider() ``` *導入後* #### Kotlin ```kotlin val discoveryConfig = AppsOnDevicesDiscoveryConfiguration() Terminal.getInstance().discoverReaders( discoveryConfig, object : DiscoveryListener { override fun onUpdateDiscoveredReaders(readers: List) { val reader = readers.first() val connectionConfig = AppsOnDevicesConnectionConfiguration( appsOnDevicesListener = object : AppsOnDevicesListener { override fun onDisconnect(reason: DisconnectReason) { // Handle disconnect } } ) Terminal.getInstance().connectReader(reader, connectionConfig, readerCallback) } } ) val tokenProvider = AppsOnDevicesConnectionTokenProvider() ``` ## Android の Tap to Pay 統合に関する更新 ### システム要件 Android 5.0.0 以降でタッチ決済を行うには、Android 端末が Android 13 以上でなければなりません。 このバージョンでは、Android 端末の KeyStore がハードウェアで保護された鍵合意をサポートしている必要があります。この要件は `supportsReadersOfType()` という方法で自動的にチェックされます。または、端末の [`FEATURE_HARDWARE_KEYSTORE`](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_HARDWARE_KEYSTORE) のバージョンが 100 以上であることを確認することによっても検証できます。この要件は端末のハードウェア性能に依存するため、発売当初が Android 12 以下の端末では、たとえ Android 13にアップグレードされていても、この要件を満たせない可能性があります。この新しい要件により、Samsung Galaxy Tab Active4 Pro のような端末は SDK バージョン 5.0.0 以降ではサポート対象外になります。 本番環境では、デバイス上で開発者オプション、USB や Wi-Fi デバッグ、その他のデバッグオプションが有効になっている場合、リーダーの検出では `TAP_TO_PAY_INSECURE_ENVIRONMENT` エラーが発生します。これは、シミュレートされた Tap to Pay リーダーには該当しません。 ### TapZone 設定のリファクタリング `TapToPayUxConfiguration.TapZone` クラスはリファクタリングされました。`indicator` フィールドと `position` フィールドは 1 つの `TapZone` オブジェクトに置き換えられました。 _導入前 _ #### Kotlin ```kotlin val config = TapToPayUxConfiguration.Builder() .setTapZone( indicator = TapZoneIndicator.ABOVE, position = TapZonePosition.Manual(0.5f, 0.2f) ) .build() ``` *導入後* #### Kotlin ```kotlin // Position the tap zone above the reader UI val config = TapToPayUxConfiguration.Builder() .setTapZone(TapZone.Above(horizontalBias = 0.2f)) .build() // Or position it on the left side of the screen val config2 = TapToPayUxConfiguration.Builder() .setTapZone(TapZone.Left()) // Center vertically by default .build() ```