# Technical Documentation

# Technical Documentation UCP SDK

Version 2.5.7

## UCP SDK Introduction

### Basic abbreviations and definitions

<table class="relative-table wrapped confluenceTable" id="bkmrk-field-description-cd"><tbody><tr><th class="confluenceTh mceSelected align-center">**Field**</th><th class="confluenceTh mceSelected align-center">**Description**</th></tr><tr><td class="confluenceTd mceSelected" colspan="1">CDCVM</td><td class="confluenceTd mceSelected" colspan="1">Consumer Device Cardholder Verification Method</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">CVM</td><td class="confluenceTd mceSelected" colspan="1">Cardholder Verification Method</td></tr><tr><td class="confluenceTd mceSelected">Contactless</td><td class="confluenceTd mceSelected">Transactions performed by tapping the mobile device on a POS, which starts data exchange. On the Android device operating system passes received data from POS to the HCE service, implemented in the MPA,   
and then to UCP SDK. HCE support is required for contactless transactions

</td></tr><tr><td class="confluenceTd mceSelected">DSRP</td><td class="confluenceTd mceSelected">Digital Secure Remote Payments - transactions initiated from a mobile device, engaging interaction with  
the remote merchant system. HCE support is not required for DSRP transactions

</td></tr><tr><td class="confluenceTd mceSelected">FCM</td><td class="confluenceTd mceSelected">Firebase Cloud Messaging

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">HCE</td><td class="confluenceTd mceSelected" colspan="1">Host Card Emulation</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">IBAN</td><td class="confluenceTd mceSelected" colspan="1">Bank Account Number</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">MCBP</td><td class="confluenceTd mceSelected" colspan="1">Mastercard Cloud Based Payments</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">MDC</td><td class="confluenceTd mceSelected" colspan="1">Mobile Data Core. Verestro core library.

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">MPA</td><td class="confluenceTd mceSelected" colspan="1">Mobile Payment Application - an application that uses UCP SDK for payments

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">NFC</td><td class="confluenceTd mceSelected" colspan="1">Near Field Communication</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">One tap</td><td class="confluenceTd mceSelected" colspan="1">Flow in a contactless transaction, in which the consumer after authentication(using the PIN, fingerprint, etc.)  
taps the device to POS to start exchanging data

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">PAN</td><td class="confluenceTd mceSelected" colspan="1">Primary account number. Know as a card number. </td></tr><tr><td class="confluenceTd mceSelected" colspan="1">Payment Instrument</td><td class="confluenceTd mceSelected" colspan="1">Model keeping all data considering entity used for payments

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">POS</td><td class="confluenceTd mceSelected" colspan="1">Point Of Sale</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">QRC</td><td class="confluenceTd mceSelected" colspan="1">QR Code transactions - allows consumer generate QR code to present to a merchant,  
who then scans it to take payment

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">SUK</td><td class="confluenceTd mceSelected" colspan="1">Single Use Key - unique credential used for single transaction

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">Two tap </td><td class="confluenceTd mceSelected" colspan="1">Flow in a contactless transaction, in which consumer firstly taps device to POS,  
authenticates(using the PIN, fingerprint, etc.), then taps to POS one more time for exchanging data

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">TVC</td><td class="confluenceTd mceSelected" colspan="1">Token Verification Code</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">EWS</td><td class="confluenceTd mceSelected" colspan="1">External Wallet Server</td></tr></tbody></table>

### What is UCP SDK?

The UCP (Verestro Cloud Payments) SDK is a module for digitization, payment, and token management for available payment instruments. Usage of UCP SDK depends on Mobile DC SDK which is the core of the Verestro module. Payment instruments can be provided to UCP SDK using the Mobile DC module.payment

### How UCP SDK works?

Provides methods to manage digitization using main domains:

- IBANs
- Payment
- Cloud Messaging
- Cards
- External Wallet Server

Depending on the selected payment instrument source (Card, Iban, External Wallet Server) UCP SDK allows to digitize it and provide methods for the payment process.

Usage of the following domains depends on client requirements.

### Versioning and backward compatibility

SDK version contains three digits. For example: 1.0.0.

- <span class="inline-comment-marker" data-ref="03becbf9-1eb0-4372-85dc-b8e25fd6091a">First version digit tracks compatibility-breaking changes in SDK public APIs. It is mandatory to update the application code to use SDK when this is incremented</span>.
- Second version digit tracks new, not compatibility-breaking changes in public API of SDK. It is optional to update the application code when this digit is incremented.
- Third version digit tracks internal changes in SDK. No updates in application code are necessary to update to the version, which has this number incremented.

Changes not breaking compatibility:

- Adding a new optional interface to SDK setup
- Adding a new method to any domain
- Adding a new ENUM value to input or output
- <span class="inline-comment-marker" data-ref="7c56a080-20be-4a7a-9ad3-a6b062d53896">Adding a new field in the input or output model</span>

## <span class="inline-comment-marker" data-ref="7c56a080-20be-4a7a-9ad3-a6b062d53896">Technical overview</span>

### <span class="inline-comment-marker" data-ref="7c56a080-20be-4a7a-9ad3-a6b062d53896">SDK Basic configuration</span>

The minSdkVersion must be at least 23 (Android 6.0). The application must use AndroidX.

SDK is available on the Verestro maven repository and can be configured in a project using the Gradle build system.

**The username and password are provided by Verestro.**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="4d87e775-bd2f-4fa9-a47a-a4d754e863ce" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-repositories%7B-maven-"><tbody><tr><td class="wysiwyg-macro-body">```
repositories{
	maven {
		credentials {
			username "<enter_username_here>"
			password "<enter_password_here>"
		}
		url "https://artifactory.upaid.pl/artifactory/libs-release-local/"


		//if the sync time takes too long, add filters to match the repository with specific modules as below
		content {
    		includeGroupByRegex "pl.upaid.*"
    		includeGroup "com.mastercard"
		}
	}
}
```

</td></tr></tbody></table>

UCP SDK is available in two versions: debug and release.

Debug version is ended with appendix "-debug" in version name. Samples below:

**For release version:**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="a31f41c8-d313-47cf-a975-950aac95b09c" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-dependencies%7B-implem"><tbody><tr><td class="wysiwyg-macro-body">```
dependencies{
	implementation 'pl.upaid.module:ucpsdk:{version}'
}
```

</td></tr></tbody></table>

**For debug version:**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="0337931a-60ba-4853-83c1-81ff8fc35fe7" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-dependencies%7B-implem-0"><tbody><tr><td class="wysiwyg-macro-body">```
dependencies{
	implementation 'pl.upaid.module:ucpsdk:{version}-debug'
}
```

</td></tr></tbody></table>

**Min SDK Version**

The minSdkVersion must be at least 23 (Android 6.0). In case of using SDK on lower Android API version declare in the application manifest.

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8772f259-4b73-431d-a965-a0dc5cc3b0eb" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%3Cuses-sdk-tools%3Aover"><tbody><tr><td class="wysiwyg-macro-body">```
  <uses-sdk tools:overrideLibrary= "pl.upaid.module.ucp, 
    pl.upaid.module.mobiledc, pl.upaid.module.mcbp,
    pl.upaid.module.security, com.mastercard.mpsdk, pl.upaid.nativesecurity" />
```

</td></tr></tbody></table>

SDK cannot be initialized on a lower Android API version, and none of the SDK methods should be used on it.

####   


### UCP SDK Size

The size of SDK is dependent on its distribution system.

The table below shows the size of the module for the ask and bundle file.

<table class="wrapped relative-table confluenceTable" id="bkmrk-format-size-notes-ap"><tbody><tr><th class="confluenceTh mceSelected">**Format**</th><th class="confluenceTh mceSelected">**Size**</th><th class="confluenceTh mceSelected" colspan="1">**Notes**</th></tr><tr><td class="confluenceTd mceSelected">APK</td><td class="confluenceTd mceSelected">~15,8 MB</td><td class="confluenceTd mceSelected" colspan="1">  
</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">Bundle</td><td class="confluenceTd mceSelected" colspan="1">~3,4 MB - ~4.5 MB</td><td class="confluenceTd mceSelected" colspan="1">Ranged size depends on the ABI of the device.

SDK contains native libraries used by different ABI. By using a bundle only the necessary  
version of the native library will be downloaded to a device.

</td></tr></tbody></table>

**<span class="inline-comment-marker" data-ref="0b504998-42ff-45b5-914f-e2eb8d437d7f">UCP size already includes Mobile DC SDK size.</span>**

<span class="inline-comment-marker" data-ref="0b504998-42ff-45b5-914f-e2eb8d437d7f">Additional information:</span>

- size from the table above is referred to release version;
- <span class="inline-comment-marker" data-ref="0b504998-42ff-45b5-914f-e2eb8d437d7f">size depends on configured proguard;</span><span class="inline-comment-marker" data-ref="0b504998-42ff-45b5-914f-e2eb8d437d7f">  
    </span>

### <span class="inline-comment-marker" data-ref="0b504998-42ff-45b5-914f-e2eb8d437d7f">UCP SDK Usage</span>

<span class="inline-comment-marker" data-ref="0b504998-42ff-45b5-914f-e2eb8d437d7f">This chapter describes the structure and basic usage of UCP SDK.</span>

####   


#### <span class="inline-comment-marker" data-ref="0b504998-42ff-45b5-914f-e2eb8d437d7f">Domains</span>

Every of the described facades is divided into domains with different responsibilities. Available domains:

- IBANs
- Payment
- Cloud Messaging
- Cards
- External Wallet Server

Every domain contains domain-related methods.

#### Error handling

Works like in Mobile DC SDK, but provides additional BackendException reason codes (only when Verestro Wallet Server is used) and additional exceptions for specific methods.

SDK provides errors by exceptions, which could be caught by the application and shown on UI with a detailed message.

**Note**: UCP SDK can throw exceptions from Mobile DC SDK as its core of the Verestro module.

<table class="wrapped relative-table confluenceTable" id="bkmrk-exception-type-excep"><tbody><tr><th class="confluenceTh mceSelected">**Exception type**</th><th class="confluenceTh mceSelected">**Exception class**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">SDK validation</td><td class="confluenceTd mceSelected">ValidationException</td><td class="confluenceTd mceSelected">Additional reason codes for ValidationException used in Mobile DC SDK </td></tr><tr><td class="confluenceTd mceSelected">Backend exception</td><td class="confluenceTd mceSelected">BackendException</td><td class="confluenceTd mceSelected">Additional reason codes for BackendException used in Mobile DC SDK.

**Note:** Not applicable for[ External Wallet Server domain ](https://wiki.verestro.com/display/UCP/External+Wallet+Server+domain)

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">SDK exception</td><td class="confluenceTd mceSelected" colspan="1">UcpSdkException</td><td class="confluenceTd mceSelected" colspan="1">Something went wrong on the SDK side, check the table below with possible reasons </td></tr><tr><td class="confluenceTd mceSelected">Process related</td><td class="confluenceTd mceSelected">-</td><td class="confluenceTd mceSelected">As every process is different some methods could throw a specified exception

Types of possible exceptions are described in the method description

</td></tr></tbody></table>

Additional BackendException reason codes:

<table class="relative-table wrapped confluenceTable" id="bkmrk-reason-description-i"><tbody><tr><th class="confluenceTh mceSelected">**Reason**</th><th class="confluenceTh mceSelected">**Description**

</th></tr><tr><td class="confluenceTd mceSelected" colspan="1">INTERNAL\_ERROR</td><td class="confluenceTd mceSelected" colspan="1">Error occurred on server

</td></tr><tr><td class="confluenceTd mceSelected">VALIDATION\_ERROR

</td><td class="confluenceTd mceSelected">Client sent invalid data

</td></tr><tr><td class="confluenceTd mceSelected">CRYPTOGRAPHY\_ERROR

</td><td class="confluenceTd mceSelected">Error occurred during cryptography operation

</td></tr><tr><td class="confluenceTd mceSelected">PAYMENT\_CARD\_PREDIGITIZE\_ERROR

</td><td class="confluenceTd mceSelected">Predigitize of payment card failed

</td></tr><tr><td class="confluenceTd mceSelected">PAYMENT\_IBAN\_PREDIGITIZE\_ERROR

</td><td class="confluenceTd mceSelected">Predigitize of payment IBAN failed

</td></tr><tr><td class="confluenceTd mceSelected">PAYMENT\_CARD\_DIGITIZE\_ERROR

</td><td class="confluenceTd mceSelected">Digitize of payment card failed

</td></tr><tr><td class="confluenceTd mceSelected">PAYMENT\_IBAN\_DIGITIZE\_ERROR

</td><td class="confluenceTd mceSelected">Digitize of payment IBAN failed

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">PAYMENT\_CARD\_PREDIGITIZE\_NOT\_EXECUTED

</td><td class="confluenceTd mceSelected" colspan="1">Predigitize for payment card must be executed

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">PAYMENT\_IBAN\_PREDIGITIZE\_NOT\_EXECUTED

</td><td class="confluenceTd mceSelected" colspan="1">Predigitize for payment IBAN must be executed

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">CLIENT\_UNAUTHORIZED

</td><td class="confluenceTd mceSelected" colspan="1">Client of the API is unauthorized

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">USER\_UNAUTHORIZED

</td><td class="confluenceTd mceSelected" colspan="1">User is unauthorized

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">CANT\_FIND\_USER

</td><td class="confluenceTd mceSelected" colspan="1">Cannot find user

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">CANT\_FIND\_DEVICE

</td><td class="confluenceTd mceSelected" colspan="1">Cannot find device

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">CANT\_FIND\_IBAN

</td><td class="confluenceTd mceSelected" colspan="1">Cannot find payment IBAN

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">CANT\_FIND\_CARD

</td><td class="confluenceTd mceSelected" colspan="1">Cannot find payment card

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">CANT\_FIND\_PAYMENT\_TOKEN

</td><td class="confluenceTd mceSelected" colspan="1">Cannot find payment token

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">OPERATION\_NOT\_SUPPORTED

</td><td class="confluenceTd mceSelected" colspan="1">Requested operation is not supported

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">OPERATION\_NOT\_ALLOWED

</td><td class="confluenceTd mceSelected" colspan="1">Requested operation is not allowed

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">DEVICE\_TEMPORARILY\_LOCKED

</td><td class="confluenceTd mceSelected" colspan="1">Device is temporarily locked

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">DEVICE\_PERMANENTLY\_LOCKED

</td><td class="confluenceTd mceSelected" colspan="1">Device is permanently locked

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">INVALID\_PAN

</td><td class="confluenceTd mceSelected" colspan="1">The PAN format is not valid, or other data associated with the PAN was incorrect or entered incorrectly

</td></tr><tr><td class="confluenceTd mceSelected">MISSING\_EXPIRY\_DATE

</td><td class="confluenceTd mceSelected">The expiry date is required for this product but was missing

</td></tr><tr><td class="confluenceTd mceSelected">PAN\_INELIGIBLE

</td><td class="confluenceTd mceSelected">The PAN is not in an approved account range for TSP

</td></tr><tr><td class="confluenceTd mceSelected">DEVICE\_INELIGIBLE

</td><td class="confluenceTd mceSelected">The device is not supported for use

</td></tr><tr><td class="confluenceTd mceSelected">PAN\_INELIGIBLE\_FOR\_DEVICE

</td><td class="confluenceTd mceSelected">The PAN is not allowed to be provisioned to the device because of Issuer rules

</td></tr><tr><td class="confluenceTd mceSelected">IBAN\_INELIGIBLE

</td><td class="confluenceTd mceSelected">The financial account does not have an associated account range in TSP

</td></tr><tr><td class="confluenceTd mceSelected">PARALLEL\_REQUESTS\_ATTEMPTS

</td><td class="confluenceTd mceSelected">Action is already processing. Please try again after the time included in headers

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">INVALID\_JWS\_TOKEN</td><td class="confluenceTd mceSelected" colspan="1">Specified JWS token is invalid</td></tr></tbody></table>

Additional ValidationException reason codes:

<table class="relative-table wrapped confluenceTable" id="bkmrk-reason-description-i-0"><tbody><tr><th class="confluenceTh mceSelected">**Reason**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">INVALID\_SECURITY\_CODE

</td><td class="confluenceTd mceSelected">Security code is empty

</td></tr><tr><td class="confluenceTd mceSelected">INVALID\_LANGUAGE\_CODE

</td><td class="confluenceTd mceSelected">Language code is empty

</td></tr><tr><td class="confluenceTd mceSelected">INVALID\_PAYMENT\_INSTRUMENT\_ID

</td><td class="confluenceTd mceSelected">Payment instrument id is empty</td></tr></tbody></table>

UcpSdkException reason codes:

<table class="relative-table wrapped confluenceTable" id="bkmrk-reason-description-p"><tbody><tr><th class="confluenceTh mceSelected">**Reason**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">PUSH\_INVALID\_SOURCE

</td><td class="confluenceTd mceSelected">Relates to push processing process. Push message should be consumed in another module

</td></tr><tr><td class="confluenceTd mceSelected">PUSH\_INVALID\_PUSH\_CONTENT

</td><td class="confluenceTd mceSelected">Cannot process push message. The message is invalid or some process failed

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">PAYMENT\_INSTRUMENT\_DEFAULT\_NOT\_FOUND

</td><td class="confluenceTd mceSelected" colspan="1">Cannot find default PaymentInstrument</td></tr><tr><td class="confluenceTd mceSelected">PAYMENT\_INSTRUMENT\_NOT\_FOUND

</td><td class="confluenceTd mceSelected">Selected PaymentInstrument cannot be found, is not digitized or active

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">APPLICATION\_PROCESS\_NOT\_KILLED</td><td class="confluenceTd mceSelected" colspan="1">Occurs when after using the reset method, there is a try of using any of the facade methods without previously stopping the application process

</td></tr></tbody></table>

####   


#### Facade

The facade is an entry point to communication with UCP SDK.

Contains SDK initialization method and domains which allows for payment instrument management.

####   


#### Method structure

Please read Mobile DC Documentation for details.

####   


#### Multiple facade types

UCP SDK provides three public APIs with the same functionalities, the APIs are:

- UcpJavaApi for projects which use Java programming language.
- UcpKotlinApi for projects which use Kotlin programming language.

The difference between the APIs is a way of providing data to SDK methods and getting the results from them. Input and output as information data are the same.

This documentation presents I/O types in a Kotlin way as it’s easier to mark nullable fields (as a question mark).

####   


#### HceApduService registration

To register HceApduService firstly it needs to be created a class that extends a default HostApduService. Added class needs to be added to the manifest file as a service.

Properly configured meta-data in service will also register an application as tap&amp;pay ready.

Exemplary service below:

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="d22519fa-f9d1-440f-aecd-71ff1fc4b423" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%3Cservice-android%3Anam"><tbody><tr><td class="wysiwyg-macro-body">```
<service
	android:name=".WalletHceService"
	android:exported="true"
	android:permission="android.permission.BIND_NFC_SERVICE">
		
		<intent-filter>
			<action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />		
		</intent-filter>
		
		<meta-data
			android:name="android.nfc.cardemulation.host_apdu_service"
			android:resource="@xml/hce_apdu_service" />
 </service>
```

</td></tr></tbody></table>

Below listing of the default source file hce\_apud\_service.xml:

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="25a93d27-98a0-4d9a-885d-7cd3898f6105" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%3Chost-apdu-service-x"><tbody><tr><td class="wysiwyg-macro-body">```
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
	android:apduServiceBanner="@drawable/hce_logo"
	android:description="@string/hce_service_description"
	android:requireDeviceUnlock="false">
	<!-- If the requireDeviceUnlock is set to false, on some phones you can pay if the screen is not awake, 
    but on most devices the screen must be awake to make a payment. -->
	
	<aid-group
    	    android:category="payment"
    	    android:description="@string/aid_description">

		<!-- Following is a PPSE AID. You must always include this AID in order for payments to work-->

	 	<aid-filter android:name="325041592E5359532E4444463031" />

		<!-- Following AID list is specific to the application requirements.
	       If your application supports the type of card that these AID represents,
	       you must include those AID in your configuration file -->

		<aid-filter android:name="A0000000041010" /> <!-- Mastercard DEBIT/CREDIT -->
	    <aid-filter android:name="A0000000042203" /> <!-- Mastercard US DEBIT/CREDIT -->
	    <aid-filter android:name="A0000000043060" /> <!-- Maestro DEBIT -->
	    <aid-filter android:name="A0000000049100" /> <!-- Private label AID-->
	</aid-group>
</host-apdu-service>
```

</td></tr></tbody></table>

Check if the application is set as default for payment.

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="d85e34d7-a0d5-40e3-92b8-a1ae6a87df29" data-macro-name="code" data-macro-parameters="language=java" data-macro-schema-version="1" id="bkmrk-fun-issystemdefault%28"><tbody><tr><td class="wysiwyg-macro-body">```
fun isSystemDefault(): Boolean {
	val cardEmulation = CardEmulation.getInstance(NfcAdapter.getDefaultAdapter(context))
    return cardEmulation.isDefaultServiceForCategory(
        WalletHceService::class.java,
        CardEmulation.CATEGORY_PAYMENT
    )
}
```

</td></tr></tbody></table>

Request for set your application as default for payment - will show a dialog for the user to approve the changes.

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="a727ccf5-39af-4d76-ac09-6444d47e6e2d" data-macro-name="code" data-macro-parameters="language=java" data-macro-schema-version="1" id="bkmrk-fun-requestforsystem"><tbody><tr><td class="wysiwyg-macro-body">```
fun requestForSystemDefault() {
    val intent = Intent().apply {
        action = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT"
        putExtra("component", WalletHceService::class.java)
        putExtra("category", CardEmulation.CATEGORY_PAYMENT)
    }
    context.startActivity(intent)
}
```

</td></tr></tbody></table>

If the application is not set as default for payment and wants to make payment from opened application needs to set the preferred service. Requires system option "On top application is the default for HCE" enabled.

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="a24ce388-246e-4adc-bdc5-193d89f5c9c4" data-macro-name="code" data-macro-parameters="language=java" data-macro-schema-version="1" id="bkmrk-fun-registerasontoph"><tbody><tr><td class="wysiwyg-macro-body">```
fun registerAsOnTopHceApplication() {
	val cardEmulation = CardEmulation.getInstance(NfcAdapter.getDefaultAdapter(context))
    cardEmulation.setPreferredService(
        activity, ComponentName(activity, WalletHceService::class.java)
    )
}


fun unregisterFromOnTopHceApplication() {
	val cardEmulation = CardEmulation.getInstance(NfcAdapter.getDefaultAdapter(context))
    cardEmulation.unsetPreferredService(activity)
}
```

</td></tr></tbody></table>

####   


#### Models

##### PaymentInstrument

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="10b1b523-a3e5-485e-8027-4458b10cb6fe">id</span></td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Id of payment instrument. For card it is cardId, for IBAN sha256Hex.

In the context of the External Wallet Server use tokenUniqueReference from MDES

</td></tr><tr><td class="confluenceTd mceSelected">paymentTokenId</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Id of payment token. Used for getting transactions history (see Mobile DC documentation) only for selected token id </td></tr><tr><td class="confluenceTd mceSelected">displayablePanDigits</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Token last 4 digits which can be used to display

</td></tr><tr><td class="confluenceTd mceSelected">paymentInstrumentStatus</td><td class="confluenceTd mceSelected">PaymentInstrumentStatus</td><td class="confluenceTd mceSelected">Enum with status of payment instrument.

</td></tr><tr><td class="confluenceTd mceSelected">contactlessSupported</td><td class="confluenceTd mceSelected">Boolean</td><td class="confluenceTd mceSelected">Information if payment instrument supports contactless transactions.

</td></tr><tr><td class="confluenceTd mceSelected">dsrpSupported</td><td class="confluenceTd mceSelected">Boolean</td><td class="confluenceTd mceSelected">Information if the payment instrument supports DSRP transactions.

</td></tr><tr><td class="confluenceTd mceSelected">qrcSupported</td><td class="confluenceTd mceSelected">Boolean</td><td class="confluenceTd mceSelected">Information if the payment instrument supports QR transactions.

</td></tr><tr><td class="confluenceTd mceSelected">onDeviceCvmSupported</td><td class="confluenceTd mceSelected">Boolean</td><td class="confluenceTd mceSelected">Information about supporting CVM on device.

</td></tr><tr><td class="confluenceTd mceSelected">credentialsCount</td><td class="confluenceTd mceSelected">Int</td><td class="confluenceTd mceSelected">Amount of credentials that can be used for payments.

</td></tr><tr><td class="confluenceTd mceSelected">isDefaultForContactlessPayment

</td><td class="confluenceTd mceSelected">Boolean</td><td class="confluenceTd mceSelected">Information if payment instrument is default for contactless payments.

</td></tr><tr><td class="confluenceTd mceSelected">isDefaultForRemotePayment</td><td class="confluenceTd mceSelected">Boolean</td><td class="confluenceTd mceSelected">Information if payment instrument is default for remote payments.

</td></tr><tr><td>additionalAuthenticationRequired</td><td>Boolean  
</td><td>Is additional authentication for payment token activation required. If true, available authentication methods can be obtained using getAdditionalAuthenticationMethods

</td></tr><tr><td>tokenLastFourDigits</td><td>String?  
</td><td>Payment Token last four digits. Present only when multistep digitization is used(checkEligibility and digitize called separately).

</td></tr><tr><td>paymentInstrumentExpirationDate</td><td>String?  
</td><td>Payment instrument expiry date in format MM/YY. Present only when multistep digitization is used(checkEligibility and digitize called separately).

</td></tr><tr><td>paymentInstrumentLastFourDigits  
</td><td>String?  
</td><td>Payment instrument last four digits. Present only when multistep digitization is used(checkEligibility and digitize called separately).

</td></tr><tr><td>productConfig  
</td><td>ProductConfig?  
</td><td>Payment Token configuration. Present only when multistep digitization is used(checkEligibility and digitize called separately).

</td></tr></tbody></table>

###   


##### PaymentInstrumentStatus

<table class="relative-table wrapped confluenceTable" id="bkmrk-field-description-in"><tbody><tr><th class="confluenceTh mceSelected">**Field**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">INACTIVE</td><td class="confluenceTd mceSelected">Payment instrument is not <span class="inline-comment-marker" data-ref="feec450f-de11-4043-9fb1-7708355745fe">active</span>, it can not be used for transactions.

The activation process depends on integration. Read the product overview for more information.

</td></tr><tr><td class="confluenceTd mceSelected">ACTIVE</td><td class="confluenceTd mceSelected">Payment instrument is active and it can be used for transactions.

</td></tr><tr><td class="confluenceTd mceSelected">SUSPENDED</td><td class="confluenceTd mceSelected">Payment instrument is suspended.</td></tr><tr><td class="confluenceTd mceSelected">DELETED</td><td class="confluenceTd mceSelected">Payment instrument is DELETED.

</td></tr><tr><td class="confluenceTd mceSelected">UNKNOWN</td><td class="confluenceTd mceSelected">Payment instrument status is unknown.</td></tr></tbody></table>

#####   


##### AdditionalAuthenticationMethod

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-0"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">id</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Identifier of additional authentication method </td></tr><tr><td class="confluenceTd mceSelected">name</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Method name. One of:

OTP\_TO\_CARDHOLDER\_NUMBER, OTP\_TO\_CARDHOLDER\_EMAIL, CARDHOLDER\_TO\_CALL\_CUSTOMER\_SERVICE, CARDHOLDER\_TO\_VISIT\_WEBSITE, CARDHOLDER\_TO\_USE\_ISSUER\_MOBILE\_APPLICATION, ISSUER\_TO\_CALL\_CARDHOLDER\_NUMBER

</td></tr><tr><td class="confluenceTd mceSelected">value</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Value depends on method name. Described below. </td></tr><tr><td class="confluenceTd mceSelected" colspan="1">issuerParameters</td><td class="confluenceTd mceSelected" colspan="1">AuthMethodsIssuerParameters?</td><td class="confluenceTd mceSelected" colspan="1">Non null if method is CARDHOLDER\_TO\_USE\_ISSUER\_MOBILE\_APPLICATION</td></tr></tbody></table>

####   


##### Additional authentication method values:

<div id="bkmrk-method-value-descrip"><table class="relative-table confluenceTable"><tbody><tr><th class="confluenceTh mceSelected">**Method**</th><th class="confluenceTh mceSelected">**Value**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">`OTP_TO_CARDHOLDER_NUMBER`</td><td class="confluenceTd mceSelected">Masked phone number

</td><td class="confluenceTd mceSelected">Text message to Account holder’s mobile phone number. The value will be the Account holder’s masked mobile phone number.</td></tr><tr><td class="confluenceTd mceSelected">`OTP_TO_CARDHOLDER_EMAIL`</td><td class="confluenceTd mceSelected">Masked email

</td><td class="confluenceTd mceSelected">Email to Account holder’s email address. The value will be the Account holder’s masked email address.</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">`CARDHOLDER_TO_CALL_CUSTOMER_SERVICE`</td><td class="confluenceTd mceSelected" colspan="1">Phone number

</td><td class="confluenceTd mceSelected" colspan="1">Account holder-initiated call. The value will be the phone number for the Account holder to call Customer Service.

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">`CARDHOLDER_TO_VISIT_WEBSITE`</td><td class="confluenceTd mceSelected" colspan="1">Website URL

</td><td class="confluenceTd mceSelected" colspan="1">Account holder to visit a website. The value will be the website URL.

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">`CARDHOLDER_TO_USE_ISSUER_MOBILE_APPLICATION`</td><td class="confluenceTd mceSelected" colspan="1">Application name

</td><td class="confluenceTd mceSelected" colspan="1">(Conditional) Issuer’s mobile app name. The method is available for both MDES and VTS but the value will be presented only for VTS.

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">`ISSUER_TO_CALL_CARDHOLDER_NUMBER`</td><td class="confluenceTd mceSelected" colspan="1">Masked phone number

</td><td class="confluenceTd mceSelected" colspan="1">Issuer-initiated voice call to Account holder’s phone. The value will be the Account holder’s masked voice call phone number.

</td></tr></tbody></table>

</div>####   


##### AuthMethodsIssuerParameters contains the following fields:

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-1"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">mdes</td><td class="confluenceTd mceSelected">AuthMethodsIssuerParametersMdes?</td><td class="confluenceTd mceSelected">Plain AuthMethodsIssuerParametersMdes object, required for MDES Payment Token</td></tr><tr><td class="confluenceTd mceSelected">vts</td><td class="confluenceTd mceSelected">AuthMethodsIssuerParametersVts?</td><td class="confluenceTd mceSelected">Required for VTS Payment token</td></tr></tbody></table>

####   


##### AuthMethodsIssuerParametersMdes contains following fields:

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-2"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected" colspan="1">android</td><td class="confluenceTd mceSelected" colspan="1">AuthMethodsIssuerParametersMdesAndroid</td><td class="confluenceTd mceSelected" colspan="1">Plain AuthMethodsIssuerParametersMdesAndroid object. Required for Android device</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">ios</td><td class="confluenceTd mceSelected" colspan="1">AuthMethodsIssuerParametersMdesIos</td><td class="confluenceTd mceSelected" colspan="1">Plain AuthMethodsIssuerParametersMdesIos object. Required for IOS device</td></tr></tbody></table>

####   


##### AuthMethodsIssuerParametersMdesAndroid contains following fields:

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-3"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">action</td><td class="confluenceTd">String?</td><td class="confluenceTd">Name of the action to be performed</td></tr><tr><td class="confluenceTd">packageName</td><td class="confluenceTd">String?</td><td class="confluenceTd">The package name of the issuer's mobile app</td></tr><tr><td class="confluenceTd" colspan="1">extraTextValue</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Contains the data to be passed through to the target app in the intent as an extra key/value pair with key ‘android.intent.extra.TEXT’. This is Base64-encoded data of a JSON object of the MobileAppActivationParameters. This object is not described since the whole payload is passed to the issuer app</td></tr></tbody></table>

##### AuthMethodsIssuerParametersMdesIos contains following fields:

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-4"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">deepLinkingUrl</td><td class="confluenceTd">String?</td><td class="confluenceTd">The deep linking URL of the issuer’s iOS mobile app. This identifies the app that the URL will resolve to. If the app is not installed on the user’s device, this URL can be used to open a link to the appropriate iOS app store for the user to download and install the app.</td></tr><tr><td class="confluenceTd">extraTextValue</td><td class="confluenceTd">String?</td><td class="confluenceTd">Contains the data to be passed through to the target app in the deep linking URL as a query parameter. It should be appended to the deepLinkingUrl when invoked in the format: deepLinkingUrl + ‘?extraTextValue=’ + extraTextValue. This is Base64-encoded data of a JSON object of the MobileAppActivationParameters. This object is not described since the whole payload is passed to the issuer app.</td></tr></tbody></table>

##### AuthMethodsIssuerParametersVts contains following fields:

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-5"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">android</td><td class="confluenceTd">AuthMethodsIssuerParametersVtsAndroid?</td><td class="confluenceTd">Plain AuthMethodsIssuerParametersVtsAndroid object.   
Required for Android devices</td></tr><tr><td class="confluenceTd">ios</td><td class="confluenceTd">AuthMethodsIssuerParametersVtsIos?</td><td class="confluenceTd">Plain AuthMethodsIssuerParametersVtsIos object.   
Required for IOS devices</td></tr></tbody></table>

##### AuthMethodsIssuerParametersVtsAndroid contains following fields:

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-6"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">appId</td><td class="confluenceTd">String?</td><td class="confluenceTd">Unique identifier for the application within the application store.</td></tr><tr><td class="confluenceTd">appUrl</td><td class="confluenceTd">String?</td><td class="confluenceTd">URL of the application in the application store.</td></tr><tr><td class="confluenceTd" colspan="1">intentUrl</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">URL of banking app designed to respond to authentication code handling.</td></tr><tr><td class="confluenceTd" colspan="1">requestPayload</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The request payload is to be sent to the banking application on behalf of Visa.   
This field is opaque to wallet providers.</td></tr></tbody></table>

##### AuthMethodsIssuerParametersVtsIos contains following fields:

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-7"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">appId</td><td class="confluenceTd">String?</td><td class="confluenceTd">Unique identifier for the application within the application store.</td></tr><tr><td class="confluenceTd">appUrl</td><td class="confluenceTd">String?</td><td class="confluenceTd">URL of the application in the application store.</td></tr><tr><td class="confluenceTd" colspan="1">intentUrl</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">URL of banking app designed to respond to authentication code handling.</td></tr><tr><td class="confluenceTd" colspan="1">requestPayload</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The request payload is to be sent to the banking application on behalf of Visa.   
This field is opaque to wallet providers.</td></tr></tbody></table>

#####   


##### ContactlessTransactionInformation

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-8"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">currencyCode</td><td class="confluenceTd mceSelected">ByteArray</td><td class="confluenceTd mceSelected">Code of currency, that was used in transaction. Formatted in ISO 4271.

</td></tr><tr><td class="confluenceTd mceSelected">amount</td><td class="confluenceTd mceSelected">ByteArray</td><td class="confluenceTd mceSelected">Transaction amount in bytes. Can be formatted as Int in pennies.</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">transactionRange</td><td class="confluenceTd mceSelected" colspan="1">ContactlessTransactionRange</td><td class="confluenceTd mceSelected" colspan="1">Type of transaction range.

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1"><span class="inline-comment-marker" data-ref="45fc6055-c369-48d3-b068-ecaf126a6b33">richTransactionType</span></td><td class="confluenceTd mceSelected" colspan="1">ContactlessRichTransactionType</td><td class="confluenceTd mceSelected" colspan="1">Rich transaction type.

</td></tr><tr><td class="confluenceTd mceSelected" colspan="1"><span class="inline-comment-marker" data-ref="94cd9284-9531-46be-b500-f7a1a4a53b71">merchantAndLocation</span></td><td class="confluenceTd mceSelected" colspan="1">ByteArray</td><td class="confluenceTd mceSelected" colspan="1">Merchant and location data from terminal. Can be formatted as String, by using UTF\_8 Charset.</td></tr></tbody></table>


**ContactlessTransactionRange**

<table class="relative-table wrapped confluenceTable" id="bkmrk-value-description-lv"><colgroup><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Value**</th><th class="confluenceTh">**Description**

</th></tr><tr><td class="confluenceTd">LVT</td><td class="confluenceTd">Low value transaction</td></tr><tr><td class="confluenceTd" colspan="1">HVT</td><td class="confluenceTd" colspan="1">High value transaction

</td></tr><tr><td class="confluenceTd" colspan="1">UNKNOWN</td><td class="confluenceTd" colspan="1">Unknown</td></tr></tbody></table>

**ContactlessRichTransactionType**

<table class="relative-table wrapped confluenceTable" id="bkmrk-value-purchase-refun"><colgroup><col></col></colgroup><tbody><tr><th class="confluenceTh">**Value**</th></tr><tr><td class="confluenceTd">PURCHASE</td></tr><tr><td class="confluenceTd" colspan="1">REFUND</td></tr><tr><td class="confluenceTd" colspan="1">CASH</td></tr><tr><td class="confluenceTd" colspan="1">TRANSIT</td></tr><tr><td class="confluenceTd" colspan="1">PURCHASE\_WITH\_CASHBACK</td></tr><tr><td class="confluenceTd" colspan="1">UNKNOWN</td></tr></tbody></table>


##### DsrpTransactionInfo

<table class="relative-table confluenceTable" id="bkmrk-parameter-type-descr-9"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Descruption**</th></tr><tr><td class="confluenceTd mceSelected">amount</td><td class="confluenceTd mceSelected">Long</td><td class="confluenceTd mceSelected">Transaction amount</td></tr><tr><td class="confluenceTd mceSelected">currencyCode</td><td class="confluenceTd mceSelected">Int</td><td class="confluenceTd mceSelected"><del class="diffdel"></del>Code of currency, that was used in transaction.

<del class="diffdel"></del></td></tr><tr><td class="confluenceTd mceSelected">countryCode</td><td class="confluenceTd mceSelected">Int</td><td class="confluenceTd mceSelected">Code of country.

</td></tr><tr><td class="confluenceTd mceSelected">issuerCryptogramType</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Cryptogram type.</td></tr></tbody></table>

##### TransactionAbortReason

<table class="wrapped confluenceTable" id="bkmrk-value-description-wa"><tbody><tr><th class="confluenceTh mceSelected">**Value**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">WALLET\_CANCEL\_REQUEST</td><td class="confluenceTd mceSelected">Indicates that the wallet has requested a transaction cancellation during payment.</td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">CARD\_ERROR</span></td><td class="confluenceTd mceSelected">This indicates that a problem has been detected in the MChipEngine processing.

In some implementations, this can indicate badly formatted card profile data.

</td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">TERMINAL\_ERROR</span></td><td class="confluenceTd mceSelected">This indicates incorrect terminal behavior.

</td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">NO\_TRANSACTION\_CREDENTIALS </span></td><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">There are no transaction credentials to finalize payment. The application should call replenish Credentials method to enable payment possibility.  
</span></td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">NO\_CARDS</span></td><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">There is no active PaymentInstrument to start payment</span>. Called when no card is added to Wallet or SDK is cleared by Security Issue (onSecurityIssueAppeared event).</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">TERMINAL\_INACTIVITY\_TIMEOUT</td><td class="confluenceTd mceSelected" colspan="1">There is a problem with communication between the terminal and payment device.

For example, the terminal could abort communication with the mobile device for  
a long period of time and then trigger a timeout.

Usually, a mobile device loses connection during payment due to a wrong or too short tap on the terminal.

The application should ignore this status as SDK waits for connection establishment and it could produce getting duplicate callbacks during payment.

**Note:** When user authentication is already provided it could be cleared - the application should handle card selection (if a non-default card is selected) and payment authentication again.

</td></tr></tbody></table>

##### NewTransaction

<table class="relative-table wrapped confluenceTable" id="bkmrk-field-type-descripti"><tbody><tr><th class="confluenceTh mceSelected">**Field**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">clientTransactionId

</td><td class="confluenceTd mceSelected">String?

</td><td class="confluenceTd mceSelected">Identifier of transaction in TSP

</td></tr><tr><td class="confluenceTd mceSelected">type

</td><td class="confluenceTd mceSelected">String

</td><td class="confluenceTd mceSelected">The transaction type. One of: \[UNKNOWN, PURCHASE, REFUND, PAYMENT, ATM\_WITHDRAWAL, CASH\_DISBURSEMENT, ATM\_DEPOSIT, ATM\_TRANSFER\]

</td></tr><tr><td class="confluenceTd mceSelected">amountMinor

</td><td class="confluenceTd mceSelected">Long

</td><td class="confluenceTd mceSelected">The monetary amount in terms of the minor units of the currency. For example,   
`EUR 2.35' will return 235, and `BHD -1.345' will return -1345

</td></tr><tr><td class="confluenceTd mceSelected">currency

</td><td class="confluenceTd mceSelected">String

</td><td class="confluenceTd mceSelected">3-digit ISO 4217 currency code

</td></tr><tr><td class="confluenceTd mceSelected">timestamp

</td><td class="confluenceTd mceSelected">String

</td><td class="confluenceTd mceSelected">The date/time when the transaction occurred. In ISO 8601 extended format

</td></tr><tr><td class="confluenceTd mceSelected">merchantName

</td><td class="confluenceTd mceSelected">String?

</td><td class="confluenceTd mceSelected">The merchant (``doing business as'') name

</td></tr><tr><td class="confluenceTd mceSelected">merchantPostalCode

</td><td class="confluenceTd mceSelected">String?

</td><td class="confluenceTd mceSelected">The postal code of the merchant

</td></tr><tr><td class="confluenceTd mceSelected">transactionCountryCode

</td><td class="confluenceTd mceSelected">String?

</td><td class="confluenceTd mceSelected">The country in which the transaction was performed. Expressed as a 3-letter (alpha-3) country code as defined in ISO 3166-1

</td></tr><tr><td class="confluenceTd mceSelected">comboCardAccountType

</td><td class="confluenceTd mceSelected">String?

</td><td class="confluenceTd mceSelected">An indicator if Credit or Debit was chosen for a tokenized combo card at the time of the transaction. One of: \[UNKNOWN, CREDIT, DEBIT\]

</td></tr><tr><td class="confluenceTd mceSelected">issuerResponseInformation

</td><td class="confluenceTd mceSelected">String?

</td><td class="confluenceTd mceSelected">Additional information is provided by the issuer for a declined transaction. Only returned if the transaction is declined. One of: \[UNKNOWN, INVALID\_CARD\_NUMBER, FORMAT\_ERROR, MAX\_AMOUNT\_EXCEEDED, EXPIRED\_CARD, PIN\_AUTHORIZATION\_FAILED, TRANSACTION\_NOT\_PERMITTED, WITHDRAWL\_AMOUNT\_EXCEEDED, RESTRICTED\_CARD, WITHDRAWL\_COUNT\_EXCEEDED, PIN\_TRIES\_NUMBER\_EXCEEDED, INCORRECT\_PIN, DUPLICATE\_TRANSMISSION\]

</td></tr><tr><td class="confluenceTd mceSelected">status

</td><td class="confluenceTd mceSelected">String

</td><td class="confluenceTd mceSelected">The authorization status of the transaction. One of: \[AUTHORIZED, DECLINED, CLEARED, REVERSED\]

</td></tr><tr><td class="confluenceTd mceSelected">paymentTokenId

</td><td class="confluenceTd mceSelected">String

</td><td class="confluenceTd mceSelected">Identifier of payment token in UCP

</td></tr></tbody></table>

##### ContactlessTransactionData

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-10"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd" colspan="1">currencyNumber</td><td class="confluenceTd" colspan="1">Int</td><td class="confluenceTd" colspan="1">Currency number assigned to the currencyCode in ISO 4271 e.g.: for PLN is 985.</td></tr><tr><td class="confluenceTd">currencyCode</td><td class="confluenceTd">String?</td><td class="confluenceTd">Code of currency, that was used in transaction formatted in ISO 4271. e.g.: PLN

Could be null as the terminal provides only the currencyNumber and a valid code could be not found.

</td></tr><tr><td class="confluenceTd">amountMinor</td><td class="confluenceTd">Long</td><td class="confluenceTd">The monetary amount in terms of the minor units of the currency. For example, `EUR 2.35' will return 235,</td></tr><tr><td class="confluenceTd" colspan="1">transactionRange</td><td class="confluenceTd" colspan="1">ContactlessTransactionRange</td><td class="confluenceTd" colspan="1">Type of transaction range.

</td></tr><tr><td class="confluenceTd" colspan="1"><span class="inline-comment-marker" data-ref="45fc6055-c369-48d3-b068-ecaf126a6b33">richTransactionType</span></td><td class="confluenceTd" colspan="1">ContactlessRichTransactionType</td><td class="confluenceTd" colspan="1">Rich transaction type.

</td></tr><tr><td class="confluenceTd" colspan="1"><span class="inline-comment-marker" data-ref="94cd9284-9531-46be-b500-f7a1a4a53b71">merchantAndLocation</span></td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Merchant and location data from terminal.

**Deprecated** - field shouldn't be used as it could be not configured in terminal configuration or provides invalid data.

</td></tr></tbody></table>

**ContactlessTransactionRange**

<table class="relative-table wrapped confluenceTable" id="bkmrk-value-description-lv-0"><colgroup><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Value</th><th class="confluenceTh">Description

</th></tr><tr><td class="confluenceTd">LVT</td><td class="confluenceTd">Low value transaction</td></tr><tr><td class="confluenceTd" colspan="1">HVT</td><td class="confluenceTd" colspan="1">High value transaction

</td></tr><tr><td class="confluenceTd" colspan="1">UNKNOWN</td><td class="confluenceTd" colspan="1">Unknown</td></tr></tbody></table>

**ContactlessRichTransactionType**

<table class="relative-table wrapped confluenceTable" id="bkmrk-value-description-pu"><colgroup><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Value</th><th class="confluenceTh" colspan="1">Description</th></tr><tr><td class="confluenceTd">PURCHASE</td><td class="confluenceTd" colspan="1">  
</td></tr><tr><td class="confluenceTd" colspan="1">REFUND</td><td class="confluenceTd" colspan="1">  
</td></tr><tr><td class="confluenceTd" colspan="1">CASH</td><td class="confluenceTd" colspan="1">  
</td></tr><tr><td class="confluenceTd" colspan="1">TRANSIT</td><td class="confluenceTd" colspan="1">  
</td></tr><tr><td class="confluenceTd" colspan="1">PURCHASE\_WITH\_CASHBACK</td><td class="confluenceTd" colspan="1">  
</td></tr><tr><td class="confluenceTd" colspan="1">UNKNOWN</td><td class="confluenceTd" colspan="1">  
</td></tr><tr><td class="confluenceTd" colspan="1">WITHDRAWAL</td><td class="confluenceTd" colspan="1">  
</td></tr><tr><td class="confluenceTd" colspan="1">ATM\_CONTACTLESS</td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

##### Report

<table class="wrapped relative-table confluenceTable" id="bkmrk-parameter-type-descr-11"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Type**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected">name</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Action name</td></tr><tr><td class="confluenceTd mceSelected">description</td><td class="confluenceTd mceSelected">String</td><td class="confluenceTd mceSelected">Action details message.</td></tr><tr><td class="confluenceTd mceSelected">isSuccess</td><td class="confluenceTd mceSelected">Boolean</td><td class="confluenceTd mceSelected">Result of action. True when action is finished successfully, false otherwise.</td></tr><tr><td class="confluenceTd mceSelected">timestamp</td><td class="confluenceTd mceSelected">Long</td><td class="confluenceTd mceSelected">Time when the action occurred.</td></tr><tr><td class="confluenceTd mceSelected" colspan="1">errorMessage</td><td class="confluenceTd mceSelected" colspan="1">String?</td><td class="confluenceTd mceSelected" colspan="1">Detailed error message when isSuccess is false.</td></tr></tbody></table>

##### ContactlessAdvice

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-descriptio"><tbody><tr><th class="confluenceTh mceSelected">**Parameter**</th><th class="confluenceTh mceSelected">**Description**</th></tr><tr><td class="confluenceTd mceSelected" colspan="1">DECLINE</td><td class="confluenceTd mceSelected" colspan="1">Declines a processing transaction.

When provided by SDK in *getFinalDecisionForTransaction* wallet should not overrule a DECLINE.

If the MPA overrules a DECLINE (and forces it into PROCEED), the transaction is likely to be declined by the issuer in the authorization response.

</td></tr><tr><td class="confluenceTd mceSelected">AUTHENTICATION\_REQUIRED</td><td class="confluenceTd mceSelected">An user authentication is required for transaction processing, which could be overruled on the MPA side.  
When the MPA decision is AUTHENTICATION\_REQUIRED, SDK will ask for user authentication in the *onAuthRequiredForContactless* method.

</td></tr><tr><td class="confluenceTd mceSelected">PROCEED</td><td class="confluenceTd mceSelected">Transaction can be processed.</td></tr></tbody></table>

##### ContactlessTransactionResult

<p class="callout warning">**Important:** MPA should always refer to transaction results on the terminal.</p>

<table class="wrapped relative-table confluenceTable" id="bkmrk-value-description-is"><tbody><tr><th class="confluenceTh mceSelected">**Value**</th><th class="confluenceTh mceSelected">**Description**</th><th class="confluenceTh mceSelected" colspan="1">**Is success on MPA side**

</th></tr><tr><td class="confluenceTd mceSelected">AUTHORIZE\_ONLINE</td><td class="confluenceTd mceSelected">This indicates that the SDK returned an ARQC cryptogram using valid credentials and the POS will send the transaction online for authorization.

The SDK is not informed whether or not the issuer actually approved or declined the transaction since this information is only returned to the terminal.

Should be treated as transaction success on the MPA side.

</td><td class="confluenceTd mceSelected" colspan="1">Yes</td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">AUTHENTICATE\_OFFLINE</span></td><td class="confluenceTd mceSelected">This indicates that the POS requested a decline (AAC) with a CDA signature.

SDK will have returned a cryptogram using valid credentials and the POS can authenticate the card offline using the CDA signature.

Typically a POS will request a decline when it simply wants to authenticate that a legitimate digital card is being used without requesting any authorization.

Should be treated as transaction success on the MPA side.

</td><td class="confluenceTd mceSelected" colspan="1">Yes</td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">DECLINE\_BY\_TERMINAL</span></td><td class="confluenceTd mceSelected">The POS has requested a decline without a CDA signature. This may correspond to a real decline by the terminal, or (in rare cases) to an online authentication request.

Paying on the terminal with offline-only network connectivity can also return this callback.

<span class="markedContent">Application Cryptogram was generated with genuine credentials.</span>

Should be treated as transaction success on the MPA side.

</td><td class="confluenceTd mceSelected" colspan="1">Yes</td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">DECLINE\_BY\_CARD</span></td><td class="confluenceTd mceSelected">The digitized card has declined the transaction. A non-exhaustive list of possible reasons may be:

- Context mismatch between first and second tap
- Terminal is offline-only
- Terminal is a transit gate, and transit transactions are not allowed by the card profile
- Transaction is international, while the card profile is domestic-only

</td><td class="confluenceTd mceSelected" colspan="1">No</td></tr><tr><td class="confluenceTd mceSelected"><span class="inline-comment-marker" data-ref="eb10ac78-95d8-4275-a8a6-1010777c6da8">WALLET\_ACTION\_REQUIRED</span></td><td class="confluenceTd mceSelected">If the *getFinalDecisionForTransaction* returns an AUTHENTICATION\_REQUIRED status then this result will be returned.

The SDK will have declined the transaction but requested that the POS should keep the context active for a subsequent tap.

If the POS does not support mobile devices then the merchant may need to repeat the transaction with the same amount so that the second tap can take place.

</td><td class="confluenceTd mceSelected" colspan="1">No</td></tr></tbody></table>


####   


#### External libraries

The SDK uses several external Apache 2.0 libraries:

- com.nimbusds:nimbus-jose-jwt
- commons-codec:commons-codec
- com.fasterxml.jackson.core:jackson-core
- com.fasterxml.jackson.core:jackson-annotations
- com.fasterxml.jackson.core:jackson-databind
- com.fasterxml.jackson.module:jackson-module-kotlin
- io.insert-koin:koin-android
- io.reactivex.rxjava2:rxjava
- io.reactivex.rxjava2:rxandroid
- com.squareup.retrofit2:adapter-rxjava2
- com.squareup.retrofit2:retrofit
- com.squareup.retrofit2:converter
- com.squareup.okhttp3:logging
- com.squareup.okhttp3:okhttp<del class="diffdel"></del>
- com.google.zxing:core
- <del class="diffdel"></del>net.sf.flexjson:flexjson

## UCP SDK Setup

UCP SDK has to be configured every time when is used. Before UCP SDK usage Mobile DC SDK should be already configured.

### setup

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b1181dc1-aac2-4c0e-8e31-6b09aa2b3aa4" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-synchronous.-offline"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Synchronous. Offline.  
Contains all the necessary data to configure SDK.  
Should be called at the very beginning of the application lifecycle. For example in the Android Application::onCreate method.</p>

<p class="callout warning">**Important:** Before calling UCP SDK setup you must call setup from Mobile DC SDK.  
</p>

<p class="callout info"><u>Implementation of Application::on Create should be as quick as possible. Invocation time directly impacts on the performance of payment.</u></p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-12"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh" colspan="1">**Validation conditions**

</th></tr><tr><td class="confluenceTd">ucpConfiguration</td><td class="confluenceTd">UcpConfiguration</td><td class="confluenceTd">UCP configuration provided in builder described below.

</td><td class="confluenceTd" colspan="1">Not empty.</td></tr></tbody></table>

**UcpConfigurationBuilder** contains the following methods:

<table class="relative-table wrapped confluenceTable" id="bkmrk-metod-parameter-desc"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Metod**</th><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**

</th></tr><tr><td class="confluenceTd" colspan="1">withApplication</td><td class="confluenceTd" colspan="1">Application</td><td class="confluenceTd" colspan="1">Application context.</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd">withCvmModel</td><td class="confluenceTd">WalletCvmModel (enum)</td><td class="confluenceTd">Customer Verification Method: CDCVM\_ALWAYS, FLEXIBLE\_CDCVM, CARD\_LIKE

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd">withUserAuthMode</td><td class="confluenceTd">WalletAuthMode (enum)</td><td class="confluenceTd">User authentication mode: WALLET\_PIN, CUSTOM, NONE

Contact Verestro to select proper configuration

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd"><span class="inline-comment-marker" data-ref="e01423e9-624c-4dbc-b4b6-892ce67f4e66">withUcpPaymentInstrumentEventListener</span>

</td><td class="confluenceTd">UcpPaymentInstrumentEventListener

</td><td class="confluenceTd">Global listener for actions on PaymentInstrument.

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd"><span class="inline-comment-marker" data-ref="a5682a66-0bf0-46a2-a368-2704014a3b24">withUcpTransactionEventListener</span></td><td class="confluenceTd">UcpTransactionEventListener

</td><td class="confluenceTd">Global listener for actions during transaction processing

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">withTransactionAcceptanceEventListener</td><td class="confluenceTd" colspan="1">UcpTransactionAcceptanceEventListener</td><td class="confluenceTd" colspan="1">Global listener which allow application take final decision about transaction acceptance during transaction</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd">withReplenishThreshold</td><td class="confluenceTd">Int</td><td class="confluenceTd">Number of credentials below which replenish process will automatically begin

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd"><span class="inline-comment-marker" data-ref="4d39da91-8e0f-477d-9549-efa093d2069d">withMcbpPinningCertificates</span></td><td class="confluenceTd">List&lt;String&gt;</td><td class="confluenceTd">List of public key certificates in PEM format.

Pass list with empty String if *withOptionalUcpMcbpHttpExecutor*mentioned below is used with custom HTTP communication.

</td><td class="confluenceTd">Not empty List

</td></tr><tr><td class="confluenceTd" colspan="1">withOptionalEventsReports</td><td class="confluenceTd" colspan="1">UcpEventReportListener</td><td class="confluenceTd" colspan="1"><span class="inline-comment-marker" data-ref="c2970197-56be-4e91-8754-2e76fc136377">Global listener for most important internal SDK actions related to token management. Could be useful for logs grabbing and debugging on debug.  
</span></td><td class="confluenceTd" colspan="1">Optional</td></tr><tr><td class="confluenceTd" colspan="1">withOptionalExternalWalletServer</td><td class="confluenceTd" colspan="1">Boolean</td><td class="confluenceTd" colspan="1">Prepares SDK for using external wallet server.</td><td class="confluenceTd" colspan="1">Optional</td></tr><tr><td class="confluenceTd" colspan="1">withOptionalUcpMcbpHttpExecutor</td><td class="confluenceTd" colspan="1">UcpMcbpHttpExecutor/DefaultUcpMcbpHttpExecutor</td><td class="confluenceTd" colspan="1">Global listener for connection between SDK and MasterCards API. Could be use for adding action before connection - use DefaultUcpMcbpHttpExecutor or for completely replace this connection - use UcpMcbpHttpExecutor.</td><td class="confluenceTd" colspan="1">Optional</td></tr><tr><td class="confluenceTd" colspan="1">withOptionalUcpReProvisionEventListener</td><td class="confluenceTd" colspan="1">UcpReProvisionEventListener</td><td class="confluenceTd" colspan="1">Global listener for actions during reprovisioning.</td><td class="confluenceTd" colspan="1">Optional</td></tr></tbody></table>

**UcpPaymentInstrumentEventListener**

Contains callbacks for PaymentInstrument.

<table class="relative-table wrapped confluenceTable" id="bkmrk-method-name-paramete"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Method name**</th><th class="confluenceTh">**Parameters**</th><th class="confluenceTh">**Description**

</th></tr><tr><td class="confluenceTd">onProvisioningSuccess</td><td class="confluenceTd">paymentInstrument: PaymentInstrument

</td><td class="confluenceTd">Method called after provisioning process. Information about PaymentInstrument activation process will be provided in onPaymentInstrumentStatusChanged callback described below

</td></tr><tr><td class="confluenceTd">onProvisioningFailure</td><td class="confluenceTd">errorMessage: String?,

exception: Exception?

</td><td class="confluenceTd">Method called after provisioning failure. Try processing digitization again

</td></tr><tr><td class="confluenceTd">onReplenishSuccess</td><td class="confluenceTd">paymentInstrument: PaymentInstrument

numberOfTransactionCredentials: Int

</td><td class="confluenceTd">Method called after successfully transaction credentials replenish. Provides information about PaymentInstrument and number of new transaction credentials.

Depending on flow is called after activation process and when requested by SDK based on *replenishThreshold* configuration.

**Note:** Replenish could be called just after transaction based on *withRplenishThreshold* configuration. It's recommended to not do complex process here. It could affect on next transaction processing time when multiple transactions are done in row

</td></tr><tr><td class="confluenceTd"> onReplenishFailure</td><td class="confluenceTd">paymentInstrument: PaymentInstrument,

errorMessage: String?,

exception: Exception?

</td><td class="confluenceTd">Method called after replenish failure with PaymentInstrument

**Note:** Replenish could be called just after transaction based on *withRplenishThreshold* configuration. It's recommended to not do complex process here. It could affect on next transaction processing time when multiple transactions are done in row

</td></tr><tr><td class="confluenceTd">onPaymentInstrumentStatusChanged</td><td class="confluenceTd">newStatus: PaymentInstrumentStatus

paymentInstrumentId: String

</td><td class="confluenceTd">Provides information about PaymentInstrumentStatus state (check model) for selected payment instrument id

</td></tr><tr><td class="confluenceTd" colspan="1">onNewTransaction</td><td class="confluenceTd" colspan="1">newTransaction: <span class="inline-comment-marker" data-ref="0cd57191-533f-4d1d-ac3e-3a5e723c1394">NewTransaction</span>

</td><td class="confluenceTd" colspan="1">Provides online result with details of transaction processed in UCP

Works only when application is online

</td></tr></tbody></table>

**UcpTransactionEventListener**

Callbacks related to transaction process.

<p class="callout warning">**Important:** It's recommended to not do complex process in there callbacks. It could <span lang="en">significantly</span> affect on transaction processing time.</p>

<table class="wrapped confluenceTable" id="bkmrk-method-name-paramete-0"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Method name</th><th class="confluenceTh">Parameters</th><th class="confluenceTh">Description

</th></tr><tr><td class="confluenceTd">onAuthRequiredForContactless

</td><td class="confluenceTd">paymentInstrument: PaymentInstrument, transactionInformation: <s>ContactlessTransactionInformation</s>  
transactionData: ContactlessTransactionData

</td><td class="confluenceTd">Called when user authentication is required during contactless transaction

ContactlessTransactionInformation is deprecated in version 2.2.4.

</td></tr><tr><td class="confluenceTd">onAuthRequiredForDsrp

</td><td class="confluenceTd">paymentInstrument: PaymentInstrument, dsrpTransactionInfo: DsrpTransactionInfo

</td><td class="confluenceTd">Called when user authentication is required during Dsrp transaction

</td></tr><tr><td class="confluenceTd">onAuthTimerUpdated</td><td class="confluenceTd">secondsRemaining: Int</td><td class="confluenceTd">Called on every update of remaining time for performing transaction, as SDK starts transaction timer based on card profile configuration

</td></tr><tr><td class="confluenceTd">onContactlessPaymentCompleted

</td><td class="confluenceTd">paymentInstrument: PaymentInstrument  
transactionInformation: <s>ContactlessTransactionInformation</s>

transactionResult: ContactlessTransactionResult  
transactionData : ContactlessTransactionData

</td><td class="confluenceTd">Called when transaction is completed with information about transaction and result.

ContactlessTransactionInformation is deprecated in version 2.2.4.

</td></tr><tr><td class="confluenceTd">onContactlessPaymentIncident

</td><td class="confluenceTd">paymentInstrument: PaymentInstrument,

exception: Exception

</td><td class="confluenceTd">Called when something went wrong during transaction and Mastercard marked transaction as incident

</td></tr><tr><td class="confluenceTd">onContactlessPaymentAborted

</td><td class="confluenceTd">paymentInstrument: PaymentInstrument?,

abortReason: TransactionAbortReason,

exception: Exception

</td><td class="confluenceTd">Called when transaction is aborted during payment from some reason described in method parameter

PaymentInstrument could be null if abortReason = TransactionAbortReason.NO\_CARDS is returned.

</td></tr><tr><td class="confluenceTd">onTransactionStopped

</td><td class="confluenceTd">  
</td><td class="confluenceTd">Method called on transaction stopped by SDK

</td></tr></tbody></table>

**UcpTransactionAcceptanceEventListener**

Callbacks related to transaction process.

<p class="callout warning">**Important:** It's recommended to not do complex process in there callbacks. It could <span lang="en">significantly</span> affect on transaction processing time.</p>

<table class="relative-table wrapped confluenceTable" id="bkmrk-method-name-paramete-1"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Method name**</th><th class="confluenceTh">**Parameters**</th><th class="confluenceTh">**Description**

</th></tr><tr><td class="confluenceTd">getFinalDecisionForTransaction

</td><td class="confluenceTd"><span class="inline-comment-marker" data-ref="6d6b39f4-d179-4d4b-9722-41d965d00c4b">isUserAuthenticated : Boolean</span>

<span class="inline-comment-marker" data-ref="6d6b39f4-d179-4d4b-9722-41d965d00c4b">recommendedAdvice : ContactlessAdvice</span>

<span class="inline-comment-marker" data-ref="6d6b39f4-d179-4d4b-9722-41d965d00c4b">trasactionInformation : <s>ContactlessTransactionInformation</s></span>

<span class="inline-comment-marker" data-ref="6d6b39f4-d179-4d4b-9722-41d965d00c4b">transactionData : ContactlessTransactionData  
</span>

</td><td class="confluenceTd"><span class="inline-comment-marker" data-ref="9e549d88-6ffd-42a0-a7ea-65d7457c8f90">Called on every transaction for the final decision about transaction processing</span>

<span class="inline-comment-marker" data-ref="9e549d88-6ffd-42a0-a7ea-65d7457c8f90">An application can decide based on information about authentication, transaction details like amount, currency, and transaction types</span>

<span class="inline-comment-marker" data-ref="9e549d88-6ffd-42a0-a7ea-65d7457c8f90">The method also provide recommended by MCBP advice based on transaction</span>

<span class="inline-comment-marker" data-ref="9e549d88-6ffd-42a0-a7ea-65d7457c8f90">ContactlessTransactionInformation is deprecated in version 2.2.4.</span>

</td></tr></tbody></table>

**UcpEventReportsListener**

<table class="relative-table wrapped confluenceTable" id="bkmrk-method-name-paramete-2"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Method name**</th><th class="confluenceTh">**Parameters**</th><th class="confluenceTh">**Description**

</th></tr><tr><td class="confluenceTd">onNewReport

</td><td class="confluenceTd">report: Report

</td><td class="confluenceTd">Return logs related to token management.

</td></tr></tbody></table>

**UcpReProvisionEventListener**

Called when transaction is completed with information about transaction and result.

ContactlessTransactionInformation is deprecated in version 2.2.4.

<table class="wrapped confluenceTable" id="bkmrk-method-name-paramete-3"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Method Name**</th><th class="confluenceTh">**Parameters**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">onReProvisionSuccess</td><td class="confluenceTd">paymentInstrument: PaymentInstrument</td><td class="confluenceTd">Method called after reProvisioning process.   
Information about PaymentInstrument activation process will be provided in onPaymentInstrumentStatusChanged callback.

</td></tr><tr><td class="confluenceTd" colspan="1">onReProvisionFailure</td><td class="confluenceTd" colspan="1">paymentInstrument : PaymentInstrument

errorMessage : String?

exception : Exception?

</td><td class="confluenceTd" colspan="1">Method called after reProvisioning failure. Try again.

</td></tr></tbody></table>

**UcpMcbpHttpExecutor**

<table class="relative-table wrapped confluenceTable" id="bkmrk-method-name-paramete-4"><colgroup><col></col><col></col><col></col></colgroup><thead><tr><th class="confluenceTh">Method name

</th><th class="confluenceTh">Parameters

</th><th class="confluenceTh">Description

</th></tr></thead><tbody><tr><td class="confluenceTd">execute

</td><td class="confluenceTd">ucpMcbpRequestType: UcpMcbpHttpExecutorRequestTypeucpMcbpHttpMethod:

UcpMcbpHttpMethodurl: StringrequestData:

AnyrequestProperties:

Map&lt;String, String&gt;

</td><td class="confluenceTd">Called on every time if SDK want to connect to MasterCard and should return UcpMcbpHttpResponse.

requestData could be one of request data type: UcpMcbpRequestSessionRequestData,  
UcpMcbpReplenishRequestData, UcpMcbpProvisionRequestData, UcpMcbpNotifyProvisioningResultRequestData,  
UcpMcbpChangeMobilePinRequestData, UcpMcbpDeleteRequestData.

```
ucpMcbpHttpMethod could be one of: POST, GET.
```

```
ucpMcbpRequestType could be one of: REQUEST_SESSION, REPLENISH, PROVISION,<br></br>NOTIFY_PROVISIONING_RESULT, CHANGE_MOBILE_PIN, DELETE.
```

</td></tr></tbody></table>

**DefaultUcpMcbpHttpExecutor**

<table class="relative-table wrapped confluenceTable" id="bkmrk-method-name-paramete-5"><colgroup><col></col><col></col><col></col></colgroup><thead><tr><th class="confluenceTh">Method name

</th><th class="confluenceTh">Parameters

</th><th class="confluenceTh">Description

</th></tr></thead><tbody><tr><td class="confluenceTd">execute

</td><td class="confluenceTd">ucpMcbpRequestType: UcpMcbpHttpExecutorRequestType

ucpMcbpHttpMethod: UcpMcbpHttpMethod

url: String

requestData: Any

requestProperties: Map&lt;String, String&gt;

</td><td class="confluenceTd">Called on every time if SDK want to connect to MasterCard and should return super.execute method.

requestData could be one of request data type: UcpMcbpRequestSessionRequestData,  
UcpMcbpReplenishRequestData, UcpMcbpProvisionRequestData, UcpMcbpNotifyProvisioningResultRequestData,  
UcpMcbpChangeMobilePinRequestData, UcpMcbpDeleteRequestData.

```
ucpMcbpHttpMethod could be one of: POST, GET.
```

```
ucpMcbpRequestType could be one of: REQUEST_SESSION, REPLENISH, PROVISION,<br></br>NOTIFY_PROVISIONING_RESULT, CHANGE_MOBILE_PIN, DELETE.
```

</td></tr></tbody></table>

  
**Output**

No output.

<span class="inline-comment-marker" data-ref="e549c1d0-32d9-408c-a644-7043266241c5">Sample</span>

**UcpTransactionEventListener**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="f95cd121-bc54-44fb-8357-739aa373e85a" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2F-ucptransactioneve"><tbody><tr><td class="wysiwyg-macro-body">```
// UcpTransactionEventListener comments

class BankingAppUcpTransactionEventListener : UcpTransactionEventListener {

    override fun onAuthRequiredForContactless(event: EventAuthRequiredForContactless) {
        //authorization is required for transaction, open payment screen with authorization
        //show PaymentInstrument and ContactlessTransactionData available in event object

        showPaymentScreen(event.paymentInstrument, event.transactionData)
    }


    override fun onAuthRequiredForDsrp(event: EventAuthRequiredForDsrp) {
        //authorization is required for transaction, open payment screen with authorization
        //show PaymentInstrument and DSRP transaction information available in event object

        showPaymentScreen(event.paymentInstrument, event.dsrpTransactionInfo)
    }

    override fun onAuthTimerUpdated(event: EventAuthTimerUpdated) {
        //check if user is on payment screen and update timer
        //when timer is 0, application should close payment with failure
    }

    override fun onContactlessPaymentAborted(event: EventContactlessPaymentAborted) {
        //looks like payment is aborted, can provide result to payment screen 
        //and show user what is abort reason
    }

    override fun onContactlessPaymentCompleted(event: EventContactlessPaymentCompleted) {
        //payment completed, provide result to payment information
        //REMEMBER Transaction is processed on terminal and this is where 
        //you will see final transaction result
    }

    override fun onContactlessPaymentIncident(event: EventContactlessPaymentIncident) {
        //something went wrong during transaction, provide result to user
    }

    override fun onTransactionStopped() {
        //transaction is stopped by SDK, inform user and try again
    }
}
```

</td></tr></tbody></table>

**UcpPaymentInstrumentEventListener**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="597e1056-57b0-45d3-a5b0-ec74775319fe" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-class-bankingapppaym"><tbody><tr><td class="wysiwyg-macro-body">```
class BankingAppPaymentInstrumentEventListener : UcpPaymentInstrumentEventListener {

    override fun onNewTransaction(event: EventNewTransaction) {
        //information about new transaction processed by issuer
    }

    override fun onPaymentInstrumentStatusChanged(event: EventPaymentInstrumentStatusChanged) {
        //status of payment instrument was changed, refresh list, inform user about new status
    }

    override fun onProvisioningFailure(event: EventProvisioningFailure) {
        //provisioning failed, try again
    }

    override fun onProvisioningSuccess(event: EventProvisioningSuccess) {
        //provisioning success, wait for status and replenish changes until user can pay 
        //or provide activation method when required
    }

    override fun onReplenishFailure(event: EventReplenishFailure) {
        //transaction credentials replenish failed
    }

    override fun onReplenishSuccess(event: EventReplenishSuccess) {
        //transaction credentials replenish success
    }
}
```

</td></tr></tbody></table>

**UcpTransactionAcceptanceEventListener**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="d25ff082-144f-4320-b2bf-49db69852c0e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-class-bankingappucpt"><tbody><tr><td class="wysiwyg-macro-body">```
class BankingAppUcpTransactionAcceptanceEventListener : UcpTransactionAcceptanceEventListener {

    //Sample implementation of transaction acceptance listener

    override fun getFinalDecisionForTransaction(event: EventGetFinalDecision): ContactlessAdvice {

        val isScreenUnlocked = isScreenUnlocked()
        val isScreenProtectedByKeyguard = isScreenUnlocked()

        val isLvtTransaction =
            event.transactionInformation.transactionRange == ContactlessTransactionRange.LVT

        //discard all Transit transaction
        if (event.transactionInformation.richTransactionType == ContactlessRichTransactionType.TRANSIT) {
            return ContactlessAdvice.DECLINE
        }

        //allow for transaction when user is authenticated for payment and screen unlocked
        if (event.isUserAuthenticated && isScreenUnlocked) {
            return ContactlessAdvice.PROCEED
        }

        //allow for LVT transaction on unlocked screen when protected and don't require authentication
        if (isLvtTransaction && isScreenProtectedByKeyguard && isScreenUnlocked) {
            return ContactlessAdvice.PROCEED
        }

        // ...
        // much more cases

        //require authentication anyway
        return ContactlessAdvice.AUTHENTICATION_REQUIRED
    }
}
```

</td></tr></tbody></table>

**UcpEventReportsListener**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="594bbdc2-a343-41e2-8554-b74d8411ec8e" data-macro-name="code" data-macro-schema-version="1" id="bkmrk-class-bankreporteven"><tbody><tr><td class="wysiwyg-macro-body">```
class BankReportEventListener : UcpEventReportsListener {

    override fun onNewReport(report: Report) {
       //print log for debugging, etc.
  	}
}
```

</td></tr></tbody></table>

**UcpMcbpHttpExecutor**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="d3abd2c6-fa50-4d28-b215-7776e03857ef" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2Fuse-ucpmcbphttpexe"><tbody><tr><td class="wysiwyg-macro-body">```
//Use UcpMcbpHTtpExecutor as supertype if you want to replace connection
class BankUcpMcbpHttpExecutor : UcpMcbpHttpExecutor {
 
    override fun execute(
        ucpMcbpRequestType: UcpMcbpHttpExecutorRequestType,
        ucpMcbpHttpMethod: UcpMcbpHttpMethod,
        url: String,
        requestData: Any,
        requestProperties: Map<String, String>
    ): UcpMcbpHttpResponse {
 
 
        //additional action before request
 
 
        //invoke connect by custom connector
        return when (ucpMcbpRequestType) {
            UcpMcbpHttpExecutorRequestType.REQUEST_SESSION -> {
                executeRequestSession(ucpMcbpHttpMethod, url, requestData as UcpMcbpRequestSessionRequestData, 
                requestProperties)
            }
            UcpMcbpHttpExecutorRequestType.PROVISION -> {
                executeProvision(ucpMcbpHttpMethod, url, requestData as UcpMcbpProvisionRequestData, 
                requestProperties)
            }
            UcpMcbpHttpExecutorRequestType.REPLENISH -> {
                executeReplenish(ucpMcbpHttpMethod, url, requestData as UcpMcbpReplenishRequestData, 
                requestProperties)
            }
            UcpMcbpHttpExecutorRequestType.NOTIFY_PROVISIONING_RESULT -> {
                executeNotifyProvisioningResult(ucpMcbpHttpMethod, url, 
                requestData as UcpMcbpNotifyProvisioningResultRequestData, requestProperties)
            }
            UcpMcbpHttpExecutorRequestType.CHANGE_MOBILE_PIN -> {
                executeChangeMobilePin(ucpMcbpHttpMethod, url, 
                requestData as UcpMcbpChangeMobilePinRequestData, requestProperties)
            }
            UcpMcbpHttpExecutorRequestType.DELETE -> {
                executeDelete(ucpMcbpHttpMethod, url, requestData as UcpMcbpDeleteRequestData, 
                requestProperties)
            }
        }
    }
}
```

</td></tr></tbody></table>

**DefaultUcpMcbpHttpExecutor**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="806653f8-cb70-4ee6-b03a-af2146adbda9" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2Fuse-defaultucpmcbp"><tbody><tr><td class="wysiwyg-macro-body">```
//Use DefaultUcpMcbpHTtpExecutor as supertype if you want to only add some action before connection
class BankDefaultUcpMcbpHttpExecutor : DefaultUcpMcbpHttpExecutor() {
    override fun execute(
        ucpMcbpRequestType: UcpMcbpHttpExecutorRequestType,
        ucpMcbpHttpMethod: UcpMcbpHttpMethod,
        url: String,
        requestData: Any,
        requestProperties: Map<String, String>
    ): UcpMcbpHttpResponse {
 
        //additional action before request
 
        return super.execute(
            ucpMcbpRequestType,
            ucpMcbpHttpMethod,
            url,
            requestData,
            requestProperties
        )
    }
}
```

</td></tr></tbody></table>

**UcpReProvisionEventListener**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="0b90198d-9290-4443-86c6-3b0a6bd847ea" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-class-bankingappucpr"><tbody><tr><td class="wysiwyg-macro-body">```
class BankingAppUcpReProvisiongEventListener : UcpReProvisionEventListener() {
     override fun onReProvisionSuccess(event: EventReProvisionSuccess) {
     	//reProvisioning success, wait for status and replenish changes until user can pay 
  	}
 	
	override fun onReProvisionFailure(event: EventReProvisionFailure) {
       //reProvisioning failed, try again.
  	}
}
```

</td></tr></tbody></table>

**Sample UCP SDK setup implementation:**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="6b18f40a-c6e5-4a00-b778-5ad8749ac94a" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-setup%28-applicati"><tbody><tr><td class="wysiwyg-macro-body">```
fun setup(
    application: Application,
    walletCvmModel: WalletCvmModel,
    walletAuthUserMode: WalletAuthUserMode,
    mcbpPinningCertificates: List<String>,
    replenishThreshold: Int
) {

    val ucpConfiguration = UcpConfiguration.create(
        UcpConfigurationBuilder()
            .withApplication(application)
            .withCvmModel(walletCvmModel)
            .withUserAuthMode(walletAuthUserMode)
            .withUcpTransactionEventListener(BankingAppUcpTransactionEventListener())
            .withUcpPaymentInstrumentEventListener(BankingAppPaymentInstrumentEventListener())
            .withMcbpPinningCertificates(mcbpPinningCertificates)
            .withUcpTransactionAcceptanceEventListener(BankingAppUcpTransactionAcceptanceEventListener())
            .withReplenishThreshold(replenishThreshold)
			.withOptionalEventsReports(BankReportEventListener())
    		.withOptionalUcpMcbpHttpExecutor(BankUcpMcbpHttpExecutor())
			//if you want to only add additional action before connection use below implementation
			//.withOptionalUcpMcbpHttpExecutor(BankDefaultUcpMcbpHttpExecutor())
			.withOptionalUcpReProvisionEventListener(BankingAppUcpReProvisionEventListener())
    )

    UcpApiKotlin().setup(ucpConfiguration)
}
```

</td></tr></tbody></table>

### reset (DEPRECATED - use restart instead)

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b1181dc1-aac2-4c0e-8e31-6b09aa2b3aa4" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-synchronous.-offline-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Synchronous. Offline.  
Method for resetting SDK to uninitialized state.  
**NOTE:** According to MCBP Deployment team there is no possibility for resetting SDK without killing application process for clearing all MC SDK local variables. **<span class="inline-comment-marker" data-ref="446c57fc-0c0a-4914-bf39-874fb230ecc1">Please kill application process after using this method</span>**<span class="inline-comment-marker" data-ref="446c57fc-0c0a-4914-bf39-874fb230ecc1">. Trying using any facade method without stopping application process will cause throwing UcpSdkException.   
</span><span class="inline-comment-marker" data-ref="446c57fc-0c0a-4914-bf39-874fb230ecc1">To avoid closing application use restart() methods.  
</span></p>

</td></tr></tbody></table>

**Input**

No input.

**Output**

No output.

**Sample**

**Sample UCP SDK reset implementation:**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="d3abd2c6-fa50-4d28-b215-7776e03857ef" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-reset%28%29-%7B-ucpapi"><tbody><tr><td class="wysiwyg-macro-body">```
fun reset() {
    UcpApiKotlin().reset()

	//Terminating JVM according to MC SDK Sample Application
    Runtime.getRuntime().exit(0);
}
```

</td></tr></tbody></table>

### restart

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b1181dc1-aac2-4c0e-8e31-6b09aa2b3aa4" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-synchronous.-offline-1"><tbody><tr><td class="wysiwyg-macro-body">Synchronous. Offline.

Method for resetting SDK to uninitialized state.

Replaces reset() method which requires killing application process.

When restart finishes with error, application should repeat action.

**NOTE:** SDK must be already initialized to call restart() method. During restart() SDK internally initializes SDK again.

</td></tr></tbody></table>

**Input**

No input.

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e51e890a-09ee-49e9-8443-c0ded3d4e3de" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-whe"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback when SDK data is cleared and SDK is ready to use again. No any action is required to call facade methods.</p>

<p class="callout danger">Failure callback when something went wrong during restart. Application should repeat action.</p>

</td></tr></tbody></table>

**Sample**

**Sample UCP SDK reset implementation:**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="d3abd2c6-fa50-4d28-b215-7776e03857ef" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-ucpapikotlin%28%29.resta"><tbody><tr><td class="wysiwyg-macro-body">```
UcpApiKotlin().restart({
    //restart finished with success. UCP & MDC data is cleared, SDK is now ready to use without calling MDC & UCP setup methods
}, {
    //some error occured, please repeat action
})
```

</td></tr></tbody></table>

##   
Cards domain  


### delete

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.|  
Method allows delete PaymentInstument from UCP.  
Payment token will be removed remote and local storage.  
Result of action will be notified with *onPaymentInstrumentStatusChanged*.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-13"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of PaymentInstrument to delete

</td><td class="confluenceTd">Not empty.</td></tr><tr><td class="confluenceTd" colspan="1">reason</td><td class="confluenceTd" colspan="1">CharArray?</td><td class="confluenceTd" colspan="1">Optional reason of deletion

</td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="dcd90cf0-b262-4524-b6fe-3b8cff9622cb" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8df40eef-c58c-4cd5-9453-d934b38c602e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-delete%28paymentin"><tbody><tr><td class="wysiwyg-macro-body">```
fun delete(paymentInstrumentId: String, reason: CharArray?) {
    ucpApi.cardsService
            .delete(paymentInstrumentId, reason,
                    {
                        //PaymentInstrument delete requested
                        //wait for confirmation from onPaymentInstrumentStatusChanged
                    },
                    { throwable ->
                        //Something went wrong, check excetpion with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### checkEligibility

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Check eligibility required to process digitize.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table confluenceTable" id="bkmrk-parameter-type-descr-14"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">checkEligibility</td><td class="confluenceTd">CheckEligibility</td><td class="confluenceTd">CheckEligibility object

</td></tr></tbody></table>

CheckEligibility

<table class="relative-table confluenceTable" id="bkmrk-parameter-type-descr-15"><colgroup><col></col><col></col><col></col></colgroup><thead><tr><th class="confluenceTh">**Parameter**

</th><th class="confluenceTh">**Type**

</th><th class="confluenceTh">**Description**

</th></tr></thead><tbody><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Identifier of payment instrument

</td></tr><tr><td class="confluenceTd">paymentInstrumentType</td><td class="confluenceTd">PaymentInstrumentType</td><td class="confluenceTd">Payment instrument type. One of: \[MASTERCARD\]

</td></tr><tr><td class="confluenceTd" colspan="1">userLanguage</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">User language</td></tr><tr><td class="confluenceTd" colspan="1">userCountry</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">User country</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9b441ed3-52d6-4cd8-a6ba-ab0c8adbec43" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with CheckEligibilityResult.</p>

</td></tr></tbody></table>

CheckEligibilityResult

<table class="relative-table confluenceTable" id="bkmrk-parameter-type-descr-16"><colgroup><col></col><col></col><col></col></colgroup><thead><tr><th class="confluenceTh">**Parameter**

</th><th class="confluenceTh">**Type**

</th><th class="confluenceTh">**Description**

</th></tr></thead><tbody><tr><td class="confluenceTd">termsAndConditionsAssetId</td><td class="confluenceTd">String</td><td class="confluenceTd">Identifier of Terms and Conditions asset

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="cf58172a-fbda-4ffa-af0f-0ba7e291634e" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8df40eef-c58c-4cd5-9453-d934b38c602e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-private-fun-checkeli"><tbody><tr><td class="wysiwyg-macro-body">```
private fun checkEligibility(
    paymentInstrumentId: String,
    paymentInstrumentType: PaymentInstrumentType,
    userLanguage: String,
    userCountry: String
) {

    ucpApi.cardsService
        .checkEligibility(
            CheckEligibility(
                paymentInstrumentId,
                paymentInstrumentType,
                userLanguage,
                userCountry
            ),
            { checkEligibilityResult ->
                //Handle result
            },
            { throwable ->
                //Something went wrong, check exception with documentation
            }
        )
}
```

</td></tr></tbody></table>

### digitize 

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="a54b4d7c-d37c-434c-98d3-7a795fca28b1" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-1"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Use only when *checkEligibility* method is used.  
Creates payment token in UCP backend.  
Expect push after successful finish and then proceed using process method in Cloud Messaging domain.</p>

</td></tr></tbody></table>

####   


**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-17"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Parameter</th><th class="confluenceTh">Type</th><th class="confluenceTh">Description</th><th class="confluenceTh">Validation conditions</th></tr><tr><td class="confluenceTd">digitizationRequest</td><td class="confluenceTd">DigitizationRequest</td><td class="confluenceTd">Plain object of DigitizationRequest

</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

DigitizationRequest object contains following fields:

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-18"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Identifier of payment instrument

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">paymentInstrumentType</td><td class="confluenceTd" colspan="1">PaymentInstrumentType</td><td class="confluenceTd" colspan="1">Payment instrument type. One of: \[MASTERCARD\]

</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1"><span class="inline-comment-marker" data-ref="8d18a631-d814-480a-b35c-d2a68e3024ca">securityCode</span></td><td class="confluenceTd" colspan="1">CharArray?</td><td class="confluenceTd" colspan="1">Optional. The CVC2 for the card to be digitized</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

####   


**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e51e890a-09ee-49e9-8443-c0ded3d4e3de" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with DigitizationResult object</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-19"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">digitizationResult</td><td class="confluenceTd">DigitizationResult</td><td class="confluenceTd"><span class="inline-comment-marker" data-ref="0b849460-ccc7-4dd0-a6e4-e930d9eb4b7f">Plain object of DigitizationResult</span>

</td></tr></tbody></table>

DigitizationResult contains following fields.

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-20"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstrument</td><td class="confluenceTd">PaymentInstrument</td><td class="confluenceTd">Plain object of PaymentInstrument

</td></tr><tr><td class="confluenceTd" colspan="1">additionalAuthenticationMethods</td><td class="confluenceTd" colspan="1">List&lt;AdditionalAuthenticationMethod&gt;?</td><td class="confluenceTd" colspan="1">All available additional authentication method</td></tr><tr><td class="confluenceTd" colspan="1">productConfig</td><td class="confluenceTd" colspan="1">ProductConfig</td><td class="confluenceTd" colspan="1">Plain object of ProductConfig, contains Payment Token configuration</td></tr></tbody></table>

ProductConfig contains following fields.

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-21"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">isCoBranded</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Whether the product is co-branded</td></tr><tr><td class="confluenceTd" colspan="1">coBrandName</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Name of the co-branded partner</td></tr><tr><td class="confluenceTd" colspan="1">foregroundColor</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Foreground color, used to overlay text on top of the card image</td></tr><tr><td class="confluenceTd" colspan="1">backgroundColor</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Background color, used to overlay text on top of the card image</td></tr><tr><td class="confluenceTd" colspan="1">labelColor</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Label color of the mobile wallet entry for the card</td></tr><tr><td class="confluenceTd" colspan="1">issuerName</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Name of the issuing bank</td></tr><tr><td class="confluenceTd">shortDescription</td><td class="confluenceTd">String</td><td class="confluenceTd">A short description for this product</td></tr><tr><td class="confluenceTd" colspan="1">longDescription</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">A long description for this product</td></tr><tr><td class="confluenceTd" colspan="1">custoremServiceUrl</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Customer service website of the issuing bank</td></tr><tr><td class="confluenceTd" colspan="1">customerServiceEmail</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Customer service email address of issuing bank</td></tr><tr><td class="confluenceTd" colspan="1">customerServicePhoneNumber</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Customer service phone number of the issuing bank</td></tr><tr><td class="confluenceTd" colspan="1">productConfigIssuer</td><td class="confluenceTd" colspan="1">ProductConfigIssuer?</td><td class="confluenceTd" colspan="1">Contains one or more mobile app details that may be used to deep link from the Mobile Payment App to the issuer mobile app</td></tr><tr><td class="confluenceTd" colspan="1">onlineBankingLoginUrl</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Login URL for the issuing bank's online banking website</td></tr><tr><td class="confluenceTd" colspan="1">termsAndConditionsUrl</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">URL linking to the issuing bank's terms and conditions for this product</td></tr><tr><td class="confluenceTd" colspan="1">privacyPolicyUrl</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">URL linking to the issuing bank's privacy policy for this product</td></tr><tr><td class="confluenceTd" colspan="1">issuerProductConfigCode</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Freeform identifier for this product configuration as assigned by the issuer</td></tr><tr><td class="confluenceTd" colspan="1">contactName</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Name of the issuing bank</td></tr><tr><td class="confluenceTd" colspan="1">bankAppName</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Name of banking application for display</td></tr><tr><td class="confluenceTd" colspan="1">bankAppAddress</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The package name for the destination mobile application</td></tr><tr><td class="confluenceTd" colspan="1">unsupportedPresentationTypes</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The presentation types that are not supported such as "MSR" (for example). This is an advisory field to tell the wallet provider that they should not include the unsupported presentation type returned in this field in the provisioning request</td></tr><tr><td class="confluenceTd" colspan="1">unsupportedCardVerificationTypes</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The card verification types that are not supported such as "AVS" (for example). This is an advisory field to let the wallet provider know which card verification services are not supported for a given payment instrument. The wallet provider can use this information to relax any field validations on the Customer UI (such as Address)</td></tr><tr><td class="confluenceTd" colspan="1">issuerFlags</td><td class="confluenceTd" colspan="1">List&lt;ProductConfigIssuerFlags&gt;?</td><td class="confluenceTd" colspan="1">List of plain ProductConfigIssuerFlags object. Contains issuer flags</td></tr><tr><td class="confluenceTd" colspan="1">brandLogoAssetId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The Mastercard or Maestro brand logo associated with this card. Provided as an Asset ID</td></tr><tr><td class="confluenceTd" colspan="1">issuerLogoAssetId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The logo of the issuing bank. Provided as a Asset ID</td></tr><tr><td class="confluenceTd" colspan="1">coBrandLogoAssetId</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The co-brand logo (if any) for this product. Provided as an Asset ID</td></tr><tr><td class="confluenceTd" colspan="1">cardBackgroundCombinedAssetId</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The card image used to represent the digital card in the wallet. This ‘combined’ option contains the Mastercard, bank and any co-brand logos. Provided as an Asset ID</td></tr><tr><td class="confluenceTd" colspan="1">cardBackgroundAssetId</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">The card image used to represent the digital card in the wallet. This ‘non-combined’ option does not contain the Mastercard, bank, or cobrand logos. Provided as an Asset ID</td></tr><tr><td class="confluenceTd" colspan="1">iconAssetId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The icon representing the primary brand(s) associated with this product. Provided as an Asset ID</td></tr></tbody></table>

ProductConfigIssuer contains following fields.

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-22"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">openIssuerAndroidIntent</td><td class="confluenceTd">ProductConfigOpenIssuerAndroidIntent?</td><td class="confluenceTd">AndroidIntent object can be used to open the issuer mobile app</td></tr><tr><td class="confluenceTd">activateWithIssuerAndroidIntent</td><td class="confluenceTd">ProductConfigActivateWithIssuerAndroidIntent?</td><td class="confluenceTd">AndroidIntent object can be used to open the issuer mobile app</td></tr><tr><td class="confluenceTd" colspan="1">openIssuerIOSDeepLinkingUrl</td><td class="confluenceTd" colspan="1">ProductConfigOpenIssuerIOSDeepLinkingUrl?</td><td class="confluenceTd" colspan="1">IOSDeepLinkingUrl object can be used to open the issuer mobile app</td></tr><tr><td class="confluenceTd" colspan="1">activateWithIssuerIOSDeepLinkingUrl</td><td class="confluenceTd" colspan="1">ProductConfigActivateWithIssuerIOSDeepLinkingUrl?</td><td class="confluenceTd" colspan="1">IOSDeepLinkingUrl object can be used to open the issuer mobile app</td></tr></tbody></table>

ProductConfigOpenIssuerAndroidIntent contains following fields.

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-23"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">action</td><td class="confluenceTd">String</td><td class="confluenceTd">The name of the action to be performed. This is a fully qualified name including the package name in order to create an explicit intent</td></tr><tr><td class="confluenceTd">packageName</td><td class="confluenceTd">String</td><td class="confluenceTd">The package name of the issuer’s mobile app. This identifies the app that the intent will resolve to. If the app is not installed on the user’s device, this package name can be used to open a link to the appropriate Android app store for the user to download and install the app</td></tr><tr><td class="confluenceTd" colspan="1">extraTextValue</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Contains the data to be passed through to the target app in the intent as an extra key/value pair with key ‘android.intent.extra.TEXT’. This is Base64-encoded data of a JSON object</td></tr></tbody></table>

ProductConfigActivateWithIssuerAndroidIntent contains following fields.

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-24"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">action</td><td class="confluenceTd">String</td><td class="confluenceTd">The name of the action to be performed. This is a fully qualified name including the package name in order to create an explicit intent</td></tr><tr><td class="confluenceTd">packageName</td><td class="confluenceTd">String</td><td class="confluenceTd">The package name of the issuer’s mobile app. This identifies the app that the intent will resolve to. If the app is not installed on the user’s device, this package name can be used to open a link to the appropriate Android app store for the user to download and install the app</td></tr><tr><td class="confluenceTd">extraTextValue</td><td class="confluenceTd">String</td><td class="confluenceTd">Contains the data to be passed through to the target app in the intent as an extra key/value pair with key ‘android.intent.extra.TEXT’. This is Base64-encoded data of a JSON object</td></tr></tbody></table>

ProductConfigOpenIssuerIOSDeepLinkingUrl contains following fields.

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-25"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">deepLinkinUrl</td><td class="confluenceTd">String</td><td class="confluenceTd">The deep linking URL of the issuer’s iOS mobile app. This identifies the app that the URL will resolve to. If the app is not installed on the user’s device, this URL can be used to open a link to the appropriate iOS app store for the user to download and install the app</td></tr><tr><td class="confluenceTd">extraTextValue</td><td class="confluenceTd">String</td><td class="confluenceTd">Contains the data to be passed through to the target app in the deep linking URL as a query parameter.It should be appended to the deepLinkingUrl when invoked in the format: deepLinkingUrl + ‘?extraTextValue=’ + extraTextValue. This is Base64-encoded data of a JSON object</td></tr></tbody></table>

ProductConfigActivateWithIssuerIOSDeepLinkingUrl contains following fields.

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-26"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">deepLinkingUrl</td><td class="confluenceTd">String</td><td class="confluenceTd">The deep linking URL of the issuer’s iOS mobile app. This identifies the app that the URL will resolve to. If the app is not installed on the user’s device, this URL can be used to open a link to the appropriate iOS app store for the user to download and install the app</td></tr><tr><td class="confluenceTd">extraTextValue</td><td class="confluenceTd">String</td><td class="confluenceTd">Contains the data to be passed through to the target app in the deep linking URL as a query parameter. It should be appended to the deepLinkingUrl when invoked in the format: deepLinkingUrl + ‘?extraTextValue=’ + extraTextValue. This is Base64-encoded data of a JSON object</td></tr></tbody></table>

ProductConfigIssuerFlags contains following fields.

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-27"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">deviceBinding</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Device binding</td></tr><tr><td class="confluenceTd">cardholderVerification</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Whether the issuer participating in step-up flow</td></tr><tr><td class="confluenceTd" colspan="1">trustedBeneficiaryEnrollment</td><td class="confluenceTd" colspan="1">Boolean</td><td class="confluenceTd" colspan="1">Whether this is a trusted beneficiary enrollment</td></tr><tr><td class="confluenceTd" colspan="1">delegateAuthenticationSupported</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Whether issuer supports delegated authentication</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback</p>

</td></tr></tbody></table>

Sample

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="2497edf6-c01c-4fee-a32b-bf770f7230ba" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-digitizecard%28dig"><tbody><tr><td class="wysiwyg-macro-body">```
fun digitizeCard(digitizationRequest: DigitizationRequest) {

    ucpApi.cardsService
            .digitize( digitizationRequest,
                    { digitizationResult ->
                        //digitization success, provisioning is in progress
                        //application should listen to push message and provide content to UCP
                        //refresh you payment instrument list form Cards::getPaymentInstruments
                        //new PaymentInstrument should be visible with INACTIVE state

                        //when push processed wait for onProvisioningSuccess or Failure callback
                        //and status change
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

###   


### digitize

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="a54b4d7c-d37c-434c-98d3-7a795fca28b1" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Creates payment token in UCP backend.  
Expect push after successful finish and then proceed using process method in Cloud Messaging domain.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-28"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Identifier of payment instrument

</td><td class="confluenceTd">Not empty.</td></tr><tr><td class="confluenceTd" colspan="1">userLanguage</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Language preference selected by the consumer. Formatted as an   
ISO-639-1 two letter language code

</td><td class="confluenceTd" colspan="1">Not empty.</td></tr><tr><td class="confluenceTd" colspan="1">securityCode</td><td class="confluenceTd" colspan="1">CharArray?</td><td class="confluenceTd" colspan="1">Optional. The CVC2 for the card to be digitized

</td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

####   


**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

#####   


**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="2497edf6-c01c-4fee-a32b-bf770f7230ba" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-digitizecard%28-pa"><tbody><tr><td class="wysiwyg-macro-body">```
fun digitizeCard(
        paymentInstrumentId: String,
        languageCode: String,
        securityCode: CharArray) {

    ucpApi.cardsService
            .digitize(paymentInstrumentId, languageCode, securityCode,
                    {
                        //digitization success, provisioning is in progress
                        //application should listen to push message and provide content to UCP
                        //refresh you payment instrument list form Cards::getPaymentInstruments
                        //new PaymentInstrument should be visible with INACTIVE state

                        //when push processed wait for onProvisioningSuccess or Failure callback
                        //and status change
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### getAdditionalAuthenticationMethods

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-3"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Retrieves additional user authentication methods.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-29"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh" colspan="1">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">getAdditionalAuthenticationMethods</td><td class="confluenceTd" colspan="1">GetAdditionalAuthenticationMethods</td><td class="confluenceTd" colspan="1">Plain object of GetAdditionalAuthenticationMethods

</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

Fields of GetAdditionalAuthenticationMethods object:

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-30"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Identifier of payment instrument</td></tr></tbody></table>

####   


**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e51e890a-09ee-49e9-8443-c0ded3d4e3de" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-1"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with AdditionalAuthenticationMethods object.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-31"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">additionalAuthenticationMethods</td><td class="confluenceTd">AdditionalAuthenticationMethods</td><td class="confluenceTd">Object carrying list of AdditionalAuthenticationMethod</td></tr></tbody></table>

AdditionalAuthenticationMethods contains following value:

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-32"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd" colspan="1">additionalAuthenticationMethods</td><td class="confluenceTd" colspan="1">List&lt;AdditionalAuthenticationMethod&gt;</td><td class="confluenceTd" colspan="1">List of AdditionalAuthenticationMethod objects</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="f01d9d4e-b2a1-483a-b5e8-c35e98aefe29" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback."><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="85dfd7e7-6a3a-4ea3-b833-870c773db788" data-macro-name="code" data-macro-parameters="language=java|theme=Eclipse" data-macro-schema-version="1" id="bkmrk-private-fun-getaddit"><tbody><tr><td class="wysiwyg-macro-body">```
private fun getAdditionalAuthenticationMethods() {
    val getAdditionalAuthenticationMethod =
        GetAdditionalAuthenticationMethods("paymentInstrumentId")

    ucpApi
        .cardsService
        .getAdditionalAuthenticationMethods(
            getAdditionalAuthenticationMethod,
            { additionalAuthenticationMethods ->
                //Handle result
            },
            { throwable ->
                //Something went wrong, check exception with documentation
            })
}
```

</td></tr></tbody></table>

### submitTokenAuthenticationValue

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-4"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Submit authentication code when additional user authentication is required.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table confluenceTable" id="bkmrk-parameter-type-descr-33"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Parameter</th><th class="confluenceTh">Type</th><th class="confluenceTh">Description</th></tr><tr><td class="confluenceTd" colspan="1">paymentInstrumentId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Identifier of payment instrument

</td></tr><tr><td class="confluenceTd">authenticationCode</td><td class="confluenceTd">String</td><td class="confluenceTd">Authentication code</td></tr></tbody></table>

####   


**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9b441ed3-52d6-4cd8-a6ba-ab0c8adbec43" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback%2Ffai"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success callback/failure callback.</p>

</td></tr></tbody></table>

#####   


**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8df40eef-c58c-4cd5-9453-d934b38c602e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-private-fun-submitau"><tbody><tr><td class="wysiwyg-macro-body">```
private fun submitAuthenticationValue(paymentInstrumentId: String, authenticationCode: String) {

    ucpApi.cardsService
        .submitAuthenticationValue(
            SubmitAuthenticationValue(
                paymentInstrumentId,
                authenticationCode
            ),
            {
                //Handle success
            },
            { throwable ->
                //Something went wrong, check exception with documentation
            }
        )
}
```

</td></tr></tbody></table>

### submitTokenAuthenticationMethod

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-5"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Submit authentication method when additional user authentication is required.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-34"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd" colspan="1">paymentInstrumentId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Identifier of payment instrument

</td></tr><tr><td class="confluenceTd">authenticationMethodId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of authentication method. Get it when digitize method return additionalAuthenticationRequired set to true.</td></tr></tbody></table>

####   


**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9b441ed3-52d6-4cd8-a6ba-ab0c8adbec43" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback%2Ffai-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success callback/failure callback.</p>

</td></tr></tbody></table>

#####   


**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8df40eef-c58c-4cd5-9453-d934b38c602e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-private-fun-submitau-0"><tbody><tr><td class="wysiwyg-macro-body">```
private fun submitAuthenticationMethod(paymentInstrumentId: String, authenticationMethodId: String) {

    ucpApi.cardsService
        .submitAuthenticationMethod(
            SubmitAuthenticationMethod(
                paymentInstrumentId,
                authenticationMethodId
            ),
            {
                //Handle success
            },
            { throwable ->
                //Something went wrong, check exception with documentation
            }
        )
}
```

</td></tr></tbody></table>

### getAllPaymentInstruments

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e4ba943f-9372-45a7-b692-23d020ff7e44" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-6"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online/Offline.  
<span class="inline-comment-marker" data-ref="c2d25370-36c1-48bc-80c0-1abbef4f5385">Method for getting all payment instruments from local or remote storage.  
</span><span class="inline-comment-marker" data-ref="c2d25370-36c1-48bc-80c0-1abbef4f5385">Local storage is always instant available and should be used to increase UX.  
</span><span class="inline-comment-marker" data-ref="c2d25370-36c1-48bc-80c0-1abbef4f5385">Use remote way when possible to keep your payment instruments always up to date.   
</span></p>

</td></tr></tbody></table>

**Input**

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-35"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Parameter</th><th class="confluenceTh">Type</th><th class="confluenceTh">Description</th><th class="confluenceTh">Validation conditions</th></tr><tr><td class="confluenceTd">refresh</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Refresh all PaymentInstrument objects state with remote UCP server (network and user session required)</td><td class="confluenceTd">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e51e890a-09ee-49e9-8443-c0ded3d4e3de" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with list of PaymentInstrument objects.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-36"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstruments</td><td class="confluenceTd">List&lt;PaymentInstrument&gt;</td><td class="confluenceTd">List of retrieved payment instruments from local or remote storage</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="f01d9d4e-b2a1-483a-b5e8-c35e98aefe29" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="a320a087-fbca-4ef7-9175-1ca82f95518d" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getallpaymentins"><tbody><tr><td class="wysiwyg-macro-body">```
fun getAllPaymentInstrument(refresh: Boolean) {
    ucpApi.cardsService
            .getAllPaymentInstruments( refresh,
                    { paymentInstruments ->
                        //List of PaymentInstrument from local or remote storage
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

###   


### getPaymentInstrument (deprecated)

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-7"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online/Offline.  
Deprecated - use getAllPaymentInstruments instead.  
Method for getting single PaymentInstrument from local or remote storage object based on id.  
Local storage is always instant available and should be used to incerese UX.  
<span class="inline-comment-marker" data-ref="244d20e5-2a70-4cf7-8e4c-4a38449cb9a2">Use remote way when possible to keep your payment instruments always up to date.   
</span></p>

</td></tr></tbody></table>

**Input**

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-37"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Parameter</th><th class="confluenceTh">Type</th><th class="confluenceTh">Description</th><th class="confluenceTh">Validation conditions</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of instrument to retrieve</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd">refresh</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Refresh selected PaymentInstrument state with remote UCP server (network required)</td><td class="confluenceTd">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-3"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with PaymentInstument object.</p>

</td></tr></tbody></table>

<table class="wrapped relative-table confluenceTable" id="bkmrk-parameter-type-descr-38"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstrument</td><td class="confluenceTd">PaymentInstrument</td><td class="confluenceTd">Retrieved payment instrument</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="8668e3d2-4616-4c98-838c-bad5528bf323" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-1"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="ad2e11bd-9f0d-4d79-b59d-f48b867f05e0" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getpaymentinstru"><tbody><tr><td class="wysiwyg-macro-body">```
fun getPaymentInstrument(paymentInstrumentId: String, refresh: Boolean) {
    ucpApi.cardsService
            .getPaymentInstrument(paymentInstrumentId, refresh,
                    { paymentInstrument ->
                        //PaymentInstrument from local or remote storage
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

##   


## IBANs domain

###   


### digitize

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="ee592d11-5678-49f6-bdee-71cd093ae072" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-8"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Registers user and device if already not registered in UCP backend. Creates payment token in UCP backend.  
Expect push after successfull finish and then proceed using process method in Cloud Messaging domain.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table confluenceTable wrapped" id="bkmrk-parameter-type-descr-39"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">signedAccountInfo</td><td class="confluenceTd">String</td><td class="confluenceTd">Signed AccountInfo per RFC 7519

Instruction how to sign data with JWT can be found in *Data signing and encryption* chapter in Mobile DC documentation

</td><td class="confluenceTd">Not empty.</td></tr><tr><td class="confluenceTd">fcmRegistrationToken</td><td class="confluenceTd">CharArray</td><td class="confluenceTd">FCM Cloud messaging registration token

</td><td class="confluenceTd">Not empty.</td></tr><tr><td class="confluenceTd">languageCode</td><td class="confluenceTd">String</td><td class="confluenceTd">Language preference selected by the consumer. Formatted as an ISO-639-1 two letter language code

</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

**AccountInfo:**

<table class="relative-table confluenceTable wrapped" id="bkmrk-parameter-type-descr-40"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**

</th></tr><tr><td class="confluenceTd">userId</td><td class="confluenceTd">String</td><td class="confluenceTd">External user id

</td><td class="confluenceTd">Not empty.</td></tr><tr><td class="confluenceTd" colspan="1">iban</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Bank Account Number</td><td class="confluenceTd" colspan="1">Not empty.</td></tr><tr><td class="confluenceTd" colspan="1">countryCode</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The country of the financial account

Expressed as a 3-letter (alpha-3 country code as defined in ISO 3166-1

</td><td class="confluenceTd" colspan="1">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback.-ca"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback. Called when device token digitization finished with success .Result contains *IbanDigitizationResult*object.</p>

<p class="callout info">Note: Cloud token digitization fail doesn't affect on success/failure callback.</p>

</td></tr></tbody></table>

IbanDigitizationResult contains following fields:

<table class="relative-table confluenceTable wrapped" id="bkmrk-parameter-type-descr-41"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">(DEPRECATED) cloudDigitizationSuccess</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Cloud Token Digitization Details</td></tr><tr><td class="confluenceTd" colspan="1">result</td><td class="confluenceTd" colspan="1">CloudDigitizationResult</td><td class="confluenceTd" colspan="1">Cloud Token Digitization Details. One of: SUCCEED, FAILED, DISABLED, UNKNOWN</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="60c0b11e-990c-484a-9113-b82ec678c03d" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-ca"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback. Called when **device token** digitization finished with failure.</p>

</td></tr></tbody></table>

**Sample**

Sample generation of *signedAccountInfo* (see *Data signing and encryption* chapter in Mobile DC documentation)

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="7ee370b6-1f92-4eb2-88b1-8749961cd4f1" data-macro-name="code" data-macro-schema-version="1" id="bkmrk-class-signedaccounti"><tbody><tr><td class="wysiwyg-macro-body">```
class SignedAccountInfo {
    fun generate() {
        val claims = JWTClaimsSet.Builder()
            .claim("userId", "externalUserId")
            .claim("iban", "IN15HIND23467433866365")
            .claim("countryCode", "IND")
            .build()

        val signedAccountInfo = JwtGenerator.generate(claims, certificates, privateKey)
        // ...
    }

```

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="edfea95a-000f-4f04-94df-cce9eaff0e79" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-digitizeiban%28-si"><tbody><tr><td class="wysiwyg-macro-body">```
fun digitizeIban(
        signedAccountInfo: String,
        fcmRegistrationToken: CharArray,
        languageCode: String) {

    ucpApi.ibansService
            .digitize(signedAccountInfo, fcmRegistrationToken, languageCode,
                    { ibanDigitizationResult ->

                        //Device token digitization finished with success
                        //wait for onProvisioning(Success/Failure) callback and onTokenStatusChanged when success

                        val cloudDigitizationResult = ibanDigitizationResult.result

                        //check status of Cloud Token
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

###   


### createTVC  


<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="635a2ae5-f214-4546-b9ad-3897645013b3" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-9"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Provides Transaction Verification Code required to process cloud payments.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-42"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">signedIbanInfo</td><td class="confluenceTd">String</td><td class="confluenceTd">Signed IbanInfo per RFC 7519

Instruction how to sign data with JWT can be found in *Data signing and encryption* chapter in Mobile DC documentation

</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

IbanInfo

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-43"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**

</th></tr><tr><td class="confluenceTd">ibanId</td><td class="confluenceTd">String</td><td class="confluenceTd">Iban id returned in *addUserWithIban* methdod or *sha256Hex(iban)*

</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-4"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with Tvc object or encrypted Tvc object as String.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-44"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">plainTvc</td><td class="confluenceTd">PlainTvc?</td><td class="confluenceTd">Plain PlainTvc object

</td></tr><tr><td class="confluenceTd">encryptedTvc</td><td class="confluenceTd">CharArray?</td><td class="confluenceTd">Encrypted PlainTvc object per RFC 7516

Present when client decide to encrypt data. Instruction how tu use JWE can be found in *Data signing and encryption* chapter in Mobile DC documentation

</td></tr></tbody></table>

PlainTvc object contains following fields.

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-45"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">accountNumber</td><td class="confluenceTd">CharArray</td><td class="confluenceTd">Primary Account Number for the transaction – this is the Token PAN

</td></tr><tr><td class="confluenceTd">dynamicExpiryDate</td><td class="confluenceTd">CharArray</td><td class="confluenceTd">Dynamic expiration date for the token. Expressed in YYMM format

</td></tr><tr><td class="confluenceTd" colspan="1">dynamicCVC</td><td class="confluenceTd" colspan="1">CharArray</td><td class="confluenceTd" colspan="1">Dynamic CVC</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="32685088-3a3d-41b8-b304-d969d6331ead" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-whe"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback when TVC cannot be created.</p>

</td></tr></tbody></table>

**Sample**

Sample generation of *signedIbanInfo* (see *Data signing and encryption* chapter in Mobile DC documentation)

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="471ef791-1f27-4e88-bde6-41937f9b2650" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-class-signedibaninfo"><tbody><tr><td class="wysiwyg-macro-body">```
class SignedIbanInfo {
    fun generate() {
        val claims = JWTClaimsSet.Builder()
            .claim("ibanId", "798c5c64d93c87b8ed7f108cde4753eb66faff760121ef2a05d0f44fb066b03b")
            .build();

        val signedIbanInfo = JwtGenerator.generate(claims, certificates, privateKey);
        // ...
    }
}
```

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="a8bfba8b-21c4-4989-840a-11b87f27ce72" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-createtvc%28signed"><tbody><tr><td class="wysiwyg-macro-body">```
fun createTvc(signedIbanInfo: String) {
    ucpApi.ibansService
            .createTVC(signedIbanInfo, { tvc ->
                //result object could contains encrypted TVC
                val encryptedTvc: String? = tvc.encryptedTvc

                //or decrypted(plain) TVC object with parameters described in documentation
                val plainTvc = tvc.plainTvc
            }, { throwable ->
                //Something went wrong, check exception with documentation
            })
}
```

</td></tr></tbody></table>

### createPaymentData

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="635a2ae5-f214-4546-b9ad-3897645013b3" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-10"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
This method is responsible for creating payment data for given IBAN. Depending on configuration returned data are dedicated for payment using UCAF or TVC. Also depending on configuration payment data are returned in plain or encrypted form.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-46"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">signedIbanInfo</td><td class="confluenceTd">String</td><td class="confluenceTd">Signed IbanInfo per RFC 7519

Instruction how to sign data with JWT can be found in *Data signing and encryption* chapter in Mobile DC documentation

</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

IbanInfo

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-47"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**

</th></tr><tr><td class="confluenceTd">ibanId</td><td class="confluenceTd">String</td><td class="confluenceTd">Iban id returned in *addUserWithIban* methdod or *sha256Hex(iban)*

</td><td class="confluenceTd">Not empty.</td></tr><tr><td class="confluenceTd" colspan="1">userId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">External user id given by the client</td><td class="confluenceTd" colspan="1">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-5"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with <span class="inline-comment-marker" data-ref="994dfca1-269e-494c-b163-9081ead35090">PaymentData</span> object or encrypted payment data object as String.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-48"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">plainPaymentData</td><td class="confluenceTd">PlainPaymentData?</td><td class="confluenceTd">Plain PlainPaymentData object

</td></tr><tr><td class="confluenceTd">encryptedPaymentData</td><td class="confluenceTd">String?</td><td class="confluenceTd">Encrypted PlainPaymentData object per RFC 7516

Present when client decide to encrypt data. Instruction how tu use JWE can be found in *Data signing and encryption* chapter in Mobile DC documentation

</td></tr></tbody></table>

PlainPaymentData object contains following fields.

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-49"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">accountNumber</td><td class="confluenceTd">String</td><td class="confluenceTd">Primary Account Number for the transaction – this is the Token PAN

</td></tr><tr><td class="confluenceTd" colspan="1">applicationExpiryDate</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Required only for UCAF. Application expiry date for the Token. Expressed in YYMMDD format</td></tr><tr><td class="confluenceTd" colspan="1">panSequenceNumber</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Rrquired only for UCAF. Application PAN sequence number for the Token</td></tr><tr><td class="confluenceTd" colspan="1">track2Equivalent</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Required only for UCAF. Track 2 equivalent data for the Token. Expressed according to ISO/IEC 7813, excluding start sentinel, end sentinel, and Longitudinal Redundancy Check (LRC), using hex nibble 'D' as field separator, and padded to whole bytes using one hex nibble 'F' as needed</td></tr><tr><td class="confluenceTd" colspan="1">ucafCryptogram</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Required only for UCAF. UCAF cryptogram</td></tr><tr><td class="confluenceTd">dynamicExpiryDate</td><td class="confluenceTd">String?</td><td class="confluenceTd">Dynamic expiration date for the token. Expressed in YYMM format

</td></tr><tr><td class="confluenceTd" colspan="1">dynamicCVC</td><td class="confluenceTd" colspan="1">String?</td><td class="confluenceTd" colspan="1">Dynamic CVC</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="32685088-3a3d-41b8-b304-d969d6331ead" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-whe-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback when PaymentData cannot be created.</p>

</td></tr></tbody></table>

**Sample**

<span class="inline-comment-marker" data-ref="a2b69958-1b22-459d-9cfc-9cad6072164e">Sample generation of </span>*<span class="inline-comment-marker" data-ref="a2b69958-1b22-459d-9cfc-9cad6072164e">signedIbanInfo</span>*<span class="inline-comment-marker" data-ref="a2b69958-1b22-459d-9cfc-9cad6072164e"> (see [Data signing and encryption](https://wiki.verestro.com/display/UCP/Data+signing+and+encryption)</span><span class="inline-comment-marker" data-ref="a2b69958-1b22-459d-9cfc-9cad6072164e"> chapter in Mobile DC documentation)</span>

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="471ef791-1f27-4e88-bde6-41937f9b2650" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-class-signedibaninfo-0"><tbody><tr><td class="wysiwyg-macro-body">```
class SignedIbanInfo {
    fun generate() {
        val claims = JWTClaimsSet.Builder()
            .claim("ibanId", "798c5c64d93c87b8ed7f108cde4753eb66faff760121ef2a05d0f44fb066b03b")
			.claim("userId", "123")
            .build();

        val signedIbanInfo = JwtGenerator.generate(claims, certificates, privateKey);
        // ...
    }
}
```

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="a8bfba8b-21c4-4989-840a-11b87f27ce72" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-createpaymentdat"><tbody><tr><td class="wysiwyg-macro-body">```
fun createPaymentData(signedIbanInfo: String) {
    ucpApi.ibansService
            .createPaymentData(signedIbanInfo, { paymentData ->
                //result object could contains encrypted PaymentData
                val encryptedPaymentData: String? = paymentData.encryptedPaymentData

                //or decrypted(plain) PaymentData object with parameters described in documentation
                val plainPaymentData = paymentData.plainPaymentData
            }, { throwable ->
                //Something went wrong, check exception with documentation
            })
}
```

</td></tr></tbody></table>

### getAllPaymentInstruments  


<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e4ba943f-9372-45a7-b692-23d020ff7e44" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-11"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online/Offline.  
<span class="inline-comment-marker" data-ref="93dd5d97-9101-45b8-b284-b4fc95d0b1b7">Method for getting all payment instruments from local or remote storage.  
</span>Local storage is always instant available and should be used to incerese UX.  
<span class="inline-comment-marker" data-ref="93dd5d97-9101-45b8-b284-b4fc95d0b1b7">Use remote way when possible to keep your payment instruments always up to date.   
</span></p>

</td></tr></tbody></table>

**Input**

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-50"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">refresh</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Refresh all PaymentInstrument objects state with remote UCP server (network required)</td><td class="confluenceTd">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e51e890a-09ee-49e9-8443-c0ded3d4e3de" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-6"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with list of PaymentInstrument objects</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-51"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstruments</td><td class="confluenceTd">List&lt;PaymentInstrument&gt;</td><td class="confluenceTd">List of retrieved payment instruments</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="f01d9d4e-b2a1-483a-b5e8-c35e98aefe29" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-1"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="a320a087-fbca-4ef7-9175-1ca82f95518d" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getallpaymentins-0"><tbody><tr><td class="wysiwyg-macro-body">```
fun getAllPaymentInstrument(refresh: Boolean) {
    ucpApi.ibansService
            .getAllPaymentInstruments( refresh,
                    { paymentInstruments ->
                        //List of PaymentInstrument from local or remote storage
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### getPaymentInstrument(deprecated)

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-12"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online/Offline.  
Use *getAllPaymentInstruments* instead.  
<span class="inline-comment-marker" data-ref="c9628f10-fb48-409f-9322-fe238fc987f6">Method for getting single PaymentInstrument from local or remote storage object based on id.  
</span>Local storage is always instant available and should be used to incerese UX.  
<span class="inline-comment-marker" data-ref="c9628f10-fb48-409f-9322-fe238fc987f6">Use remote way when possible to keep your payment instruments always up to date.   
</span></p>

</td></tr></tbody></table>

**Input**

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-52"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of instrument to retrieve.</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd">refresh</td><td class="confluenceTd">Boolean</td><td class="confluenceTd">Refresh selected PaymentInstrument state with remote UCP server (network required)</td><td class="confluenceTd">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-7"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with PaymentInstument object</p>

</td></tr></tbody></table>

<table class="wrapped confluenceTable" id="bkmrk-parameter-type-descr-53"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstrument</td><td class="confluenceTd">PaymentInstrument</td><td class="confluenceTd">Retrieved payment instrument</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="8668e3d2-4616-4c98-838c-bad5528bf323" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="ad2e11bd-9f0d-4d79-b59d-f48b867f05e0" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getpaymentinstru-0"><tbody><tr><td class="wysiwyg-macro-body">```
fun getPaymentInstrument(paymentInstrumentId: String, refresh: Boolean) {
    ucpApi.ibansService
            .getPaymentInstrument(paymentInstrumentId, refresh,
                    { paymentInstrument ->
                        //PaymentInstrument from local or remote storage
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### delete

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-13"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method allows delete PaymentInstument from UCP.  
Payment token will be removed remote and local storage.  
Result of action will be notified with *onPaymentInstrumentStatusChanged*.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-54"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Parameter</th><th class="confluenceTh">Type</th><th class="confluenceTh">Description</th><th class="confluenceTh">Validation conditions</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of PaymentInstrument to delete

</td><td class="confluenceTd">Not empty.</td></tr><tr><td class="confluenceTd" colspan="1">reason</td><td class="confluenceTd" colspan="1">CharArray?</td><td class="confluenceTd" colspan="1">Optional reason of deletion

</td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="dcd90cf0-b262-4524-b6fe-3b8cff9622cb" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-1"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8df40eef-c58c-4cd5-9453-d934b38c602e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-delete%28paymentin-0"><tbody><tr><td class="wysiwyg-macro-body">```
fun delete(paymentInstrumentId: String, reason: CharArray?) {
    ucpApi.ibansService
            .delete(paymentInstrumentId, reason,
                    {
                        //PaymentInstrument delete requested
                        //wait for confirmation from onPaymentInstrumentStatusChanged
                    },
                    { throwable ->
                        //Something went wrong, check excetpion with documentation
                    }
            )
}
```

</td></tr></tbody></table>

## Payment domain

### setDefaultForContactless

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="0408a777-6d92-4c95-bb91-6e10011084e1" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Sets payment instrument as default for contactless payment.  
Payment instrument set as default will be used if no other payment instrument was selected by method selectForPayment.  
Default payment instrument will be used automatically after linking with PoS terminal.  
Make sure PaymentInstrument status is ACTIVE. Only active payments instruments can be set as default.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-55"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Payment instrument identity

</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="5a3e0346-d3fd-470d-95f0-5ae1748666ff" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="ad2e11bd-9f0d-4d79-b59d-f48b867f05e0" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-setdefaultforcon"><tbody><tr><td class="wysiwyg-macro-body">```
fun setDefaultForContactless(paymentInstrument: PaymentInstrument) {

    if (paymentInstrument.status != PaymentInstrumentStatus.ACTIVE) {
        //make sure selected PaymentInstrument can be seta as default
        return
    }

    val paymentInstrumentId = paymentInstrument.id

    ucpApi.paymentService
            .setDefaultForContactless(paymentInstrumentId, {
                //success
            }, { throwable ->
                //Something went wrong, check exception with documentation
            })
}
```

</td></tr></tbody></table>

###   


### getDefaultForContactless

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="209f58fa-983c-4619-a63d-d982a7fcbdcf" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.Provides default PaymentInstrument for contactless payment.</p>

<p class="callout info">Throws DefaultPaymentInstrumentNotFoundException when no PaymentInstrument is set as default.</p>

</td></tr></tbody></table>

**Input**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="ff8ee823-139a-41da-b076-5e7bb90aa668" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-no-input-parameters"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">No input parameters</p>

</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="5a3e0346-d3fd-470d-95f0-5ae1748666ff" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-8"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with id new default PaymentInstrument</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-56"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstrument</td><td class="confluenceTd">PaymentInstrument</td><td class="confluenceTd">Default Payment instrument</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="0f33776b-48dc-492d-a3cc-e513cfebd6f2" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="e1adc42d-9693-455d-ae91-301dcb439c9c" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getdefaultforcon"><tbody><tr><td class="wysiwyg-macro-body">```
fun getDefaultForContactless() {
    ucpApi.paymentService
            .getDefaultForContactless({ paymentInstrument ->
                // use PaymentInstrument
            }, { throwable ->
                when (throwable) {
                    is DefaultPaymentInstrumentNotFoundException -> {
                        //there is no default PaymentInstrument
                    }
                    else -> {
                        //check another exception with documentation
                    }
                }
            })
}
```

</td></tr></tbody></table>

### setDefaultForRemote (deprecated)

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="a49b6595-0410-4024-896f-78e4e01fcbab" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-1"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Sets payment instrument as default for DSRP payment.  
Payment instrument set as default will be used if no other payment instrument was selected by method selectForPayment.  
Default payment instrument will be used automatically to remote payments.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-57"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Payment instrument identity

</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="35741875-bc30-4c64-9fa7-d5c05a4b6b14" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-3"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="f2e32868-55d5-4153-b507-e53cb84f6b2d" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-setdefaultforrem"><tbody><tr><td class="wysiwyg-macro-body">```
fun setDefaultForRemote(paymentInstrument: PaymentInstrument) {

    if (paymentInstrument.status != PaymentInstrumentStatus.ACTIVE
            && !paymentInstrument.dsrpSupported) {
        
        //make sure selected PaymentInstrument can be set as default
        return
    }

    val paymentInstrumentId = paymentInstrument.id

    ucpApi.paymentService
            .setDefaultForRemote(paymentInstrumentId, {
                //success
            }, { throwable ->
                //Something went wrong, check exception with documentation
            })
}
```

</td></tr></tbody></table>

### getDefaultForRemote (deprecated)

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="209f58fa-983c-4619-a63d-d982a7fcbdcf" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Provides default PaymentInstrument for remote payments.  
Throws DefaultPaymentInstrumentNotFoundException when no PaymentInstrument is set as default.</p>

</td></tr></tbody></table>

**Input**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="ff8ee823-139a-41da-b076-5e7bb90aa668" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-no-input-parameters-0"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">No input parameters</p>

</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="5a3e0346-d3fd-470d-95f0-5ae1748666ff" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-9"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with id new default PaymentInstrument</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-58"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstrument</td><td class="confluenceTd">PaymentInstrument</td><td class="confluenceTd">Default Payment instrument</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="0f33776b-48dc-492d-a3cc-e513cfebd6f2" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-3"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="239ae538-313d-4744-8c45-4a384ad1613f" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getdefaultforrem"><tbody><tr><td class="wysiwyg-macro-body">```
fun getDefaultForRemote() {
    ucpApi.paymentService
            .getDefaultForRemote({ paymentInstrument ->
                // use PaymentInstrument
            }, { throwable ->
                when (throwable) {
                    is DefaultPaymentInstrumentNotFoundException -> {
                        //there is no default PaymentInstrument
                    }
                    else -> {
                        //check another exception with documentation
                    }
                }
            })
}
```

</td></tr></tbody></table>

### selectForPayment

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="c079b4b4-46c7-4a9d-8cc8-e415b7e3894c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-3"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Sets payment instrument as primary for next incoming contactless payment.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-59"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentd</td><td class="confluenceTd">String</td><td class="confluenceTd">Payment instrument identity

</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="793c4579-5a04-4ac4-bf42-9d90fb6975cc" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-4"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="c7979339-4ea1-4e7d-bc32-f28b4f369d9f" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-note%3A-this-is-only-s"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">**Note:** This is only sample payment scenation</p>

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="64245325-87a7-4ca7-a004-27bb7db77a6e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2Fsample-scenario-of"><tbody><tr><td class="wysiwyg-macro-body">```
//sample scenario of starting payment with authentication before payment

fun startPayment(paymentInstrument: PaymentInstrument) {

    //checking conditions before payment
    val isActive = paymentInstrument.status != PaymentInstrumentStatus.ACTIVE
    val isContactlessSupported = paymentInstrument.contactlessSupported
    val hasTransactionCredentials = paymentInstrument.credentialsCount > 0

    if (!isActive || !isContactlessSupported || !hasTransactionCredentials) {
        //PaymentInstrument doesn't meet requirements for payment
        return
    }
    
    //selecting PaymentInstrument to payment
    ucpApi.paymentService
            .selectForPayment(paymentInstrument.id, {
                //selection success

                //request user authentication when 
                //... authentication presented

                //use setUserAuthenticatedForPayment method

            }, { throwable ->
                //something went wrong, check exception with documentation
            })
}
```

</td></tr></tbody></table>

### setUserAuthenticatedForPayment

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="0b5cc75e-efd7-4403-bf84-f7bcf1a5b3fc" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-4"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Sets user as authenticated to payment with provided payment instrument.  
Authentication will expiry automatically after transaction time configured in payment instrument profile.</p>

<p class="callout warning">**Note:** User can be authenticated based on conditions like screen unlock. Method must be called before payment in declared *HostApduService* (sample below).  
Make sure that authentication on this step is done securely. Transaction information are not available in this scenario.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-60"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Payment instrument identity

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">pin</td><td class="confluenceTd" colspan="1">CharArray?</td><td class="confluenceTd" colspan="1">PIN or null for CUSTOM WalletAuthUserMode

</td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="cf7c5544-d338-4397-82c3-c70f04210d2c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-5"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

Basic user authentication usage below, call when user is authenticated.

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="e9c29c14-9bd0-416c-ade7-3d41ac9a155b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-private-fun-setusera"><tbody><tr><td class="wysiwyg-macro-body">```
private fun setUserAuthenticatedForPayment(
    paymentInstrument: PaymentInstrument,
    pinProvidedByUser: CharArray
) {
    ucpApi
        .paymentService
        .setUserAuthenticatedForPayment(paymentInstrument.id, pinProvidedByUser,
            {
                //user authentication provided
                //start one tap payment or continue two tap with 2nd tap to terminal after authentication
                //listen for auth timer changes
                //user abortUserAuthentication method when transaction cancelled by user
            }, { throwable ->
                //some error, check exception
            })
}
```

</td></tr></tbody></table>

Optional authentication before making transaction based on custom conditions.

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="66a17e97-a2e6-4bef-af75-29a4e8bfeccb" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-class-wallethceservi"><tbody><tr><td class="wysiwyg-macro-body">```
class WalletHceService : HostApduService() {

	// ...
    
    private var authenticationAlreadyProcessed = false
    
    override fun processCommandApdu(commandApdu: ByteArray, extras: Bundle?): ByteArray? {
        Logs.d("**** processCommandApdu")

        //check conditions like screen unlock etc
        val isUserAuthenticated = true

        //make sure that user already not trying to pay another way. 
        //f.e. user selected PaymentInstrument (paymentService::selectForPayment) 
        // or/and is already authenticated with setUserAuthenticatedForPayment method
        val shouldAllowToSuchFlow = true

        if (shouldAllowToSuchFlow && !authenticationAlreadyProcessed && isUserAuthenticated) {
            ucpApi
                .paymentService
                .setUserAuthenticatedForPayment(
                    getSelectedPaymentInstrumentId(),
                    null, //or pin
                    {
                        //user authenticated
                        //make sure authentication is done only one time, clear it in onDeactivate method
                        authenticationAlreadyProcessed = true
                    }, {
                        //authentication failure, check exception
                    }
                )
        }

        return ucpApi
            .paymentService
            .processHceApduCommand(this, commandApdu, extras)
    }

    override fun onDeactivated(reason: Int) {

        //clear flag for next transaction
        authenticationAlreadyProcessed = false

        return ucpApi
            .paymentService
            .handleHceApduDeactivationEvent(reason)
    }

	// more code implementation
}

```

</td></tr></tbody></table>

### abortUserAuthenticationForPayment

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b9579cd8-fe2a-484c-a114-b7f7a3a62044" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-5"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.</p>

<p class="callout info">Abort user authentication during ongoing transaction. After calling this method transaction is cancelled and timer stopped.</p>

</td></tr></tbody></table>

**Input**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="d4674c46-0b7b-42f1-af3a-59a045da0ce0" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-no-input-parameters-1"><tbody><tr><td class="wysiwyg-macro-body">No input parameters

</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="f6d2960c-b4b5-4929-99e8-a0f163fc1b7d" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-6"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="e9c29c14-9bd0-416c-ade7-3d41ac9a155b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-abortuserauthent"><tbody><tr><td class="wysiwyg-macro-body">```
fun abortUserAuthenticationForPayment() {
    ucpApi
            .paymentService
            .abortUserAuthenticationForPayment(
                    {
                        //user authentication aborted
                        //listen for auth timer changes
                    },
                    { throwable ->
                        //some error, check exception
                    })
}
```

</td></tr></tbody></table>

### processHceApduCommand

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="483f5b4c-f2ab-4b71-ac5d-03c5c8512159" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-synchronous.-offline-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Synchronous. Offline.  
Processes APDU command from Point Of Sale (PoS) terminal. Returns callback APDU command to pass back to PoS.  
Should be called inside registered Android Service extending HostApduService in implementation of overridden processCommandApdu method.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-61"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">context</td><td class="confluenceTd">Context</td><td class="confluenceTd">Application context, can be provided from HostApduService

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">apdu</td><td class="confluenceTd" colspan="1">ByteArray</td><td class="confluenceTd" colspan="1">APDU command from HostApduService::processCommandApdu method parameter

</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">extras</td><td class="confluenceTd" colspan="1">Bundle?</td><td class="confluenceTd" colspan="1">Extras object from HostApduService::processCom mandApdu method parameter

</td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="f6d2960c-b4b5-4929-99e8-a0f163fc1b7d" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-apdu-result---method"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Apdu result - method called synchronous without callback</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter.-type-desc"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter.**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">apdu</td><td class="confluenceTd">ByteArray</td><td class="confluenceTd">APDU command to return in implementation of overridden processCommandApdu method

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="2ab5facc-87fb-4fd3-9e15-c239d976beb3" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2Fwallethceservice-m"><tbody><tr><td class="wysiwyg-macro-body">```
//WalletHceService must be registerd in AndroidManifest as nfc service 
class WalletHceService : HostApduService() {

	//...
    //private val ucpApi = ..

    override fun processCommandApdu(commandApdu: ByteArray, extras: Bundle?): ByteArray? {
        return ucpApi 
            .paymentService
            .processHceApduCommand(this, commandApdu, extras)
    }
	//..
}
```

</td></tr></tbody></table>

### replenishCredentials

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="ed743d68-0c46-47ef-86a4-65498d35fa21" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-14"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method for manually replenishing payment credentials.  
Application will receive push notification and notified about replenish process with global callback described in *setup*chapter. </p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-62"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of paymentInstrument that needs it credentials replenished

</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-7"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="b4e132e8-2961-48ad-8fd7-07578a20bd4e" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-replenishcredent"><tbody><tr><td class="wysiwyg-macro-body">```
fun replenishCredentials(paymentInstrumentId: String) {
    ucpApi.paymentService
            .replenishCredentials(paymentInstrumentId,
                    {
                        //request for credentials replenish finished with success
                        //wait for push notification and pass to valid module
                        //when push processed application will be informed about replenish success/failure
                        //read chapter with setup for more information
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    })
}
```

</td></tr></tbody></table>

### restartContactlessAuthTimer

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="2118fa5b-e6dd-47fa-8c10-2b2d47f8220e" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-6"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Resets auth timer during payment. After calling method auth countdown will start again with default value from card profile.  
Default auth time is provided by card profile.</p>

</td></tr></tbody></table>

**Input**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="96e99f31-5827-4832-8d56-9f7f1c9c40a4" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-no-input-parameters-2"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">No input parameters</p>

</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="ee6c320e-67f9-4576-b443-e7f6d8a33861" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-8"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

### requestAuthenticationCodeForPayment

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-15"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method dedicated for requesting authentication code for payment. Authentication code is delivered via Issuer. Only one valid Authentication Code can exist at a time for a given paymentInstrumentId and authenticationRequestId. Multiple valid codes can exist for the same token if different authenticationRequestIds are provided each in a different call. Once an Authentication Code has been generated for a given paymentInstrumentId and authenticationRequestId, it will be valid for a limited validity period, after which the code will expire. Method can be called again with the same authenticationRequestId and token unique reference , in order to trigger re-send. When an active authentication code exists for a given paymentInstrumentId and authenticationRequestId it is delivered again to the issuer. If the code has expired or the attempts has been exceeded then new code will be generated.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-63"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh" colspan="1">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">requestAuthenticationCodeForPayment</td><td class="confluenceTd" colspan="1">RequestAuthenticationCodeForPayment</td><td class="confluenceTd" colspan="1">Plain RequestAuthenticationCodeForPayment object

</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

RequestAuthenticationCodeForPayment object contains following fields

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-64"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh" colspan="1">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">paymentInstrumentId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Identifier of payment instrument

</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd">authenticationRequestId</td><td class="confluenceTd">String</td><td class="confluenceTd">Authentication request id up to 64 alphanumeric characters long.   
A new id should be used for each instance than an account holder needs to be authenticated</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9b441ed3-52d6-4cd8-a6ba-ab0c8adbec43" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback%2Ffai-1"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success callback/failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="e5e7394c-6a47-4b31-bd26-67faeb268f18" data-macro-name="code" data-macro-parameters="language=java|theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-requestauthentic"><tbody><tr><td class="wysiwyg-macro-body">```
fun requestAuthenticationCodeForPayment(requestAuthenticationCodeForPayment: RequestAuthenticationCodeForPayment) {
    ucpApi.paymentService
            .requestAuthenticationCodeForPayment( requestAuthenticationCodeForPayment,
                    { 
                        //Requesting Authentication Code went successfully.
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### validateAuthenticationCodeForPayment

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-16"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method dedicated for validation of an Authentication Code generated by the requestAuthenticationCodeForPayment() method. It is given limited number of attempts to enter a correct Authentication Code(typically 3 attempts), after which the Authentication Code becomes invalid.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-65"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Parameter</th><th class="confluenceTh">Type</th><th class="confluenceTh">Description</th><th class="confluenceTh" colspan="1">Validation conditions</th></tr><tr><td class="confluenceTd" colspan="1">validateAuthenticationCodeForPayment</td><td class="confluenceTd" colspan="1">ValidateAuthenticationCodeForPayment</td><td class="confluenceTd" colspan="1">Plain ValidateAuthenticationCodeForPayment object

</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

ValidateAuthenticationCodeForPayment object contains following fields

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-66"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">Parameter</th><th class="confluenceTh">Type</th><th class="confluenceTh">Description</th><th class="confluenceTh" colspan="1">Validation conditions</th></tr><tr><td class="confluenceTd" colspan="1">paymentInstrumentId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Identifier of payment instrument

</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd">authenticationRequestId</td><td class="confluenceTd">String</td><td class="confluenceTd">Authentication request id provided to the requestAuthenticationCodeForPayment when the authentication code was requested.</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">authenticationCode</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Authentication Code to authenticate the account holder</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9b441ed3-52d6-4cd8-a6ba-ab0c8adbec43" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-10"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with ValidateAuthenticationCodeForPaymentResult object.</p>

</td></tr></tbody></table>

ValidateAuthenticationCodeForPaymentResult object contains following field

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-67"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd" colspan="1">signedAuthenticationProcessData</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Signed AuthenticationProcessData per RFC 7519

</td></tr></tbody></table>

AuthenticationProcessData model

<table class="relative-table confluenceTable" id="bkmrk-parameter-type-descr-68"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd" colspan="1">authenticationRequestId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Authentication request id

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="e5e7394c-6a47-4b31-bd26-67faeb268f18" data-macro-name="code" data-macro-parameters="language=java|theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-validateauthenti"><tbody><tr><td class="wysiwyg-macro-body">```
fun validateAuthenticationCodeForPayment(validateAuthenticationCodeForPayment: ValidateAuthenticationCodeForPayment) {
    ucpApi.paymentService
            .validateAuthenticationCodeForPayment( validateAuthenticationCodeForPayment,
                    { validateAuthenticationCodeForPaymentResult ->
                        //ValidateAuthenticationCodeForPaymentResult plain object, 
                        //contains data to validate on backend
						val signedAuthenticationProcessData = ValidateAuthenticationCodeForPaymentResult
                        		.signedAuthenticationProcessData
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

Sample verification of signedAuthenticationProcessData (see *Data signing and encryption* chapter in Mobile DC documentation)

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="471ef791-1f27-4e88-bde6-41937f9b2650" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-class-signedauthenti"><tbody><tr><td class="wysiwyg-macro-body">```
class SignedAuthenticationProcessData {
    fun verifyAndGetAuthenticationRequestID() {
        val jwtClaimsSet = JWTVerifier.verify(signedAuthenticationProcessData, rsaPublicKey, 600);
        val authenticationRequestId = jwtClaimsSet.getStringClaim("authenticationRequestId")        
        // ...
    }
}
```

</td></tr></tbody></table>

### processDsrpTransaction(deprecated)

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="0b5cc75e-efd7-4403-bf84-f7bcf1a5b3fc" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-17"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table confluenceTable" id="bkmrk-parameter-type-descr-69"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Payment instrument identity

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">dsrpTransactionInfo</td><td class="confluenceTd" colspan="1">DsrpTransactionInfo</td><td class="confluenceTd" colspan="1"></td><td class="confluenceTd" colspan="1">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="cf7c5544-d338-4397-82c3-c70f04210d2c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-11"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with cryptogram for payment</p>

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="abe44ba2-0122-4253-80a8-2bc9c563b86c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-3"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback</p>

</td></tr></tbody></table>

### processDsrpTransaction

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b6521ea5-fcb7-4b2d-bb43-bed6b3d36ace" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-18"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method dedicated for starting DSRP transaction.  
Every DSRP transaction has to be authenticated.  
Depending on implementation payment can be process with OTP authentication or device level authentication.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-70"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh" colspan="1">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">processDsrpTransaction</td><td class="confluenceTd" colspan="1">ProcessDsrpTransaction</td><td class="confluenceTd" colspan="1">Plain ProcessDsrpTransaction object

</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

ProcessDsrpTranasction object contains following fields

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-71"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh" colspan="1">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">paymentInstrumentId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Identifier of payment instrument

</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd">dsrpTransactionInfo</td><td class="confluenceTd">DsrpTransactionInfo</td><td class="confluenceTd">Plain DsrpTransactionInfo object</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

DsrpTransactionInfo object contains following fields

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-72"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh" colspan="1">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">amount</td><td class="confluenceTd" colspan="1">Long</td><td class="confluenceTd" colspan="1">A long representing the transaction amount without the decimal. For instance 119.00 USD will be 11900 </td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd">currencyCode</td><td class="confluenceTd">Int</td><td class="confluenceTd">A char (integer) representing the transaction currency code with 3 numeric digits as per ISO 4217. For instance, value will be 840 for USD. The maximum value allowed is 999.</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">countryCode</td><td class="confluenceTd" colspan="1">Int</td><td class="confluenceTd" colspan="1">A 3 digit ISO 3166 numeric country code, e.g., 826 for UK. If not sent, this value is initialized with 000.</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">issuerCryptogramType</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Value represented by "UCAF" or "DE55" depending on cryptogram data format is to be used.</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9b441ed3-52d6-4cd8-a6ba-ab0c8adbec43" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-12"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with ProcessDsrpTransactionResult object.</p>

</td></tr></tbody></table>

ProcessDsrpTransactionResult object contains following field

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-73"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd" colspan="1">transactionResult</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">String contains information regarding weather the request was successful, and if so, further information about the transaction state.

</td></tr></tbody></table>

<span class="inline-comment-marker" data-ref="bf38c412-2250-4f3f-a858-09457dead5b7">**Sample** **DSRP transaction with device level authentication**</span>

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="e5e7394c-6a47-4b31-bd26-67faeb268f18" data-macro-name="code" data-macro-parameters="language=java|theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2F-after-merchant-ap"><tbody><tr><td class="wysiwyg-macro-body">```
// After Merchant App delivers DSRP data application should authenticate user with device level authentication 
// and next execute setUserAuthenticationForPayment().

// Values for DsrpTransactionInfo delivered by Merchant APP 

val dsrpTransactionInfo: DsrpTransactionInfo = 
	DsrpTransactionInfo(amount, currencyCode, countryCode, issuerCryptographyType)
val processDsrpTransaction: ProcessDsrpTransaction = 
	ProcessDsrpTransaction(paymentInstrumentId, dsrpTransactionInfo)

private fun setUserAuthenticatedForPayment(
    paymentInstrumentId: String,
    pinProvidedByUser: CharArray
) {
    ucpApi
        .paymentService
        .setUserAuthenticatedForPayment(paymentInstrumentId, pinProvidedByUser,
            {
                //After succesfully authentication for payment MPA should execute processDsrpTransaction()
            }, { throwable ->
                //some error, check exception
            })
}

fun processDsrpTransaction(processDsrpTransaction) {
    ucpApi.paymentService
            .processDsrpTransaction( processDsrpTransactionResult,
                    { 
						val transactionResult = processDsrpTranasctionResult.transactionResult
                        //Information if DSRP transaction went successfully result 
                        //should be delivered to Merchant APP
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

**Sample DSRP transaction with OTP authentication**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="85dfd7e7-6a3a-4ea3-b833-870c773db788" data-macro-name="code" data-macro-parameters="language=java|theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2F-after-merchant-ap-0"><tbody><tr><td class="wysiwyg-macro-body">```
// After Merchant App delivers DSRP data user should request authentication 
// code for payment with selected paymentInstrument.

// Values for DsrpTransactionInfo delivered by Merchant APP 

val dsrpTransactionInfo: DsrpTransactionInfo = 
		DsrpTransactionInfo(amount, currencyCode, countryCode, issuerCryptographyType)
val processDsrpTransaction: ProcessDsrpTransaction = 
		ProcessDsrpTransaction(paymentInstrumentId, dsrpTransactionInfo)

val requestAuthenticationCodeForPayment: RequestAuthenticationCodeForPayment = 
		RequestAuthenticationCodeForPayment(paymentInstrumentId, authenticationRequestId)
fun requestAuthenticationCodeForPayment(requestAuthenticationCodeForPayment) {
   		ucpApi.paymentService.requestAuthenticationCodeForPayment( requestAuthenticationCodeForPayment,
                    {
                        //When requesting went successfully User will get authentication code. 
						//In next step authentication code should be passed to MPA and application 
                        //should validate this code with validateAuthenticationCode() method
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}

val validateAuthenticationCode: ValidateAuthenticationCode = 
	ValidateAuthenticationCode(paymentInstrumentId, authenticationRequestId, authenticationCodeProvidedByUser)
fun validateAuthenticationCode(validateAuthenticationCode) {
    ucpApi.paymentService
            .validateAuthenticationCode( validateAuthenticationCode,
                    { validateAuthenticationCodeResulty ->
                        //ValidateAuthenticationCodeResult plain object
                        val signedAuthenticationProcessData = validateAuthenticationCodeResulty
                        		.signedAuthenticationProcessData

						//If validation went successfully MPA should show authentication view, 
                        //and after valid authentication MPA should execute setUserAuthenticatedForPayment()
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}

private fun setUserAuthenticatedForPayment(
    paymentInstrumentId: String,
    pinProvidedByUser: CharArray
) {
    ucpApi
        .paymentService
        .setUserAuthenticatedForPayment(paymentInstrumentId, pinProvidedByUser,
            {
                //After succesfully authentication for payment MPA should execute processDsrpTransaction()
            }, { throwable ->
                //some error, check exception
            })
}

fun processDsrpTransaction(processDsrpTransaction) {
    ucpApi.paymentService
            .processDsrpTransaction( processDsrpTransactionResult,
                    { 
						val transactionResult = processDsrpTranasctionResult.transactionResult
                        //Information if DSRP transaction went successfully result 
                        //should be delivered to Merchant APP
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

## Cloud messaging domain

### process

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="8c55c77f-922b-4c51-9bb8-f34f7baff5c6" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-19"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Processes data sent by UCP backend (push notification data).  
Application should check senderId in RemoteMessage object (RemoteMessage::from method) and check source in Mobile DC SDK before passing data to this method.  
Method can throw InvalidPushException in case of invalid push content passed to it.  
Refer Mobile DC documentation how to handle push.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-74"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">pushData</td><td class="confluenceTd">Map&lt;String, String&gt;</td><td class="confluenceTd">Data received from notification service in object RemoteMessage object

</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b1aad203-ab5c-49ac-b183-c1e790e77d4c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-9"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback. When request fails try again</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8cdeb452-493e-403b-af7e-b06de0d12a7b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2Ffirebasemessagings"><tbody><tr><td class="wysiwyg-macro-body">```
//FirebaseMessagingService class from Firebase

override fun onMessageReceived(remoteMessage: RemoteMessage) {
    super.onMessageReceived(remoteMessage)

    val senderId: String = remoteMessage.from
    val pushData = remoteMessage.data

	//check push source only when push source is uPaid sender Id

    if (isUpaidSenderId(senderId)) {

		//checking push source and passing to proper uPaid module

        mobileDcApi
            .cloudMessagingService
            .getSource(pushData, { source ->
                when (source) {
                    "UCP" -> processUcpPush(pushData)
                }
            }, {
                //some error
            })

    } else {
        //proceed push from another source
    }
}

private fun processUcpPush(pushData: Map<String, String>) {
    ucpApi
        .cloudMessagingService
        .process(pushData, {
            //push processed in Mobile DC
        }, {
            //some error
        })
}
```

</td></tr></tbody></table>

### processMcbpNotificationData

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="8c55c77f-922b-4c51-9bb8-f34f7baff5c6" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-20"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info"><span class="inline-comment-marker" data-ref="59ac763c-290b-4ded-a793-34fba23bb346">Asynchronous. Online.  
</span><span class="inline-comment-marker" data-ref="2d8f4d78-cdb8-4193-944a-b4d98e1ad6c2">Processes data sent by MC</span><span class="inline-comment-marker" data-ref="82acd20d-2d28-4a95-9d45-c2e57c15c6a4">BP.  
</span><span class="inline-comment-marker" data-ref="59ac763c-290b-4ded-a793-34fba23bb346">Application should check senderId in RemoteMessage object before passing data to UCP SDK.  
</span><span class="inline-comment-marker" data-ref="59ac763c-290b-4ded-a793-34fba23bb346">Basic configuration for push processing from External Wallet Server: [External Wallet Server domain](https://wiki.verestro.com/display/UCP/External+Wallet+Server+domain).  
</span><span class="inline-comment-marker" data-ref="59ac763c-290b-4ded-a793-34fba23bb346">Method can throw InvalidPushException in case of invalid push content passed to it.</span></p>

<p class="callout warning"><span class="inline-comment-marker" data-ref="59ac763c-290b-4ded-a793-34fba23bb346">**Note:** External Wallet Server Registration process mus be finished before push processing.   
</span></p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-75"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">encryptedPayload</td><td class="confluenceTd">String</td><td class="confluenceTd">Data received from notification service in object RemoteMessage object

</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="ef08529c-1412-4f11-981d-4eccd90a9f60" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-10"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="0cbf03b5-8f75-4d45-8af6-7f6ee45c67d9" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-%2F%2Ffirebasemessagings-0"><tbody><tr><td class="wysiwyg-macro-body">```
//FirebaseMessagingService class from Firebase


override fun onMessageReceived(remoteMessage: RemoteMessage) {
    super.onMessageReceived(remoteMessage)

    val senderId: String? = remoteMessage.from
    val pushData = remoteMessage.data

    //check push source based on senderId
    if (isMastercardSenderId(senderId)) {

        val mastercardPayload: String = readMastercardPushContent(pushData)

        ucpApi
            .cloudMessagingService
            .processMcbpNotificationData(mastercardPayload, {
                //push processed in Mcbp
            }, {
                //some error
            })
        
    } else {
        //proceed push from another source
    }
}
```

</td></tr></tbody></table>

## External Wallet Server domain

Chapter contains method for SDK when External Wallet Server is used.

Usage of method requires additional configuration with external API.

Basic MDES cloud messaging configuration:

<table class="relative-table confluenceTable" id="bkmrk-environment-fcm-send"><colgroup><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Environment**</th><th class="confluenceTh">**FCM Sender Id**</th></tr><tr><td class="confluenceTd">MTF</td><td class="confluenceTd">502118574555</td></tr><tr><td class="confluenceTd">PRODUCTION</td><td class="confluenceTd">993764297204</td></tr></tbody></table>

### prepareRegistrationData

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="90ae7cc4-9c04-47a6-b153-a3819765a665" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-7"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Method for preparing data used for activation.  
Should be used before calling register method.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-76"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">paymentAppInstanceId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Identifier for the specific Mobile Payment App instance</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">paymentAppProviderId</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">Globally unique identifier for the Wallet Provider, as assigned by MDES</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1"><span class="inline-comment-marker" data-ref="7c1986b8-a0e6-4695-9f3c-88a1ee35635a">publicKeyCertificate</span></td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">CMS-D public key certificate in pem format</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd">mobilePin</td><td class="confluenceTd">CharArray?</td><td class="confluenceTd">Mobile PIN used to payment confirmation

</td><td class="confluenceTd">  
</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-13"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with PrepareRegistrationResponse object.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-77"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd" colspan="1"><span class="inline-comment-marker" data-ref="f160b01e-9b7b-49f0-b4c7-bfe62506219c">publicKeyCertificateFingerprint</span></td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">CMS certificate fingerprint. Used algorithm: hex(sha1(certificate.encoded))</td></tr><tr><td class="confluenceTd">encryptedRgk</td><td class="confluenceTd">String</td><td class="confluenceTd">Encrypted randomly-generated 128-bit AES key.</td></tr><tr><td class="confluenceTd" colspan="1"><span class="inline-comment-marker" data-ref="a7aaba43-296b-46cc-b960-11e798147132">deviceInfo</span></td><td class="confluenceTd" colspan="1">EwsDeviceInfo</td><td class="confluenceTd" colspan="1">Device info.</td></tr><tr><td class="confluenceTd">deviceFingerprint</td><td class="confluenceTd">String</td><td class="confluenceTd">Unique device fingerprint.</td></tr><tr><td class="confluenceTd">encryptedPin</td><td class="confluenceTd">String?</td><td class="confluenceTd">Encrypted pin (if passed in input).</td></tr></tbody></table>

<span class="inline-comment-marker" data-ref="5b2eba54-b6c6-44dc-94a1-77b016e6aea9">EwsDeviceInfo</span> model:

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-78"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">deviceName</td><td class="confluenceTd">String</td><td class="confluenceTd">Device model name.</td></tr><tr><td class="confluenceTd" colspan="1">formFactor</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The form factor of the target provisioned device.</td></tr><tr><td class="confluenceTd" colspan="1">storageTechnology</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The architecture or technology used for token storage.</td></tr><tr><td class="confluenceTd" colspan="1">osName</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The name of the operating system of the target provisioned device.</td></tr><tr><td class="confluenceTd" colspan="1">osVersion</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The version of the operating system of the target provisioned device.</td></tr><tr><td class="confluenceTd" colspan="1">nfcCapable</td><td class="confluenceTd" colspan="1">Boolean</td><td class="confluenceTd" colspan="1">Whether the target provisioned device has NFC capability.

</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e3542ff8-9509-4889-a7cf-aa179dcdce47" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-4"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="f144678d-f76d-4bce-9b3b-f6ef3a7d1525" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-prepareregistrat"><tbody><tr><td class="wysiwyg-macro-body">```
fun prepareRegistrationData(
        paymentAppInstanceId: String,
        paymentAppProviderId: String,
        publicKeyCertificate: String,
        mobilePin: CharArray?) {

    ucpApi
            .ewsService
            .prepareRegistrationData(paymentAppInstanceId,
                    paymentAppProviderId,
                    publicKeyCertificate,
                    mobilePin,
                    { prepareRegistrationResponse ->
                        //Prepared data for registration including encryptedMobilePin if mobilePin is used
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### register

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="c1929180-fa9c-46e6-94b9-f4f4538f68e8" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-21"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method used for registration new Mobile Payment App instance with MDES for use.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-79"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">mobileKeysetId</td><td class="confluenceTd">String</td><td class="confluenceTd">Identifies the Mobile Keys used for this remote management session

</td><td class="confluenceTd">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">ewsMobileKeys</td><td class="confluenceTd" colspan="1">EwsMobileKeys</td><td class="confluenceTd" colspan="1">Contains the mobile keys used to secure the communication during subsequent remote management sessions

</td><td class="confluenceTd" colspan="1">Not empty</td></tr><tr><td class="confluenceTd" colspan="1">remoteManagementUrl</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The URL endpoint for subsequent remote management sessions

The Mobile Payment App must store this URL for future use in order to be able to request new remote management sessions

</td><td class="confluenceTd" colspan="1">Not empty</td></tr></tbody></table>

<span class="inline-comment-marker" data-ref="b8a79bc3-29a7-4cf3-874a-50a55f086f31">EwsMobileKeys</span> model:

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-80"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">transportKey</td><td class="confluenceTd">String</td><td class="confluenceTd">The Mobile Transport Key used to provide confidentiality of data at the transport level between the Mobile Payment App and MDES

</td></tr><tr><td class="confluenceTd" colspan="1">macKey</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The Mobile MAC Key used to provide integrity of data at the transport level between the Mobile Payment App and MDES

</td></tr><tr><td class="confluenceTd" colspan="1">dataEncryptionKey</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The Mobile Data Encryption Key used to encrypt any sensitive data at the data field level between the Mobile Payment App and MDES

</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="2537f605-96bb-4a57-9323-85c318916f61" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-11"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**<span class="inline-comment-marker" data-ref="a5061c05-1058-49ec-a30b-db1a55f7807e">Sample</span>**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="4d7e78ad-1754-4a4c-a677-f5b8558226cd" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-register%28-mobile"><tbody><tr><td class="wysiwyg-macro-body">```
fun register(
        mobileKeysetId: String,
        ewsMobileKeys: EwsMobileKeys,
        remoteManagementUrl: String) {

    ucpApi
            .ewsService
            .register(mobileKeysetId, ewsMobileKeys, remoteManagementUrl,
                    {
                        //Device registration success 
                        //application should listen to push messages and UcpPaymentInstrumentEventListener callbacks
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation  
                    }
            )
}
```

</td></tr></tbody></table>

### activate

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9f6ec765-6e80-48e4-812b-18ce55b0fe8c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-22"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method to <span class="inline-comment-marker" data-ref="ff9d0111-3920-44a2-b330-463baf9590fa">activate</span> PaymentInstrument.  
Should be used only on PaymentInstrumens which PaymentInstrumentStatus is <span class="inline-comment-marker" data-ref="1d2e0778-2b5f-434a-9e52-b1830fb9616f">SUSPENDED or INACTIVE</span>.  
Changes PaymentInstrumentStatus to <span class="inline-comment-marker" data-ref="dd4d9205-50e7-47a0-84f0-3c339107fff1">ACTIVE</span>, calls for transaction credentials replenish and set PaymentInstrument as default for payment when no other PaymentInstrument is available.  
Method can be used when onProvisioningSuccess callback is trigerred to instantly activate card.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-81"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd"><span class="inline-comment-marker" data-ref="3166a877-9c9a-461e-9079-2b095d1dd082">paymentInstrumentId</span></td><td class="confluenceTd">String</td><td class="confluenceTd">Id of paymentInstrument to activate.</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="650992b9-37f6-4086-98af-1af4af596154" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-12"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**<span class="inline-comment-marker" data-ref="299a20fa-c6e7-4d9a-a57d-41bc8c8aa147">Sample</span>**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8333bc00-d86d-4db1-84e9-114273160b9b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-activate%28payment"><tbody><tr><td class="wysiwyg-macro-body">```
fun activate(paymentInstrumentId: String) {
    ucpApi
		.ewsService
        .activate(paymentInstrumentId,
		{
         	//Changes PaymentInstrumentStatus to ACTIVE, set card as default for payment if another 
            //is not already setted Performing replenish, 
            //application should listen to push message with information about replenish success/failure 
        }, 
		{ throwable ->
        	//Something went wrong, check exception with documentation
        }
	)
}
```

</td></tr></tbody></table>

### suspend

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="569b41ca-4709-4ecd-9ae2-2348dd7812f9" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-8"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Method for suspending paymentInstrument.  
Changes PaymentInstrumentStatus to <span class="inline-comment-marker" data-ref="9c3b02cf-ddf4-42a1-9d19-31999c7e7998">SUSPENDED</span>.  
Use activate method to allow payments again.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-82"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of paymentInstrument to suspend.</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7f7ad572-ce70-48b9-800b-2d2fa0222ad3" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-13"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**<span class="inline-comment-marker" data-ref="6d9aaca9-6653-4fdc-92d9-e1ea110e536a">Sample</span>**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8333bc00-d86d-4db1-84e9-114273160b9b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-suspend%28paymenti"><tbody><tr><td class="wysiwyg-macro-body">```
fun suspend(paymentInstrumentId: String) {
    	ucpApi
			.ewsService
            .suspend(paymentInstrumentId,
			{
           		 //Changes PaymentInstrumentStatus to SUSPENDED.
            }, 
			{ throwable ->
            	 //Something went wrong, check exception with documentation
            }
	)
}
```

</td></tr></tbody></table>

### getPaymentInstrument

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="30e98e58-ee95-4078-941d-9461cf478a5a" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-9"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Method for getting single PaymentInstrument from local storage object based on id.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-83"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">paymentInstrumentId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of paymentInstrument to get.

</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="2d9978ce-35b8-42ef-a8cc-c06769fbfec2" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-14"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with PaymentInstrument object.</p>

</td></tr></tbody></table>

<table class="wrapped relative-table confluenceTable" id="bkmrk-parameter-type-descr-84"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstrument</td><td class="confluenceTd">PaymentInstrument</td><td class="confluenceTd">Retrieved paymentInstrument</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="06a47435-610a-49fc-9c46-f39594598d54" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-4"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8333bc00-d86d-4db1-84e9-114273160b9b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getpaymentinstru-1"><tbody><tr><td class="wysiwyg-macro-body">```
fun getPaymentInstrument(paymentInstrumentId: String) {
    ucpApi.ewsService
            .getPaymentInstrument(paymentInstrumentId,
                    { paymentInstrument ->
                        //PaymentInstrument from local storage
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### getAllPaymentInstruments

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="e4ba943f-9372-45a7-b692-23d020ff7e44" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-10"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.  
Method for getting all payment instruments from local storage.</p>

</td></tr></tbody></table>

**Input**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="70fd3419-b36d-47be-9687-92a9a981f00c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-no-input-parameters-3"><tbody><tr><td class="wysiwyg-macro-body">No input parameters

</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="657c7a09-2a79-4aa4-a9f8-940e67440972" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-15"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with list of PaymentInstrument objects.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-85"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">paymentInstruments</td><td class="confluenceTd">List&lt;PaymentInstrument&gt;</td><td class="confluenceTd">List of retrieved payment instruments from local storage</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="3eb083bb-d94b-4e7f-a167-fda57e44e705" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-5"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="edbfe0cc-6fb4-4c4f-b8ed-1ab98260ff59" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getallpaymentins-1"><tbody><tr><td class="wysiwyg-macro-body">```
fun getAllPaymentInstrument() {
    ucpApi.ewsService
            .getAllPaymentInstruments(
                    { paymentInstruments ->
                        //List of PaymentInstrument from local storage
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

### getEncryptedPin

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="b9579cd8-fe2a-484c-a114-b7f7a3a62044" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-offlin-11"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Offline.|  
Method for encrypting mobilePin. When updated on MDES call method onMobilePinChganged.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-86"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd" colspan="1">pin</td><td class="confluenceTd" colspan="1">CharArray</td><td class="confluenceTd" colspan="1">PIN to encrypt.</td><td class="confluenceTd" colspan="1">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="650992b9-37f6-4086-98af-1af4af596154" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-16"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with encrypted mobile PIN.</p>

</td></tr></tbody></table>

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-87"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">encryptedMobilePin</td><td class="confluenceTd">String</td><td class="confluenceTd">Hex encoded encrypted mobile PIN.</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="a8bc88db-1fb1-48ee-94d1-c49cc14446e0" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback.-6"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback.</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8333bc00-d86d-4db1-84e9-114273160b9b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getencryptedpin%28"><tbody><tr><td class="wysiwyg-macro-body">```
fun getEncryptedPin(pin: CharArray) {
    ucpApi
            .ewsService
            .getEncryptedPin(pin, { encryptedPin ->
                //call to Wallet Server with new created encrypted mobile PIN
                //when updated call onMobilePinChanged method
            }, {
                //Something went wrong, check exception with documentation
            })
}


```

</td></tr></tbody></table>

### onMobilePinChanged

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="264aa8f7-d4d2-4ff2-845a-11ddb240a5c8" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-23"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
<span class="inline-comment-marker" data-ref="e9698825-23b8-4d3f-953f-83d66d42e2b6">Method for informing SDK about mobilePin change</span>.  
Should be used when mobilePin changed.  
<span class="inline-comment-marker" data-ref="6c5a335c-8200-4bbe-9a8c-fbf847ca371d">The result of action is deletion of existing transaction credentials and replenish.</span></p>

</td></tr></tbody></table>

**Input**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="1f5c7de8-ff6f-4367-bba9-421ef1eac5a8" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-no-input-parameters-4"><tbody><tr><td class="wysiwyg-macro-body">No input parameters

</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="54a8a571-d66b-4f7a-8e2f-a57692b1ea0b" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-14"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="edbfe0cc-6fb4-4c4f-b8ed-1ab98260ff59" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-reactonmobilepin"><tbody><tr><td class="wysiwyg-macro-body">```
fun reactOnMobilePinChanged() {
    ucpApi
        .ewsService
        .onMobilePinChanged(
            {
				// Informing SDK about changing mobile pin processed succesfully.
				// SDK should delete and next replenish transaction credentials. 
				// Listen for UcpPaymentInstrumentEventListener events
            }, { throwable ->
				// Something went wrong, check exception with documentation.
            })
}
```

</td></tr></tbody></table>

### delete 

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="9f6ec765-6e80-48e4-812b-18ce55b0fe8c" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-24"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info"><span class="inline-comment-marker" data-ref="2b97399e-8161-4657-8e08-afbd39460d45">Asynchronous. Online.  
</span><span class="inline-comment-marker" data-ref="2b97399e-8161-4657-8e08-afbd39460d45">Method to removing PaymentInstrument.  
</span><span class="inline-comment-marker" data-ref="2b97399e-8161-4657-8e08-afbd39460d45">Removed transaction credentials and PaymentInstrument from local storage and in MDES.  
</span>When success PaymentInstrument will be no longer available in *getPaymentInstrument* and *getPaymentInstruments*methods.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-88"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd"><span class="inline-comment-marker" data-ref="3166a877-9c9a-461e-9079-2b095d1dd082">paymentInstrumentId</span></td><td class="confluenceTd">String</td><td class="confluenceTd">Id of paymentInstrument to delete.</td><td class="confluenceTd">Not empty.</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="650992b9-37f6-4086-98af-1af4af596154" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-%2F-failure-ca-15"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Success / failure callback</p>

</td></tr></tbody></table>

**<span class="inline-comment-marker" data-ref="299a20fa-c6e7-4d9a-a57d-41bc8c8aa147">Sample</span>**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8333bc00-d86d-4db1-84e9-114273160b9b" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-delete%28paymentin-1"><tbody><tr><td class="wysiwyg-macro-body">```
fun delete(paymentInstrumentId: String) {
    ucpApi
            .ewsService
            .delete(paymentInstrumentId,
                    {
                        //Selected Payment instrument is removed
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

## Assets Domain

### getAsset

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="ee592d11-5678-49f6-bdee-71cd093ae072" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-asynchronous.-online-25"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout info">Asynchronous. Online.  
Method for getting all assets for selected assetId.</p>

</td></tr></tbody></table>

**Input**

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-89"><colgroup><col></col><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th><th class="confluenceTh">**Validation conditions**</th></tr><tr><td class="confluenceTd">assetId</td><td class="confluenceTd">String</td><td class="confluenceTd">Id of assets to retrive</td><td class="confluenceTd">Not empty</td></tr></tbody></table>

**Output**

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="7c700f72-2bbf-40d7-8787-008c86ac6cce" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-success-callback-wit-17"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout success">Success callback with list of Assets objects.</p>

</td></tr></tbody></table>

<table class="confluenceTable" id="bkmrk-parameter-type-descr-90"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">ucpAsset</td><td class="confluenceTd">UcpAsset</td><td class="confluenceTd">Plain UcpAsset object</td></tr></tbody></table>

UcpAsset object contains following field

<table class="confluenceTable" id="bkmrk-parameter-type-descr-91"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">content</td><td class="confluenceTd">List&lt;UcpAssetContent&gt;</td><td class="confluenceTd">Plain list of UcpAssetContent objects</td></tr></tbody></table>

UcpAssetContent contains following fields.

<table class="relative-table wrapped confluenceTable" id="bkmrk-parameter-type-descr-92"><colgroup><col></col><col></col><col></col></colgroup><tbody><tr><th class="confluenceTh">**Parameter**</th><th class="confluenceTh">**Type**</th><th class="confluenceTh">**Description**</th></tr><tr><td class="confluenceTd">data</td><td class="confluenceTd">String</td><td class="confluenceTd">The data for this asset. Base64-encoded data, given in the format as specified in type.</td></tr><tr><td class="confluenceTd" colspan="1">type</td><td class="confluenceTd" colspan="1">String</td><td class="confluenceTd" colspan="1">The data MIME type. One of: application/pdf, text/plain, text/html, image/png, image/svg+xml, image/pdf.</td></tr><tr><td class="confluenceTd" colspan="1">width</td><td class="confluenceTd" colspan="1">Long?</td><td class="confluenceTd" colspan="1">For image assets, the width of this image. Specified in pixels.</td></tr><tr><td class="confluenceTd" colspan="1">height</td><td class="confluenceTd" colspan="1">Long?</td><td class="confluenceTd" colspan="1">For image assets, the width of this image. Specified in pixels.</td></tr></tbody></table>

<table class="wysiwyg-macro" data-macro-body-type="RICH_TEXT" data-macro-id="60c0b11e-990c-484a-9113-b82ec678c03d" data-macro-name="info" data-macro-schema-version="1" id="bkmrk-failure-callback-5"><tbody><tr><td class="wysiwyg-macro-body"><p class="callout danger">Failure callback</p>

</td></tr></tbody></table>

**Sample**

<table class="wysiwyg-macro" data-macro-body-type="PLAIN_TEXT" data-macro-id="8ce351a1-4a82-4e0f-be90-0f5be6a1c1c7" data-macro-name="code" data-macro-parameters="theme=Eclipse" data-macro-schema-version="1" id="bkmrk-fun-getasset%28assetid"><tbody><tr><td class="wysiwyg-macro-body">```
fun getAsset(assetId: String) {
    ucpApi.assetsService
            .getAssets( assetId,
                    { ucpAsset ->
                        //List of assets of selected assetId
						val ucpAssetContentList = ucpAsset.content
                    },
                    { throwable ->
                        //Something went wrong, check exception with documentation
                    }
            )
}
```

</td></tr></tbody></table>

## DOCUMENT CHANGELOG

Version 1.0.1

- Created

Version 2.0.0

- Changed approach to SDK setup
- Added UcpSdkException
- Added new reason codes to existing exceptions
- New methods in cards domain: digitize, getPaymentInstrument, getAllPaymentInstruments, delete
- New methods in ibans domain: digitize, getPaymentInstrument, getAllPaymentInstruments, delete
- New methods in cloud messaging domain: processMcbpNotificationData
- New methods in payment domain: abortUserAuthenticationForPayment, replenishCredentials, restartContactlessTimer
- New methods in external wallet server domain: prepareRegistrationData, register

Version 2.1.0

- <span class="inline-comment-marker" data-ref="3e5bebb4-c150-4421-ba64-9bb54287b905">Added new methods in External Wallet Server domain (activate, suspend, getPaymentInstrument, getPaymentInstruments, onMobilePinChanged)</span>

<span class="inline-comment-marker" data-ref="3e5bebb4-c150-4421-ba64-9bb54287b905">Version 2.1.1</span>

- Fixed dependencies for release version
- Added information about SDK size
- Added information about SDK integration on lower Android API level

Version 2.2.0

- Added new method in EWS Service - getEncryptedPin
- SDK startup optimization

Version 2.2.2

- Fixed dependencies conflicts
- Consumer Proguard rules update
- <span class="inline-comment-marker" data-ref="e46aa36d-3f39-4af7-8b36-e51edeafeec3">Certificate pinning implementation improvement</span>

<span class="inline-comment-marker" data-ref="e46aa36d-3f39-4af7-8b36-e51edeafeec3">Version 2.2.3</span>

- Fixed setting default PaymentInstrument after activation
- Fixed doubled callback onPaymentInstrumentStatusChanged for DELETED status

Version 2.2.4

- Added new enum state TransactionAbortReason.NO\_CARDS. Callback onContactlessPaymentAborted is now called when no card is available for payment.
- Added new model ContactlessTransactionData with better formatting terminal data. New object is added for events EventGetFinalDecision, EventAuthRequiredForContactless, EventContactlessPaymentCompleted.
- ContactlessTransactionInformation is now deprecated.

Version 2.2.6

- Added new exception parameter to EventContactlessPaymentAborted, EventContactlessPaymentIncident, EventReplenishFailure, EventProvisioningFailure
- Fixed problem with flow cutting on digitalization process

Version 2.2.7

- Added reset functionality.
- Addded method in Ibans service createPaymentDat.
- Method createTVC iban service is now deprecated.
- Added global listener for most important internal SDK actions related to token managem

Version 2.3.1

- Added *delete* method in External Wallet Server domain
- Added more detailed descriptions for methods from External Wallet Server domain
- Added more information about models related to payment processing

Version 2.3.2

- Fixed SDK provisionning process on Google Pixel devices
- Improved default Payment Instrument management
- Updated security harmful process check mechanism

Version 2.3.8

- Improved facade exception throwing, now contains more details about error.
- Removing whitespaces from merchantAndLocation in ContectlessTransactionData model
- Updated security harmful process check mechanism
- Added MCBP cloud messaging queue handling to prevent processing errors

Version 2.3.11

- Added new method in Payment Service: processDsrpTransaction
- Added new method in User Service: resendOtp
- Added new paremeter in createPaymentData IbanInfo model: userId
- Improved default PaymentInstrument management
- Fixed clearing SDK state when unpairing device (MobileDC unPair method)

Version 2.3.12

- Core module with update.
- Added new reports to Wallet Server.

Version 2.3.13

- Added new parameter *result* to IbanDigitizationResult model
- Parameter *cloudDigitizationSuccess* in IbanDigitizationResult is now deprecated

Version 2.3.17

- Fixed parsing merchantAndLocation field from ContactlessTransactionData.
- Added EWS configuration parameter in setup.

Version 2.3.18

- Updated security libraries

Version 2.3.21

- Added optional UcpHttpExecutor for handling CMS-D communication to UcpConfiguration
- Replenish process optimization

Version 2.3.22

- Improved internal SDK logs reporting
- Using androidX in end project is necessary now
- Improved automatic replenish credentials process
- Added handling ReDigititzation process in SDK. Use withOptionalReProvisionEventListener method in SDK setup method to observe PaymentInstrument changes

Version 2.3.22.2

- Added more validation for input parameters for External Wallet Server service
- Added data verification before accessing data in CMS-D processes
- Improved catching exceptions for MCBP processes
- Improved flow for reset() method - added protection agains processing messaging after SDK reset()
- Changed algorithm for calculating publicKeyCertificateFingerprint in PrepareRegistrationDataResponse. From hex(sha1(certificate.publicKey.encoded)) to hex(sha1(certificate.encoded))
- Added support for multiple calling setUserAuthenticatedForPayment() method

Version 2.3.24

- Added new state for TransactionAbortReason::TERMINAL\_INACTIVITY\_TIMEOUT. Previously status was part of TransactionAbortReason::TERMINAL\_ERROR and produces contactless payment aborted handling problems. Status is used in onContactlessPaymentAborted callback. Application can ignore this state and do not perform any action.
- Added method on UcpApi for SDK restart(). Unlike reset() new method is asynchronous and allows to usage UCP SDK without application kill. Method clears all UCP SDK data and restarts to initial state.
- Introduced new approach to handling security issue. When application will call any SDK method after security issue reporting, UcpSkdExpcetion with SECURITY\_EVENT\_OCCURRED will be returned. Previously APPLICATION\_PROCESS\_NOT\_KILLED was returned. Change doesn't impact onSecurityIssue callback.
- Added Assets Domain and getAsset() method.
- Added verification of input parameters in token profile and transaction credentials replenish.
- Added more details in callbacks onProvisioningFailure and onReplenishFailure about errors in token related operations.

Version 2.4.3

- IMPORTANT Update security tools after EMV Security Evaluation - refer to Mobile DC technical documentation version changelog (version 2.12.0)
- Update Gradle and R8 tools
- Handled authentication flow for ContactlessRichTransactionType REFUND. SDK requires authentication if not provided.
- Improved description for ContactlesssTransactionResult model in documentation.
- Added new ContactlessRichTransactionType: WITHDRAWAL and ATM\_CONTACTLESS

Version 2.4.4

- Updated MDC SDK to 2.12.1 - fixed aggressive security process check
- Updated documentation for TransactionAbortReason:TERMINAL\_INACTIVITY\_TIMEOUT model

Version 2.5.1

- Methods marked as deprecated:
    
    
    - reset (use restart instead)
    - getPaymentInstrument (use getAllPaymentInstruments instead)
    - setDefaultForRemote (usage is redundant)
    - getDefaultForRemote (usage is redundant)
    - processDsrpTransaction(use new processDsrpTransaction method with *ProcessDsrpTransaction* added model)
- Added new methods related to OTP authentication code:
    
    
    - requestAuthenticationCodeForPayment
    - validateAuthenticationCodeForPayment
- Added new methods for supporting yellow-path token activation:
    
    
    - checkEligibility
    - digitize (new version with support for checkEligibility usage)
    
    
    - submitTokenAuthenticationMethod
    - submitTokenAuthenticationValue
    - getAdditionalAuthenticationMethods
- Fixed getPaymentInstrument method (case invalid error when session expired error occurred).
- Updated Kotlin version to 1.5.31 and Koin to 2.1.6.
- Removed unused permissions *ACCESS\_FINE\_LOCATION* and *com.google.android.c2dm.permission.RECEIVE .*
- Added logs for all facade methods (available in SDK debug version).

Version 2.5.2

- Fixed UcpMcbpHttpExecutor from version 2.5.1. The issue doesn't impact on other functionality

Version 2.5.3

- Update internal libraries. **IMPORTANT** Read more in Mobile DC changelog for version 2.13.3

Version 2.5.5

<div class="wiki-content" id="bkmrk-wrap-in-try-catch-bl">- Wrap in try-catch block callbacks from SDK *setup()* method to prevent breaking process in SDK. Read more in *setup*() method description.

</div>Version 2.5.6

<div class="wiki-content" id="bkmrk-resolved-google-play">- Resolved Google Play Console Security warning
- Updated Mobile DC dependency to 2.13.6 
    <div class="wiki-content" id="bkmrk--144"></div>

</div>Version 2.5.7

<div class="wiki-content" id="bkmrk-updated-mobile-dc-de">- Updated Mobile DC dependency to 2.13.7

</div><div class="wiki-content" id="bkmrk--139"></div><div class="wiki-content" id="bkmrk--140"></div>

# Technical Documentation MDC SDK

The Mobile DC SDK is a core module dedicated to the management of users, devices, and cards in the Verestro system. To learn more about Mobile DC SDK follow: [Link to Mobile DC SDK technical documentation](https://developer.verestro.com/books/user-lifecycle-card-management-api-sdk/page/technical-documentation-mdc-sdk "User Lifecycle & Card Management API & SDK")

# Technical documentation UCP External API

Technical Documentation UCP External API

@swagger="https://services.upaidtest.pl/ucp/doc.yaml/external"