// Process and confirm the payment in one step
Terminal.getInstance().processPaymentIntent(
paymentIntent,
collectConfig,
confirmConfig,object: PaymentIntentCallback {overridefunonSuccess(paymentIntent: PaymentIntent){// Payment successful}overridefunonFailure(e: TerminalException){// Payment failed}})
val refundParams = RefundParameters.ByChargeId(
id ="ch_123",
amount =1000,
currency ="cad").build()// Process the refund in one step
Terminal.getInstance().processRefund(
refundParams,object: RefundCallback {overridefunonSuccess(refund: Refund){// Refund successful}overridefunonFailure(e: TerminalException){// Refund failed}})
overridefunonConnectionStatusChange(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
Java
No results
// Step 1: Discover the reader
Terminal.getInstance().discoverReaders(config,object: DiscoveryListener {overridefunonUpdateDiscoveredReaders(readers: List<Reader>){val selectedReader = readers[0]// Step 2: Connect to the reader
Terminal.getInstance().connectReader(selectedReader, connectionConfig, readerCallback)}})
導入後
Kotlin
Java
No results
// Discover and connect in one step by providing discovery filterval 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 {overridefunonSuccess(reader: Reader){// Handle successful connection}overridefunonFailure(e: TerminalException){// Handle failure}})
インターネットリーダーの検出フィルタリング
インターネットリーダーの検出で、リーダー ID またはシリアル番号によるフィルタリングがサポートされるようになりました。特定のリーダーを検出するには、InternetDiscoveryConfiguration の discoveryFilter プロパティを設定します。
_導入前 _
Kotlin
Java
No results
val config =InternetDiscoveryConfiguration(location ="tml_1234567890")
導入後
Kotlin
Java
No results
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)
本番環境では、デバイス上で開発者オプション、USB や Wi-Fi デバッグ、その他のデバッグオプションが有効になっている場合、リーダーの検出では TAP_TO_PAY_INSECURE_ENVIRONMENT エラーが発生します。これは、シミュレートされた Tap to Pay リーダーには該当しません。
TapZone 設定のリファクタリング
TapToPayUxConfiguration.TapZone クラスはリファクタリングされました。indicator フィールドと position フィールドは 1 つの TapZone オブジェクトに置き換えられました。
_導入前 _
Kotlin
Java
No results
val config = TapToPayUxConfiguration.Builder().setTapZone(
indicator = TapZoneIndicator.ABOVE,
position = TapZonePosition.Manual(0.5f,0.2f)).build()
導入後
Kotlin
Java
No results
// Position the tap zone above the reader UIval config = TapToPayUxConfiguration.Builder().setTapZone(TapZone.Above(horizontalBias =0.2f)).build()// Or position it on the left side of the screenval config2 = TapToPayUxConfiguration.Builder().setTapZone(TapZone.Left())// Center vertically by default.build()