# Token Requestor

NFC Issuer Wallet with Mobile SDK. Mastercard MCBP 2.1 SDK and Visa VTS SDK.

# Introduction

Token Requestor service is a set of solutions for establishing Issuer Wallet for NFC Payments.

Issuer Wallet gives flexibility about user, cards and tokens lifecycle. It can be easily integrated within existing Mobile Banking or Payment Application. It is a full ecosystem which contains:

- SDK for Android platform - library responsible for payment procedures, token lifecycle; highly configurable; certified by EVMCo.
- Server component - system integrated with Mastercard's MDES and Visa's VTS and various Verestro services.

Issuer wallet functionalities examples:

- Payment Card digitization in cooperation with MDES, VTS and [Token Management Platform.](https://developer.verestro.com/books/token-management-platform)
- Processing payments in one-tap and two-tap scenarios.
- Payment Tokens automated lifecycle.
- Payment history without expiration date.
- Other Verestro services synchronization.
- [EMVCo certified product.](https://www.emvco.com/approved-registered/approved-products/?action=search_products&approved_product_expiration_date=2020-08-31&px_search=&emvco_product_sbmp%5B0%5D=mobile-app-sdk&sort=approved_product_expiration_date&sort_order=ASC)

# Overview

Verestro Cloud Payments is a solution developed to facilitate adopting cloud-based payments for the Customers. VCP provides functionalities for User identification and verification, P<span class="inline-comment-marker" data-ref="00c599e9-b547-4fea-9719-04f0c5ffafca">ayment Instruments</span> digitization and User data management. Cloud payments enables a card to be digitized into a wallet application on a mobile device and used for payment without the need for a Secure Element (SE) or a Trusted Execution Environment (TEE) to protect the card’s sensitive assets, such as the keys needed for calculating the Application Cryptogram.

Master Keys for the digitized card are kept securely on remote servers(for plastic in the chip), hence the term ‘cloud-based payment,’ and a limited number of keys (where each key can only be used to perform a single transaction) are downloaded to the application.

Solution consists of:

<div class="wiki-content" id="bkmrk-server-components%3A-w">- server components: 
    - Wallet Server - backend component,
    - Wallet Admin Panel - frontend component,
- mobile components: 
    - Wallet SDK - Android libraries.

</div>## Benefits of Payment Token

The MCBP service is an easy and secure way to replace a plastic payment card with a payment token. Recognition to the tokenization and digitization process without leaving the house, we can add our payment card to the mobile application and use only a mobile device during purchases.  
The benefits of tokenization are felt by every participant in the process:  
Issuer - by implementing the tokenization service, it will provide its customers with much higher and safer access to innovative payment solutions.  
Card Holder - can freely use innovative payment solutions. The tokenization service will allow free and secure payments using any devices connected to the internet.

<div id="bkmrk-"><div class="no-print" id="bkmrk--50"></div></div>## MCBP Introduction

Mastercard Cloud-Based Payments (MCBP) is technology which enables a card to be digitized into an application on a mobile device. On plastic card, Master Keys needed for calculating cryptogram are stored in the Secure Element. Using MCBP there is no need for Secure Element since keys needed for calculating the cryptogram are kept securely on remote servers, hence the term ‘cloud-based payment,’ and a limited number of keys (where each key can only be used to perform a single transaction) are downloaded to the application. VCP is solution which provides functionalities for digitization, user data management and payments needed for final Customer to adopt MCBP.

### MCBP High Level Architecture 

[![image-1654374212441.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654374212441.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654374212441.png)

### MCBP Key Components

<table border="1" id="bkmrk-component-descriptio"><tbody><tr><td>**Component**</td><td>**Description**</td></tr><tr><td class="confluenceTd">MPA</td><td class="confluenceTd">Android Mobile Payment Application provides frontend interface to the user and uses part of Verestro Wallet SDK which is responsible for payments using HCE.</td></tr><tr><td class="confluenceTd">Verestro Wallet Server</td><td class="confluenceTd">Provides the backend services to support Mobile Payment Application via Verestro Wallet SDK and is responsible for managing users, devices, cards, Payment Tokens and communication with MDES. Wallet Server acts as Token Requestor on behalf of Issuer in context of digitization.</td></tr><tr><td class="confluenceTd">Verestro Wallet SDK</td><td class="confluenceTd">Provides all functionalities needed for MPA to perform all needed operations related to MCBP.</td></tr><tr><td class="confluenceTd">MDES

</td><td class="confluenceTd"><span class="inline-comment-marker" data-ref="36d623fa-7c74-4f2e-9613-b63fe40f8b02">T</span>oken Service Provider which supports digitization(transforming the card into Payment Token) and is responsible for management, generation and provisioning of transaction credentials into mobile devices to enable simpler and more secure digital payment experience.</td></tr><tr><td class="confluenceTd">Remote Notification Service</td><td class="confluenceTd">Wallet Server communicates with the MPA also using Remote Notification Service. For Android is used Firebase Cloud Messaging.</td></tr><tr><td class="confluenceTd">Issuer</td><td class="confluenceTd">Issuer is responsible for card issuing, accepting authorization digitization requests and accepting transactions which uses token.</td></tr></tbody></table>

## Description

### Wallet Types 

VCP supports following wallet types which can be used in the implementation:

<div class="wiki-content" id="bkmrk-open---user-register"><div class="wiki-content">- OPEN - user registers itself in the application and provides data like PAN etc.,

- CLOSED - user data are passed automatically from Customer servers without User interaction to Wallet Server.

</div></div>### Imlementation Models

Verestro provides two different implementation models for products: integrated <span class="inline-comment-marker" data-ref="97bb34f4-a90b-4656-b137-2dc8cf07e9ca">and standalone version.  
</span>

**<span class="inline-comment-marker" data-ref="97bb34f4-a90b-4656-b137-2dc8cf07e9ca">Integrated</span>**

In this model Customer is owner of<span class="inline-comment-marker" data-ref="ca67dc1a-65a6-4b95-967c-86ec3518a9cd"> MPA</span>. Verestro provides Wallet SDK and Wallet Server. Customer is responsible for direct User authentication and passes the result of the authentication to Wallet SDK. Online operations which <span class="inline-comment-marker" data-ref="8c5d08f8-cc4c-4d8e-bd98-91fb28b5a236">need</span> to be performed by User using Wallet Server <span class="inline-comment-marker" data-ref="678545c4-fe8d-44b3-98cd-4dcad60949b9">require</span> valid session on Wallet Server. To obtain user online session with Wallet Server, Customer needs to pass <span class="inline-comment-marker" data-ref="5b9076ff-0917-4487-be44-a64e16065fb7">Trusted Identity.</span>

**<span class="inline-comment-marker" data-ref="5b9076ff-0917-4487-be44-a64e16065fb7">Standalone</span>**

In this model Verestro provides MPA, Wallet SDK and W<span class="inline-comment-marker" data-ref="fcdb30d1-339e-450d-95c9-fe75ca4949d8">allet Server. Furthermore, Verestro manages direct user authe</span>ntication.

### Architecture

[![image-1654374565801.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654374565801.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654374565801.png)

### Server Components

Server components are applications which <span class="inline-comment-marker" data-ref="22436c7d-9dc1-4a2b-a8cb-a35723fa4ab9">need</span> to be deployed on remote server to make possible to connect them by network.

#### Deployment Models

Verestro offers two deployment models of server components. On-premise and SaaS.

SaaS - Server components are designed to be deploy in SaaS model. In this case everything is deployed and configured on Verestro side. Verestro is responsible for <span class="inline-comment-marker" data-ref="f7c5ee4a-d7b4-436a-a08d-80b848607f95">maintaining</span> infrastructure, deploying applications and monitoring.

On-premise - Server components also can be deployed on Customer infrastructure. Applications are designed to be deployed using [K<span class="inline-comment-marker" data-ref="1af4839c-c21e-48d5-9f9f-fe05e91b4ba5">ubernetes</span>](https://kubernetes.io/) as system for automating deployment, scaling, and management of containerized applications. For more details please contact Verestro representative.

#### Wallet Server

<span class="inline-comment-marker" data-ref="6de4aa14-4355-42f7-970f-97f5fbc774f5">Wallet Server - is backend component which consists of few internal services which are responsible for managing users, devices, cards, Payment Tokens, transaction history. It acts as Token Requestor on behalf of Issuer and is c</span>ompliant with PCI Data Security Standard.

<span class="inline-comment-marker" data-ref="6de4aa14-4355-42f7-970f-97f5fbc774f5">It exposes:</span>

- mobile API - available via Wallet SDK to <span class="inline-comment-marker" data-ref="71d24dfa-36a8-4b47-a3d6-f2fdb1a6c280">performs</span> operations directly from mobile device,
- LC API - server API dedicated for Issuer to manage users and cards data on Wallet Server,
- admin API - server api dedicated for admin panel frontend,
- MDES Outbound API - server API dedicated for MDES.

Wallet Server operates with domain objects like:

- User - root of entity tree. User is identified in Wallet Server via some unique identifier which can be external id given by Customer. User can have access to his data and operations based on session. Session is created after paring device and when is expired then User authentication needs to be performed. <span class="inline-comment-marker" data-ref="97ec29d9-de8d-4868-888a-c76e7541e8ed">Session</span> is valid <span class="inline-comment-marker" data-ref="5438ae1f-0b85-4eac-95d8-91ea909c9108">configurable period of time</span>.
- Device - belongs to User. When User starts using application after installation then device pairing is performed. After pairing device with some unique id(constant across installations and users<span class="inline-comment-marker" data-ref="96df8e20-0f99-4db1-b1e7-2443aefc1aac">),</span> unique device installation id is generated and this installation is assigned to particular User. It is possible to have one active installation on specific device for specific User. If other User starts using application on same device then another device pairing is performed and all data from previous installation will be wiped.
- Card - belongs to User. User can have many cards. Card is identified via internal id given after storing card on Wallet Server. Whole PAN is stored on Wallet Server(always or short period of time). <span class="inline-comment-marker" data-ref="2bb6aa0f-4f38-4e08-9711-0d3f3e32e839">  
    </span>
- Payment Token - after PAN digitization, device Payment Token is created also on Wallet Server side without any sensitive data. One PAN can have one device Payment Token on specific device installation at the same time which is INACTIVE, ACTIVE or SUSPENDED.

[![image-1654374710316.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654374710316.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654374710316.png)

#### Wallet Admin Panel

Web frontend application which is dedicated for back office to manage all User data.

### Mobile Components

<div class="wiki-content" id="bkmrk--3"></div><div id="bkmrk--4"><div class="no-print" id="bkmrk--51"></div></div>#### Wallet SDK

Verestro provides Software Development Kit (SDK) called Wallet SDK which can be used in Mobile Payment Application. As a compan<span class="inline-comment-marker" data-ref="b105c2cb-2e1d-4eae-bb0e-e9dc00fcfacb">y</span>, Verestro provides many products which can be used in single application. For that reason Wallet SDK is divided into separated modules which covers different functionalities. There are two main modules dedicated for Verestro Cloud Payments: MDC SDK and UCP SDK. <span class="inline-comment-marker" data-ref="9c246dbd-27f5-45b6-b4c9-06bda9d2beec">MDC SDK is core Verestro module responsible for user data management: authentication, payment cards management - since these are main functionalities used in every product. </span>UCP SDK is dedicated for performing digitization and payments using Payment Token. In payment context UCP SDK wraps <span class="inline-comment-marker" data-ref="495056b6-b208-4f08-8c75-91ff9e8248d9">Mastercard</span> Cloud Based Payment SDK.

<div class="wiki-content" id="bkmrk--5"></div><div id="bkmrk--6"><div class="no-print" id="bkmrk--52"></div></div>#### Requirements

Wallet SDK has some mandatory requirements to make it work:

- device cannot be rooted,
- Android OS image (ROM) should be genuine in version 6.0 (Marshmallow) or above,
- devices cannot have enabled debugging.

There are also some not mandatory requirements, but Customer needs to be aware of them to maintain functionalities:

- NFC module necessary for HCE payments,
- lock screen necessary for locally-verified user authentication.

#### Security

Wallet SDK was developed according to security requirements included in Security Guide MCBP SDK for Android. However Wallet SDK cannot guarantee full MPA protection and MPA must provide additional layer of security to protect user interface(mainy when PAN is manually entered in the application) and data processing within application. More detailed information can be found in *Wallet SDK API.* Moreover all sensitive data are passed as chars or bytes arrays. Wallet SDK copies the arrays and clears that copies just after processing. MPA should clear provided sensitive data immediately after passing them to Wallet SDK.

Security Checks and Data Clearing

On Wallet SDK side are pe<span class="inline-comment-marker" data-ref="c6e0f391-dfd6-48b3-b5b8-929a7da5ea81">rformed security checks which includes static</span> code analysis protection and dynamic analysis protection. Security checks consists of:

- root access detection,
- hooking protection,
- debugging protection,
- custom ROM protection,
- data tampering protection,
- man in the middle protection.

Security checks are performed periodically, if Wallet SDK detects any of above things all data hold by Wallet SDK will be cleared and security report will be sent to Wallet Server. MPA will be informed about such detection.

Communication with Wallet Server

Communication from genuine applications which are installed on genuine devices is accepted by the Wallet Server. Wallet SDK at the very beginning performs authentication of application and device to Wallet Server. This authentication may takes advantage of Google SafetyNet which is 3-rd party trusted side in whole authentication. Google SafetyNet <span class="inline-comment-marker" data-ref="b3d47876-5075-4e2f-a0f9-700fc4f6f788">verifies</span> device and sign information about device and application. Signed data from SafetyNet are sent to the Wallet Server. Wallet Server verifies data and allow or does not allow for further communication. Application is verified according preconfigured application certificate digest used for signing application.

Important: There is a limit of requests to SafetyNet API: 10 000 per day. If Customer predicts that there will be more installations per day then this limit needs to be increased during Google Project Setup.

Wallet SDK communicates with Wallet Server using TLS 1.2. Wallet SDK performs public key certificate pinning when it tries to establish connection with Wallet Server (similar with connection to MDES). Certificates for the pinning needs to be provided to SDK. Sensitive information are additionally encrypted and/or signed.

**Versioning**

Wallet SDK uses semantic versioning. It means that every release has own version which is MAJOR.MINOR.PATCH, where:

- MAJOR version increases when SDK has incompatible API changes,
- MINOR version increases when new functionality is added in a backwards compatible manner,
- PATCH version increases when new backwards compatible bug fixes are introduced.

MAJOR versions are supported 6 months and Customer needs to migrate to new version if they want to maintain support.

#### Remote Notification Service

Wallet SDK is responsible for remote notification processing. However MPA is responsible for obtaining FCM registration token, handling FCM token update and receiving remote notifications. Before passing remote notification to SDK, MPA needs to verify if given message is dedicated for SDK by checking sender Id. Sender Id is configured during onboarding. Verestro will create new FCM project and provide data needed to obtain FCM token for given project. Due to observing some issues with FCM token refresh notification from FCM service, additional check of new token availability is recommended(eg. on application start). See more in *Wallet SDK API.*

#### Access

Wallet SDK is stored as artifacts in maven repository. Access there is provided during onboarding by Verestro representative.

### Configuration

Whole product has configuration which needs to be fulfilled. This configuration also consists of data which are set in MDES. More details are described in *Wallet Configuration*.

### User Experience for Contactless Transactions

MDES offers a few options for customers for defining user experience for contactless transactions. Final option is the choice of CDCVM type (Mobile PIN, Locally-verified CDCVM) and CVM model (Always, Flexible, Card-like).

#### CDCVM Types

There are two types of Consumer Device Cardholder Verification Method (CDCVM) which are supported by MDES.

#### Mobile PIN CDCVM

A PIN value (4–8 digits) that the cardholder enters on the mobile device and that is validated online by MDES during the transaction authorization process. Since Locally-verified is mostly preferable option, Mobile PIN is out of scope.

#### Locally-verified CDCVM

A CDCVM entered on and validated by the consumer’s mobile device, for example system device PIN, pattern, password or biometric methods (such as fingerprint, iris or facial recognition). Swipe (slide to unlock) is not a valid cardholder verification method and must not be supported. These methods are commonly associated with a device unlock process and are validated on the cardholder’s mobile device. The payment component embedded in the Mobile Payment Application will use the outcome of this authentication process. A Locally-verified CDCVM applies to all the payment tokens of a given Mobile Payment Application instance (“Wallet-level”). In some parts of system this type is also named as Custom.

### CVM Models

For two CDCVM types customer can apply different user experience CVM Models.

#### Always CVM 

In this model the card profiles supplied to the SDK are configured to indicate that the mobile device supports on-device cardholder authentication. When transactions are performed on a POS supporting CDCVM, the POS will delegate cardholder authentication to the mobile device the terminal will not request an Online PIN on the terminal. In POS which does not support CDCVM cardholder authentication is required using Online PIN. This model requires the cardholder’s mobile device to authenticate the cardholder for all transactions (LVT, HVT, Transit). CDCVM can be performed using either a Mobile PIN or a Locally-verified CDCVM. MPA is expected to decline any transaction for which cardholder authentication is not performed or is unsuccessful.

Below are presented sample diagrams which show how the transactions can look like:

*Always LVT, HVT - single tap*

[![image-1654375111845.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654375111845.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654375111845.png)

*Always LVT, HVT - double tap*

[![image-1654375121955.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654375121955.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654375121955.png)

#### Flexible CVM

In this model the card profile also indicates that the mobile device supports on device cardholder authentication Mobile PIN or Locally-verified CDCVM. However rather than applying authentication for every transaction the MPA defines flexible criteria such as allowing multiple transactions between each authentication. This criteria are often names as Lost &amp; Stolen options or velocity checks. For transit transactions cardholder authentication is not expected.

Below are presented sample diagrams wh<span class="inline-comment-marker" data-ref="eed44fff-027b-4731-bc57-1843d477f863">ich show how the transactions can look like:</span>

*Flexible LVT*

[![image-1654375214373.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654375214373.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654375214373.png)

*Flexible HVT - single tap*

[![image-1654375231686.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654375231686.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654375231686.png)

*Flexible HVT, LVT with Velocity counters - double tap*

[![image-1654375238935.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654375238935.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654375238935.png)

#### Card-like CVM

In this model the card profiles supplied to the SDK are configured to indicate that the mobile wallet is not capable of supporting on device cardholder verification. This means that when transactions are performed with a Point of Sale (POS) terminal, the POS will treat the transaction in the same way as a card transaction. Typically this means that low value transactions (LVTs) will be processed without additional user authentication and if supported, high value transactions will require an online PIN to be provided on POS. This model is put here just for general information, however it is not preferred for issuer wallets.

Below are presented sample diagrams which show how the transactions can look like:

*Card like LVT*

[![image-1654375297218.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654375297218.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654375297218.png)

*Card like HVT*

[![image-1654375302023.png](https://developer.verestro.com/uploads/images/gallery/2022-06/scaled-1680-/image-1654375302023.png)](https://developer.verestro.com/uploads/images/gallery/2022-06/image-1654375302023.png)

#####   


#### Lost &amp; Stolen Options

<span class="inline-comment-marker" data-ref="faaf0ff2-cec6-48f7-917f-e7af19ddfb49">The Lost &amp; Stolen options are dedicated to control performing transactions allowed before requiring cardholder authentication. This limits fraud risk if the cardholder’s mobile device is lost or stolen. Lost &amp; stolen options can be applied only for Flexible CDCVM</span>. These options also are known as velocity check counters. Wallet SDK provides interface which is invoked during transaction. Transaction information like range, rich transaction type, amount are provided within this interface. MPA can implement various checks to support velocity check counters using transaction information. MPA for example can count LVT transactions and allow only some predefined number of LVT transactions without cardholder authentication.

#### Transit Transactions

Transit transactions are transactions with given Merchant Category Code performed e.g. on traffic gates like: underground. It is up to Customer if wants to enable such transactions or not (option selected during MDES onboarding). Transit transactions are enabled in every CVM model, however for Always CDCVM needs to be performed for every transaction, for Card-Like and Flexible CDCVM can be skipped.

### Tokenization/Digitization

Tokenization is a process which enable to replace sensitive data, e.g. card number, with another string of characters - a secure payment token - as a result of which card data remains inaccessible. Payment tokens are assigned to a given device of the card owner, which means that an unauthorized person, even if he obtains the token data, will not be able to use them via another device. It is also secured inside the SDK. As a result of the tokenization process, the customer comes into possession of Transaction Credentials in a mobile application on his device.

![](https://developer.verestro.com/uploads/images/gallery/2022-06/embedded-image-ypcbgte3.png)

#### Digitization decisions

- Green - Approve the digitization request without further cardholder interaction,
- Yellow - Approve the digitization request but seek additional cardholder authentication,
- Red - Decline the digitization.

## Main processes

### User and cards registration into wallet server

User with unique identifier known on issuer side is passing with cards to wallet server. After that process, device can be paired with.

### Pairing device for particular user by trusted identity

Authentication of the device in context of given user. Process needed to allow access to wallet server from that particular device.

In the integrated model signed user identifier passed from issuer into wallet server via SDK is used to authenticate given user.

### Digitization of the card

When device is paired user can have access to his own data: cards. After that he can digitize chosen card which was previously added into wallet server.

### Digitized card profile provisioning on the device

After successful digitization, digitized card profile is delivered to device. Since only limited number of keys for transaction is delivered to the device, SDK calls replenish to cover up the number of transaction credentials.

### Transaction credentials replenishment

### Payment

### Payment history(Optional)

It is possible to store transactions on wallet server.

## Main steps and implementation

Issuer integration with MDES.

- Completing BPMS/ICG file - configuration for issuers in MDES, 
    - PAN ranges allowed for digitization,
    - channel for the authorization cards for the digitization: predigitization API/ISO 8583 messages,
    - digitization path,
- Completing PCG file - configuration for token requestors(wallet configuration), 
    - parameters for connection,
    - transactions user experience,
- Exchanging certificates, 
    - connection,
    - external wrapping key,
    - payload encryption to mdes,
    - tav,
- Adopt LC API to pass users and cards into wallet server and manage them later,
- Integrate SDK into issuer application,
- Implement signing user identity to authenticate user on wallet server via SDK.

# Use Cases

<span class="inline-comment-marker" data-ref="1f01a141-77b9-4ab5-b9af-74a2b46a6fc6">This section is dedicated for use cases which can be done by different API and initiated from different sources.  
</span>

### <span class="inline-comment-marker" data-ref="1f01a141-77b9-4ab5-b9af-74a2b46a6fc6">Wallet Server LC API Initiated</span>

This section describes use cases which can be initiated using Wallet Server LC API. <span class="inline-comment-marker" data-ref="e431807d-6f59-4a18-8aa7-4ecdd9f2d09c">This API should be used by</span> Customers to manage Users and cards data on Wallet Server.

#### User with Card Registration

User with Card Registration is process when user and cards are transferred to Wallet Server to make possible use them in different processes (e.g. digitization) later in the application. Registration needs to be done as the first step.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant Issuer  
Issuer -&gt; WS: 1. addUserWithCard(userData, cardData)  
activate Issuer  
activate WS  
WS --&gt; Issuer: 2. response(cardId)  
deactivate WS  
Issuer -&gt; Issuer: 3. storeCardId  
deactivate Issuer  
@enduml

#### Card Reissuing

Since plastic cards have expiration date, Issuers may want to reissue them. In most cases PAN remains the same and only expiration date is extended. It is worth to mention that MDES does not check PAN expiry date for transactions performed with Payment Token. MDES offers API for Issuers where is possibility to update expiration date or even whole PAN for already provisioned Payment Tokens. In context of integration there are a few options:

- Issuer has own processor which is integrated with Customer Service MDES API and there is a possibility to update PAN or expiration date. Then reissuing is done only on processor side. Wallet Server will be notified by MDES about the change.
- Issuer uses Verestro Token Management Platform and reissuing is possible using LC API.
- Issuer uses only Wallet Server which acts as Token Requestor and there is no possibility to update PAN or expiration date for given Payment Token. Issuer needs to delete previous card and add new one. Users need to make digitization again.

All options needs to be considered individually and discussed with Verestro representative.

#### User Deletion

During this process all data related to given User are deleted. Payment Tokens are deleted asynchronously.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant Issuer  
Issuer -&gt; WS: 1. deleteUser(userId)  
activate Issuer  
activate WS  
WS -&gt; WS: 2. delete cards, devices  
WS --&gt; Issuer: 3. response  
deactivate Issuer  
loop All Payment Tokens for given User  
WS -&gt; MDES: 4. delete token  
activate MDES  
MDES --&gt; WS: 5. response  
deactivate WS  
deactivate MDES  
end  
@enduml

#### Card Deletion

During card deletion process all data related to given card are deleted. Payment Tokens are deleted asynchronously.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
Issuer -&gt; WS: 1. deleteCard(cardId)  
activate WS  
activate Issuer  
WS -&gt; WS: 2. deleteCard  
WS --&gt; Issuer: 3. response  
deactivate Issuer  
loop All Payment Tokens for card  
WS -&gt; MDES: 4. Delete token  
activate MDES  
MDES -&gt; MDES: 5. Delete token mapping  
MDES --&gt; WS: 6. response  
deactivate MDES  
WS -&gt; RNS: 7. sendNotification(paymentTokenDelete)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 8. deliverNotification  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 9. checkWalletSenderId  
MPA-&gt; SDK: 10. UCP:CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
alt Request session if required  
SDK -&gt; MDES: 11. request session  
activate MDES  
MDES --&gt; SDK: 12. response  
MDES -&gt; WS: 13. sendRemoteNotificationMessage  
deactivate MDES  
activate WS  
WS -&gt; RNS: 14. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 15. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 16. checkWalletSenderId  
MPA-&gt; SDK: 17. UCP:CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK -&gt; MDES: 18. delete(tokenUniqueReference)  
activate MDES  
MDES --&gt; SDK: 19. response  
deactivate MDES  
SDK -&gt; SDK: 20. Delete transaction credentials, card profile  
SDK -&gt; MPA: 21. onPaymentInstrumentStatusChanged(id, status)  
deactivate SDK  
end  
deactivate MPA  
@enduml

### Wallet SDK Initiated

#### Wallet SDK Setup

Setup of Wallet SDK (both modules UCP SDK and MDC SDK) is main step which needs to be made at very beginning. During setup main configuration should be provided. Moreover there is some configuration which is related with HCE payments: MPA should be registered as default application for payment (Tap &amp; Pay) and also should implement HostApduService to emulate an NFC card inside an Android service component. Please find more details in *Wallet SDK API* document.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
participant MPA  
participant "Wallet SDK" as SDK  
MPA -&gt; SDK: 1. MDC:setup(configuration)  
activate MPA  
activate SDK  
SDK --&gt; MPA: 2. result  
MPA -&gt; SDK: 3. UCP:setup(configuration)  
SDK --&gt; MPA: 4. result  
deactivate MPA  
deactivate SDK  
@enduml

#### Pair Device on Wallet Server

This section describes pairing device process. Device pairing is process which authenticates device in context of given user. During this process device data and keys used in communication are exchanged with Wallet Server. To make possible device pairing, user needs to be already registered on the Wallet Server. Every device is identified by unique identifier. After every pairing device request, Wallet Server gives unique installation identifier. It means that particular installation of the application installed on particular device belongs to given User. Different Users can use same device for separate installations. If any active installation on given device already exists during pairing device, Wallet Server will delete and create new installation in context of new user. Only one active installation is possible on particular device. Device pairing is the first process which should be done after user registration. Pairing device should be done only once for individual installation.

<div class="wiki-content" id="bkmrk--3"></div><div id="bkmrk--4"><div class="no-print" id="bkmrk--58"></div></div>##### Pair Device By Trusted Identity

In the integrated model, Trusted Identity is used to proof User authenticity. User is firstly authenticated on the Customer side. Trusted Identity should be generated on Issuer backend side and pass via Wallet SDK, since mobile environment is treated as unsecure. Algorithm of generating Trusted Identity is placed in Wallet SDK API specification.

Access to User data stored on Wallet Server is possible only when session is established. After paring device session is automatically generated for particular User.

If previously on given device was installation which had Payment Tokens, during pairing these Payment Tokens are deleted asynchronously.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Issuer" as Issuer  
participant "MDES" as MDES  
MPA-&gt;Issuer: 1. authenticate  
activate MPA  
activate Issuer  
Issuer-&gt;Issuer: 2. generateTrustedIdentity - signed user id  
Issuer--&gt; MPA: 3. response(trustedIdentity)  
deactivate Issuer  
MPA -&gt; MPA: 4. obtainFcmToken(walletFirebase)  
MPA-&gt; SDK: 5. MDC:pairDeviceByTrustedIdentity\\r(trustedIdentity, fcmRegistrationToken)  
activate SDK  
SDK -&gt; SDK: 6. isDevicePaired  
alt isDevicePaired=true  
SDK --&gt; MPA: 7. result  
else isDevicePaired=false  
SDK-&gt; WS: 8. pairDeviceByTrustedIdentity\\r(trustedIdentity, fcmRegistrationToken, deviceInfo)  
activate WS  
WS-&gt; WS: 9. verify trusted identity  
alt isActiveInstallationOnGivenDevice  
WS -&gt; WS: 10. deleteActiveInstallation  
WS -&gt; MDES: 11. deleteDeviceTokens  
activate MDES  
deactivate MDES  
note left: asynchronous  
end  
WS -&gt; WS: 12. createNewDeviceInstallationRecordForUser  
WS --&gt; SDK: 13. response\\r (userSessionToken, installationId)  
deactivate WS  
SDK -&gt; SDK: 14. store userSessionToken  
SDK--&gt;MPA: 15. result  
deactivate MPA  
deactivate SDK  
end  
@enduml

#### Card Digitization

Card digitization is process which allows to transform plastic card into <span class="inline-comment-marker" data-ref="46eb6b92-02a7-4b31-bc4b-4b13f9cdbcf8">Payment Token</span>. To perform digitization, card data should be placed already on Wallet Server and device should be already paired. Card digitization process uses Wallet Server identifier of the card. There are two ways of performing card digitization. Usage of the API's depends on needs in given implementation.

<div class="wiki-content" id="bkmrk--6"></div><div id="bkmrk--7"><div class="no-print" id="bkmrk--59"></div></div>##### Card Digitization Ways

Depending on implementation card can be digitized in different way using different approach. There are following ways of card digitization:

- one step - which is the simplest way of card digitization and should be used in project implementation where card can be just digitized without any additional staff like additional User authentication or showing T&amp;C or showing card art from MDES,
- multi step - which should be used when digitization will require additional User authentication, showing T&amp;C or showing card art from MDES.

##### Card Digitization Ways - One Step

One step digitization is dedicated for implementations where there is no additional User authentication and <span class="inline-comment-marker" data-ref="3576f8a9-b10e-4e3d-905f-5cd80ceaebc4">there is no need to show terms and conditions before every digitization or show card art from MDES</span>. Mostly it should be used in Issuer applications where NFC payments is added as a new functionality without additional staff which is used in dedicated wallets. Only transaction outcomes APPROVED(see APPROVED) or DECLINE(see DECLINE) are expected in this type of digitization.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant "MPA" as MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES as MDES  
MPA -&gt; SDK: 1. UCP:Cards#digitize\\r(paymentInstrumentId=verestroCardId, userLanguageCode, securityCode?)  
activate MPA  
activate SDK  
SDK -&gt; SDK: 2. isDeviceRegisteredForPayment  
alt isDeviceRegisteredForPayment=false  
SDK -&gt; WS: 3. getPkCertificate  
activate WS  
WS -&gt; MDES: 4. getPkCertificate  
activate MDES  
MDES --&gt; WS: 5. response(pkCertificate)  
WS --&gt; SDK: 6. response(pkCertificate)  
SDK -&gt; SDK: 7. prepareDataForRegistration(pkCertificate)  
SDK -&gt; WS: 8. registerDeviceForPayment\\r (paymentDeviceInfo, userSessionToken)  
WS -&gt; MDES: 9. registerMobilePaymentApplication\\r (paymentDeviceInfo)  
MDES --&gt; WS: 10. response(mobileKeys,\\r remoteManagementUrl)  
WS --&gt; SDK: 11. response(mobileKeys,\\r remoteManagementUrl)  
end  
SDK -&gt; SDK: 12. isPaymentInstrumentDigitized  
alt isPaymentInstrumentDigitized=true  
SDK --&gt; MPA: 13. result  
else isPaymentInstrumentDigitized=false  
SDK -&gt; WS: 14. digitizeCard\\r (cardId, userSessionToken)  
WS -&gt; MDES: 15. checkEligibility(cardData, paymentAppId,\\r paymentAppInstanceId)  
MDES --&gt; WS: 16. response (eligibilityReceipt)  
WS -&gt; MDES: 17. digitize(eligibilityReceipt)  
MDES --&gt; WS: 18. response  
deactivate MDES  
WS --&gt; SDK: 19. response(paymentTokenInfo)  
deactivate WS  
SDK --&gt; MPA: 20. result  
deactivate SDK  
deactivate MPA  
end  
deactivate SDK  
deactivate MPA  
note over SDK, WS #1C1E3F: See Card digitization outcome Approved or Decline diagram  
@enduml

##### Card Digitization Ways - Multi step

Multi step digitization should be used in implementations where terms and <span class="inline-comment-marker" data-ref="cc8ef17e-fba8-4e96-8e39-04999b5fc855">conditions</span> are displayed before every digitization, additional user authentication is needed or card art need to be used from MDES. Multi step digitization consists of following steps:

- checking card eligibility
- showing T&amp;C
- digitizing card

Digitization may finished with different outcomes(see Card Digitization Outcomes).

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES  
MPA -&gt; SDK: 1. UCP:Cards#checkEligibility(paymentInstrumentId=verestroCardId, locale)  
activate MPA  
activate SDK  
SDK -&gt; SDK: 2. isDeviceRegisteredForPayment  
alt isDeviceRegisteredForPayment=false  
SDK -&gt; WS: 3. getPkCertificate  
activate WS  
WS -&gt; MDES: 4. getPkCertificate  
activate MDES  
MDES --&gt; WS: 5. response(pkCertificate)  
WS --&gt; SDK: 6. response(pkCertificate)  
SDK -&gt; SDK: 7. prepareDataForRegistration(pkCertificate)  
SDK -&gt; WS: 8. registerDeviceForPayment\\r (paymentDeviceInfo, userSessionToken)  
WS -&gt; MDES: 9. registerMobilePaymentApplication\\r (paymentDeviceInfo)  
MDES --&gt; WS: 10. response(mobileKeys,\\r remoteManagementUrl)  
WS --&gt; SDK: 11. response(mobileKeys,\\r remoteManagementUrl)  
end  
SDK -&gt; WS: 12. checkEligibility(paymentInstrumentId,userSessionToken)  
WS -&gt; MDES: 13. checkEligibility(card)  
MDES --&gt;WS: 14. response(termsAndConditionsAssetId, eligibilityReceipt)  
WS --&gt; SDK: 15. response(termsAndConditionsAssetId, digitizationRef)  
SDK --&gt; MPA: 16. result(termsAndConditionsAssetId)  
MPA -&gt; SDK: 17. UCP:getAsset(termsAndConditionsAssetId)  
SDK -&gt; WS: 18. getAsset(termsAndConditionsAssetId)  
WS -&gt; MDES: 19. getAsset(termsAndConditionsAssetId)  
MDES --&gt; WS: 20. response(content)  
deactivate MDES  
WS --&gt; SDK: 21. response(content)  
deactivate WS  
SDK --&gt; MPA: 22. result  
deactivate SDK  
MPA -&gt; User: 23. show T&amp;C  
deactivate MPA  
User -&gt; MPA: 24. accept  
activate MPA  
MPA -&gt; SDK: 25. UCP:Cards#digitize(paymentInstrumentId, cvc?)  
activate SDK  
SDK -&gt; WS: 26. digitize(digitizationRef, cvc?, userSessionToken)  
activate WS  
WS -&gt;MDES: 27. digitize(eligibilityReceipt, cvc?)  
activate MDES  
MDES --&gt; WS: 28. response(additionalAuthenticationRequired, authenticationMethods?, tokenInfo, productConfig)  
deactivate MDES  
WS --&gt; SDK: 29. response(additionalAuthenticationRequired, authenticationMethods?, tokenInfo, productConfig)  
deactivate WS  
SDK --&gt; MPA: 30. result  
deactivate SDK  
MPA -&gt; User: 31. please wait  
deactivate MPA  
note over SDK, WS #1C1E3F: See Card digitization outcome Approved or Decline or Require Additional Authentication diagram  
@enduml

##### Card Digitazation Outcomes

There are following digitization outcomes which should be handled differently:

- APPROVED
- DECLINED
- REQUIRE\_ADDITIONAL\_AUTHENTICATION

##### APPROVED

This digitization outcome always refers to green path digitization decision. When digitization is APPROVED then profile provisioning(See Profile Provisioning) starts automatically. According to MDES architecture just after digitization Payment Token is in INACTIVE state even though does not require additional User authentication. Due that fact new flag was introduced which informs which Payment Token exactly needs to be additionally authenticated. After successful provisioning token is activated and then SDK will perform Transaction Credentials - Initial Replenishment.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES as MDES  
group APPROVED  
MDES --&gt; WS : 1. responseFromDigitization(APPROVED, cardDigitizationData)  
activate MDES  
activate WS  
WS --&gt; SDK : 2. response(digitizatonData, paymentToken)  
deactivate WS  
activate SDK  
SDK --&gt; MPA : 3. result  
activate MPA  
MPA --&gt; User : 4. result  
deactivate MPA  
... Profile Provisioning ...  
note over MPA, MDES #1C1E3F: See Profile Provisioning diagram  
... MDES Token Activation ...  
SDK -&gt; MDES: 5. notifyProvisioningResult  
MDES -&gt; MDES: 6. createTokenMapping  
MDES -&gt; WS: 7. notifyTokenUpdated(Active)  
deactivate MDES  
activate WS  
WS -&gt; RNS: 8. sendNotification(paymentTokenActive)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 9. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 10.checkWalletSenderId  
MPA-&gt; SDK: 11. UCP:CloudMessage#process(pushData)  
SDK -&gt; SDK: 12. updateTokenStatus  
SDK -&gt; MPA: 13. onPaymentInstrumentStatusChanged(id, status)  
deactivate MPA  
deactivate SDK  
... Initial Replenishment ...  
note over SDK, MDES #1C1E3F: Just after token activation transaction credentials initial replenishment is performed by SDK\\r. See Transaction Credentials Initial Replenishment diagram  
end  
@enduml

##### DECLINE

This digitization outcome refers to red digitization decision.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES as MDES  
group APPROVED  
MDES --&gt; WS : 1. responseFromDigitization(DECLINED)  
activate MDES  
deactivate MDES  
activate WS  
WS --&gt; SDK : 2. response(error)  
deactivate WS  
activate SDK  
SDK --&gt; MPA : 3. result  
deactivate SDK  
activate MPA  
MPA --&gt; User : 4 result  
deactivate MPA  
@enduml

##### REQUIRE\_ADDITIONAL\_AUTHENTICATION

This digitization outcome always refers to yellow path digitization decision. When digitization is REQUIRE\_ADDITIONAL\_AUTHENTICATION then profile provisioning(See Profile Provisioning) starts automatically but remain INACTIVE until the User is authenticated(see Card Digitization Activation). Flag

*additionalAuthenticationRequired* informs if additional user authentication is needed or not.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES as MDES  
group REQUIRE\_ADDITIONAL\_AUTHENTICATION  
MDES --&gt; WS : 1. responseFromDigitization(response(additionalAuthenticationRequired=true, authenticationMethods?, tokenInfo, productConfig))  
activate MDES  
deactivate MDES  
activate WS  
WS --&gt; SDK : 2. response(response(additionalAuthenticationRequired=true, authenticationMethods?, tokenInfo, productConfig))  
deactivate WS  
activate SDK  
SDK --&gt; MPA : 3. result  
deactivate SDK  
activate MPA  
MPA --&gt; User : 4. result  
deactivate MPA  
... Profile Provisioning ...  
note over MPA, MDES #1C1E3F: See Profile Provisioning diagram  
... Card Digitization Activation ...  
note over MPA, MDES #1C1E3F: See Card Digitization Activation diagram  
end  
@enduml

##### Card Digitization Activation

This process is applicable only if digitization has infomation that additional authentication is required. During this process User can choose one of the additional authentication methods. If user-entered authentication code is chosen then MDES will send authentication code which later should be provided by User for submission. Once user enters correct authentication code Payment Token is activated by MDES asynchronously. After activation Wallet Server is notified that Payment Token is activated and this information is passed to Wallet SDK. After Payment Token activation, Wallet SDK start Transaction Credentials - Initial Replenishment.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES as MDES  
alt Just after digitization  
MDES --&gt; WS : 1. responseFromDigitization(additionalAuthenticationRequired=true, \\rauthenticationMethods?, tokenInfo,productConfig)  
activate MDES  
activate WS  
WS --&gt; SDK : 2. response(additionalAuthenticationRequired=true, \\rauthenticationMethods?, tokenInfo, productConfig)  
activate SDK  
SDK --&gt; MPA: 3. result(authenticationMethods)  
activate MPA  
else Activation not finished after digitization  
User -&gt; MPA: 4. activate token  
MPA -&gt; SDK: 5. UCP::getAdditionalAuthenticationMethods(paymentInstrumentId)  
SDK -&gt; WS: 6. getAuthenticationMethods(cardId, userSessionToken)  
WS --&gt; SDK: 7. response(authenticationMethods)  
SDK --&gt; MPA: 8. result(authenticationMethods)  
end  
MPA --&gt; User: 9. show authentication methods  
User -&gt; MPA: 10. select authentication method  
MPA -&gt; SDK: 11. UCP::submitTokenAuthenticationMethod(authenticationMethod)  
deactivate MPA  
SDK -&gt; WS: 12. submitTokenAuthenticationMethod(authenticationMethod, userSessionToken)  
deactivate SDK  
WS -&gt; MDES: 13. submitAuthenticationMethod(authenticationMethod)  
deactivate WS  
MDES -&gt; Issuer: 14. deliverAuthCode(authCode)  
deactivate MDES  
activate Issuer  
Issuer -&gt; User: 15. deliver authCode  
deactivate Issuer  
User -&gt; MPA: 16. enter authCode  
activate MPA  
MPA -&gt; SDK: 17. UCP::submitTokenAuthenticationValue(authCode)  
activate SDK  
SDK -&gt; WS: 18. submitTokenAuthenticationValue(authCode, userSessionToken)  
activate WS  
WS -&gt; WS: 19. checkProvisioningStatus  
WS -&gt; MDES: 20. submitAuthenticationValue(authCode)  
activate MDES  
MDES -&gt; MDES: 21. verify authCode  
MDES --&gt; WS: 22. response  
WS --&gt; SDK: 23. response  
deactivate WS  
SDK --&gt; MPA: 24. response  
deactivate SDK  
deactivate MPA  
MDES -&gt; MDES: 25. createTokenMapping  
MDES -&gt; WS: 26. notifyTokenUpdated(Active)  
deactivate MDES  
activate WS  
WS -&gt; RNS: 27. sendNotification(paymentTokenActive)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 28. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 29. checkWalletSenderId  
MPA-&gt; SDK: 30. UCP::CloudMessage#process(pushData)  
SDK -&gt; SDK: 31. updateTokenStatus  
SDK -&gt; MPA: 32. onPaymentInstrumentStatusChanged(id, status)  
deactivate MPA  
deactivate SDK  
... Initial Replenishment ...  
note over SDK, MDES #1C1E3F: Just after token activation transaction credentials initial replenishment is performed by SDK\\r. See Transaction Credentials Initial Replenishment diagram  
@enduml

#### Update FCM Token

Wallet Server is responsible for sending push notifications to the Wallet SDK. For that reason fcm token is passed to Wallet Server during pairing device. However this token can be <span class="inline-comment-marker" data-ref="7c0abc8d-e6eb-4ccd-bd51-3df8c31751fa">updated</span>. MPA will be notified when token is being updated and then needs to obtain new fcm token and update via Wallet SDK on Wallet Server. Retrieving push notifications and fcm tokens is responsibility of the MPA.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
activate RNS  
RNS -&gt; MPA: 1. onTokenRefresh  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 2. obtainNewToken(walletFirebase)  
MPA -&gt; SDK: 3. MDC::updateFcmRegistrationToken(newFcmToken)  
activate SDK  
SDK -&gt; WS: 4. updateFcmToken(deviceInstallationId, newFcmToken)  
activate WS  
WS -&gt; WS: 5. updateFcmToken  
WS --&gt; SDK: 6. response  
deactivate WS  
SDK --&gt; MPA: 7. result  
deactivate SDK  
deactivate MPA  
deactivate RNS  
@enduml

#### Profile Provisioning

During this process digitized card profile is delivered to the device. This process is triggered automatically after successful digitization where outcome is APPROVED or REQUIRE\_ADDITIONAL\_AUTHENTICATION. It is not possible to retry provisioning itself. To retry provisioning, previous token needs to be deleted and new digitization called hence when SDK reports that provisioning has failed then given token is automatically deleted and User can perform digitization once again. During process there is few point of failures and provisioning can be not finished at all. In this scenario Payment Tokens which are not provisioned for long period of time are delete by Wallet Server (see Removing Not Provisioned Tokens). From User perspective it can be good approach to treat digitization and provisioning as one process and inform User about steps(if User has to wait long time without any information then can treat this as some failure). From MPA perspective can be also good approach to wait for provisioning status as long as User stays on view dedicated to it. If User wants to cancel the process because provisioning status is not available for long period of time it is recommended to delete Payment Token(see Delete Payment Token via SDK) once User click cancel or back. Thanks to deletion, new digitization can be called and User does not have to wait until Payment Token is deleted by Wallet Server due to lack of provisioning.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES as MDES  
MDES-&gt;WS: 1. sendRemoteNotificationMessage(mdesRemoteMessage)  
activate MDES  
deactivate MDES  
activate WS  
WS-&gt; RNS: 2. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS-&gt; MPA: 3. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 4. checkWalletSenderId  
MPA-&gt; SDK: 5. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
SDK-&gt; MDES: 6. provision  
activate MDES  
MDES --&gt; SDK: 7. response(cardProfile)  
SDK-&gt; MDES: 8. notify provisioning result  
MDES --&gt; SDK: 9. response  
deactivate MDES  
SDK -&gt; SDK: 10. store card profile  
SDK -&gt; WS: 11. confirmProvisioningStatus(SUCCESS/FAILURE)  
activate WS  
alt FAILURE  
WS -&gt; MDES: 12. deleteToken  
activate MDES  
MDES --&gt; WS: 13. response  
deactivate MDES  
WS --&gt; SDK: 14. response  
SDK -&gt; SDK: 15. deleteToken  
SDK -&gt; MPA: 16. onProvisioningFailure  
activate MPA  
MPA -&gt; User: 17. please try again  
deactivate MPA  
else SUCCESS  
WS --&gt; SDK: 18. response  
deactivate WS  
SDK -&gt; MPA: 19. onProvisioningSuccess(paymentInstrument)  
deactivate SDK  
activate MPA  
MPA -&gt; User: 20. card digitized successfully  
deactivate MPA  
end  
@enduml

#### Getting Asset

Every field which's name consists of *assetId* is an identifier to some static asset. This asset can be:

- Card art
- Mastercard brand logos
- Issuers's logos
- Terms and Conditions

There are different types of assets and multiple formats may be supported. For example a single image may be supported in various file formats or variant sizes and most appropriate format to use for a particular device.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "MDES" as MDES  
MPA -&gt; SDK: 1. UCP::getAsset(assetId)  
activate SDK  
SDK -&gt; WS: 2. getAsset(assetId)  
activate WS  
WS -&gt; MDES: 3. getAsset(assetId)  
activate MDES  
MDES --&gt; WS: 4. response(content)  
deactivate MDES  
WS --&gt; SDK: 5. response(content)  
deactivate WS  
SDK --&gt; MPA: 6. result(content)  
deactivate SDK  
@enduml

#### Transaction Credentials Replenishment

Transaction Credentials are unique per transactions keys that are used to calculate cryptograms in transactions. Each set of credentials is linked with a unique Application Transaction Counter (ATC). Each set of credentials can only be used for one transaction. There is a limit (set on MDES onboarding) of transaction credentials stored on device.

<div class="wiki-content" id="bkmrk--17"></div><div id="bkmrk--18"><div class="no-print" id="bkmrk--60"></div></div>##### Transaction Credentials - Automatic Replenishment

After every transaction Wallet SDK checks if number of transaction credentials is below, <span class="inline-comment-marker" data-ref="2bbc5830-4941-47f2-bd97-a3a35569a276">preconfigured during SDK setup, threshold</span>. If yes then SDK will call replenish. During replenish process transaction credentials are being delivered to mobile <span class="inline-comment-marker" data-ref="b8671fd3-4188-4ecc-9fbb-0403986e0acc">application.</span>

<span class="inline-comment-marker" data-ref="b8671fd3-4188-4ecc-9fbb-0403986e0acc">@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES as MDES  
SDK-&gt;SDK: 1. detectTransactionCredentialsRemainingBelowThreshold  
alt Request session if required  
activate SDK  
SDK-&gt; MDES: 2. requestSession  
activate MDES  
MDES--&gt; SDK: 3. response  
MDES-&gt; WS: 4. sendRemoteNotificationMessage(mdesRemoteMessage)  
deactivate MDES  
activate WS  
WS -&gt; RNS: 5. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS-&gt; MPA: 6. deliver push  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 7. checkWalletSenderId  
MPA-&gt; SDK: 8. UCP::CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK-&gt; MDES: 9. replenish  
activate MDES  
MDES-&gt; MDES: 10. checkIfPaymentTokenIsActive  
MDES--&gt;SDK: 11. response(transactionCredentials)  
deactivate MDES  
SDK-&gt;MPA: 12. onReplenishSuccess(paymentInstrument)  
deactivate SDK  
@enduml</span>

##### Transaction Credentials - Initial Replenishment

Initial replenishment is process which starts directly after successful token activation. Wallet SDK is notified by Wallet Server using push notification or refreshing payment instruments. <span class="inline-comment-marker" data-ref="63c21bed-4be0-4176-9511-0039ab9652fe">No action is needed by MP</span>A.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES as MDES  
WS -&gt; SDK: 1. notifyTokenUpdated(Active)  
activate WS  
deactivate WS  
activate SDK  
alt Request session if required  
SDK-&gt; MDES: 2. requestSession  
activate MDES  
MDES--&gt; SDK: 3. response  
MDES-&gt; WS: 4. sendRemoteNotificationMessage(mdesRemoteMessage)  
deactivate MDES  
activate WS  
WS-&gt; RNS: 5. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS-&gt; MPA: 6. deliver push  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 7. checkWalletSenderId  
MPA-&gt; SDK: 8. UCP::CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK-&gt; MDES: 9. replenish  
activate MDES  
MDES-&gt; MDES: 10. checkIfPaymentTokenIsActive  
MDES--&gt;SDK: 11. response(transactionCredentials)  
deactivate MDES  
SDK -&gt; MPA: 12. onReplenishSuccess(paymentInstrument)  
deactivate SDK  
@enduml

##### Transaction Credentials - Manual Replenishment

There are scenarios when automatic replenish is not possible <span class="inline-comment-marker" data-ref="59014813-e32f-41fd-bb97-2860cfca193d">(user is not able to connect with Internet)</span> and after some number of transactions, transaction credentials number will decrease to 0. In such case MPA should handle NO\_TRANSACTION\_CREDENTIALS error from transaction listener, show user proper alert and call replenish method manually. MPA can also check number of transaction credentials at any other time.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES as MDES  
MPA -&gt; SDK: 1. UCP::replenishCredentials(paymentInstrumentId)  
activate MPA  
deactivate MPA  
activate SDK  
alt Request session if required  
SDK-&gt; MDES: 2. requestSession  
activate MDES  
MDES--&gt; SDK: 3. response  
MDES-&gt; WS: 4. sendRemoteNotificationMessage  
deactivate MDES  
activate WS  
WS-&gt; RNS: 5. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS-&gt; MPA: 6. deliver push  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 7. checkWalletSenderId  
MPA-&gt; SDK: 8. UCP::CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK-&gt; MDES: 9. replenish  
activate MDES  
MDES-&gt; MDES: 10. checkIfPaymentTokenIsActive  
MDES--&gt;SDK: 11. response(transactionCredentials)  
deactivate MDES  
SDK -&gt; MPA: 12. onReplenishSuccess(paymentInstrument)  
deactivate SDK  
@enduml

#### Transacting

Wallet SDK provides functionalities to make contactless payments (using HCE) and e-commerce payments.

<div class="wiki-content" id="bkmrk--22"></div><div id="bkmrk--23"><div class="no-print" id="bkmrk--61"></div></div>##### Contactless Transaction

<span class="inline-comment-marker" data-ref="b7d3ee33-9998-413f-8a70-ebd438c7a880">Contactless transaction uses Android HCE. On MPA side HostApduService should be implemented. Depending on chosen</span> CDCVM and on how transaction is started, user experience is different and MPA should interact with Wallet SDK in different way. The final decision about transaction processing belongs to MPA. Wallet SDK provides transaction information and based on that and User authentication, MPA can advise to proceed, decline or require authentication(if User should be authenticated but was not). After setting authentication in the SDK U<span class="inline-comment-marker" data-ref="e5a23997-5736-4d66-aeb9-bf6ccb0eabf7">ser has specified time</span> (configured in digitized card profile) to make payment. If User will not proceed with payment then needs to perform transaction from the beginning. For contactless transaction Wallet SDK provides result of transaction. This result is only from the communication between <span class="inline-comment-marker" data-ref="fae99527-edc8-46b7-bebb-f80dd3ed609f">MPA</span> and Terminal. Transaction Processing with <span class="inline-comment-marker" data-ref="f5f5c410-628a-4113-bf98-2dbc95aeed51">Payment Network</span> is done separately (see Transaction Processing). Also after every contactless transaction, Transaction Credentials Replenishment is performed automatically by SDK if needed(see Transaction Credentials - Automatic Replenishment).

##### CL Default Payment Instrument

n this scenario User does not select Payment Instrument for payment and default is used. The final decision(PROCEED, DECLINE, AUTHENTICATION\_REQUIRED) for given transaction is taken on MPA side based on transaction information and User authentication. Because of that reason there could be different scenarios which may occur and transaction experience will be single or double tap.

Sample scenarios:

- User can be already authenticated and if MPA will not decline transaction then will be processed as single tap,
- velocity check counters can be applied and even if User was not authenticated MPA can decide to proceed transaction without authentication, taking decision based on transaction information,
- User was not authenticated but MPA recognised transaction as authentication needed. MPA returns AUTHENTICATION\_REQUIRED decision and and SDK informs MPA that authentication is needed.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "HostApduService" as HAS  
participant "Wallet SDK" as SDK  
participant Terminal as TER  
User -&gt; MPA: 1. pay  
MPA -&gt; MPA: 2. checkIsUserAuthenticated  
alt isAuthenticated=true  
MPA -&gt; SDK: 3. UCP::Pay#setUserAuthenticatedForPayment(paymentInstrumentId, pin?)  
end  
User -&gt; TER : 4. contactless 1st tap  
activate TER  
loop  
TER -&gt; HAS: 5. processCommandApdu(commandApdu, extras)  
activate HAS  
HAS -&gt; SDK: 6. UCP::Pay#processHceApduCommand(apdu, extras)  
activate SDK  
SDK -&gt; SDK: 7. useDefaultPaymentInstrumentForContactless  
group Generate AC command  
SDK -&gt; MPA: 8. getFinalDecisionForTransaction(isUserAuthenticated,recommendedAdvice, trxInfo)  
activate MPA  
MPA -&gt; MPA: 9. checkTrxAndAuthentication  
MPA --&gt; SDK: 10. result(advice)  
deactivate MPA  
end  
SDK --&gt; HAS: 11. responseApdu  
HAS --&gt; TER: 12. responseApdu  
deactivate HAS  
end  
alt advice=AUTHENTICATION\_REQUIRED  
SDK -&gt; MPA: 13. onAuthRequiredForContactless(paymentInstrument, trxInfo)  
activate MPA  
MPA -&gt; User: 14. show authentication view with trx info  
User -&gt; MPA: 15. authenticate  
MPA -&gt; SDK: 16. UCP::Pay#setUserAuthenticatedForPayment(paymentInstrumentId, pin?)  
MPA -&gt; User: 17. show transaction timer\\r (instruct user to tap to terminal)  
loop Optionally notify user how many seconds left to proceed with given authentication. This can be ommitted  
SDK -&gt; MPA: 18. onAuthTimerUpdated(secondsRemaining)  
MPA -&gt; User: 19. update  
end  
User -&gt; TER: 20. contactless 2nd tap  
loop  
TER -&gt; HAS: 21. processCommandApdu(commandApdu, extras)  
activate HAS  
HAS -&gt; SDK: 22. UCP::Pay#processHceApduCommand(apdu, extras)  
group Generate AC command  
SDK -&gt; MPA: 23. getFinalDecisionForTransaction(isUserAuthenticated=true,recommendedAdvice, trxInfo)  
MPA -&gt; MPA: 24. checkTrxAndAuthentication  
MPA --&gt; SDK: 25. result(PROCEED)  
end  
SDK --&gt; HAS: 26. responseApdu  
HAS --&gt; TER: 27. responseApdu  
deactivate HAS  
deactivate TER  
end  
end  
SDK -&gt; MPA: 28. onContactlessPaymentCompleted(paymentInstrument, trxInfo, trxResult)  
deactivate SDK  
MPA -&gt; User: 29. show trx info view  
deactivate MPA  
...Transaction Processing ...  
note over HAS #1C1E3F: See Transaction Processing diagram  
...Transaction Credentials Automatic Replenishment ...  
note over HAS #1C1E3F: See Transaction Credentials Automatic Replenishment diagram  
@enduml

##### CL Select Payment Instrument

In this case User can select already digitized Payment Instrument and use it for payment. User authentication is performed before transaction and MPA can allow for the transaction or decline given transaction.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "MPAHostApduService" as HAS  
participant "Wallet SDK" as SDK  
participant Terminal as TER  
MPA -&gt; User: 1. show payment instruments list  
activate MPA  
User -&gt; MPA: 2. select payment instrument  
MPA -&gt; SDK: 3. UCP::Pay#selectForPayment(paymentInstrumentId)  
activate SDK  
User &lt;-- MPA : 4. show authentication screen  
User -&gt; MPA : 5. authenticate  
MPA -&gt; SDK: 6. UCP::Pay#setUserAuthenticatedForPayment(paymentInstrumentId, pin?)  
MPA -&gt; User: 7. show transaction timer\\r (instruct user to tap to terminal)  
loop Notify user how many seconds left to proceed with given authentication  
SDK -&gt; MPA: 8. onAuthTimerUpdated(secondsRemaining)  
MPA -&gt; User: 9. update  
end  
User -&gt; TER : 10. Contactless tap  
activate TER  
loop  
TER -&gt; HAS: 11. processCommandApdu(commandApdu, extras)  
activate HAS  
HAS -&gt; SDK: 12. processHceApduCommand(apdu, extras)  
group Generate AC command  
SDK -&gt; MPA: 13. getFinalDecisionForTransaction(isUserAuthenticated,recommendedAdvice, trxInfo)  
MPA -&gt; MPA: 14. checkTrxAndAuthentication  
MPA --&gt; SDK: 15. result(PROCEED)  
end  
SDK --&gt; HAS: 16. responseApdu  
HAS --&gt; TER: 17. responseApdu  
deactivate HAS  
deactivate TER  
end  
SDK -&gt; MPA: 18. onContactlessPaymentCompleted(paymentInstrument, trxInfo, trxResult)  
deactivate SDK  
MPA -&gt; User: 19. show trx info view  
deactivate MPA  
...Transaction Processing ...  
note over HAS #1C1E3F: See Transaction Processing diagram  
...Transaction Credentials Automatic Replenishment ...  
note over HAS #1C1E3F: See Transaction Credentials Automatic Replenishment diagram  
@enduml

##### E-commerce transaction

E-commerce transaction can be processed using DSRP. Every DSRP transaction has to be authenticated. Depending on implementation e-commerce payment can be preceded with one time password authentication or just device level authentication.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
box "Consumer mobile android device" #white  
participant "Merchant App" as MerchantApp  
participant MPA  
participant "Wallet SDK" as SDK  
end box  
participant Merchant  
participant "Wallet Server" as WS  
participant MDES  
participant Issuer  
participant "Payment Gateway" as PG  
User -&gt; MerchantApp: 1. pay  
activate MerchantApp  
MerchantApp -&gt; Merchant: 2. startTransaction  
activate Merchant  
Merchant --&gt; MerchantApp: 3. response(transactionId,\\r unpredictableNumber)  
deactivate Merchant  
MerchantApp -&gt; MPA: 4. getDsrpData(transactionId, trxInfo)  
deactivate MerchantApp  
activate MPA  
alt One Time Password  
MPA -&gt; User: 5. select payment instrument  
User -&gt; MPA: 6. payment instrument  
MPA -&gt; SDK: 7. UCP::requestAuthCodeForPayment(transactionId \\ras authenticationRequestId)  
activate SDK  
SDK -&gt; WS: 8. requestAuthenticationCodeForPayment(authenticationRequestId)  
activate WS  
WS -&gt; MDES: 9. requestAuthenticationCodeForPayment(authenticationRequestId)  
activate MDES  
MDES -&gt; Issuer: 10. sendAuthenticationCode  
activate Issuer  
Issuer --&gt; MDES: 11. response  
MDES --&gt; WS: 12. response  
deactivate MDES  
WS --&gt; SDK: 13. response  
deactivate WS  
SDK --&gt; MPA: 14. result  
deactivate MPA  
deactivate SDK  
Issuer -&gt; User: 15. sendAuthenticationCode(authenticationCode)  
deactivate Issuer  
User -&gt; MPA: 16. provide authentication code  
activate MPA  
MPA -&gt; SDK: 17. UCP::validateAuthenticationCodeForPayment(authenticationCode,\\r transactionId)  
activate SDK  
SDK -&gt; WS: 18. validateAuthenticationCodeForPayment(authenticationCode,\\r authenticationRequestId)  
activate WS  
WS -&gt; MDES: 19. authenticate(authenticationCode,\\r authenticationRequestId)  
activate MDES  
MDES --&gt; WS: 20. response  
deactivate MDES  
WS -&gt; WS: 21. createDigitalSignature(authenticationRequestId)  
WS --&gt; SDK: 22. response(digitlSignature)  
deactivate WS  
SDK --&gt; MPA: 23. result(digitalSignature)  
else Device Level Auth  
MPA -&gt; User: 24. show authentication view  
User -&gt; MPA: 25. authenticate  
end  
MPA -&gt; SDK: 26. UCP::setUserAuthenticatedForPayment(id, pin?)  
MPA -&gt; SDK: 27. UCP::processDsrpTransaction(id, trxInfo)  
SDK --&gt; MPA: 28. result(dsrpData)  
deactivate SDK  
MPA --&gt; MerchantApp: 29. result(dsrpData)  
deactivate MPA  
activate MerchantApp  
MerchantApp -&gt; MerchantApp: 30. encryptPaymentDataForTransit(dsrpData)  
MerchantApp -&gt; Merchant: 31. finishTransaction(encryptedPaymentData, \\rdigitalSignature?, transactionId)  
activate Merchant  
opt  
Merchant -&gt; Merchant: 32. validateSignature  
note right: this check is needed to proof that given transactionId\\n\\r was preceded with OTP  
end  
Merchant -&gt; PG: 33. processPayment(pan, exp, cryptogram)  
activate PG  
PG --&gt; Merchant: 34. response  
deactivate PG  
Merchant --&gt; MerchantApp: 35. response  
deactivate Merchant  
MerchantApp -&gt; User: 36. show result  
deactivate MerchantApp  
@enduml

##### Transaction Processing

Transaction Processing starts after contactless communication between terminal and MPA in case of contactless payment or after payment gateway transaction authorization initiation in case of e-commerce payment. After authorization MDES notifies Wallet Server about the result of the authorization and sends transaction information. Transaction information is sent to MPA using Remote Notification Service.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant "Terminal/PG" as TER  
participant "Payment Network" as PN  
participant MDES  
participant Issuer  
TER -&gt; PN: 1. authorizeTransaction(tokenPAN, cryptogram)  
activate PN  
activate TER  
PN -&gt; MDES: 2. detokenize  
activate MDES  
MDES -&gt; MDES: 3. lookup token mapping  
MDES --&gt; PN: 4. response(PAN)  
deactivate MDES  
PN -&gt; Issuer: 5. authorize(PAN)  
activate Issuer  
Issuer --&gt; PN: 6. response  
deactivate Issuer  
PN --&gt; TER: 7. response  
deactivate TER  
PN -&gt; MDES: 8. storeTransactionDetails  
deactivate PN  
activate MDES  
MDES -&gt; WS: 9. pushTransactionDetails  
deactivate MDES  
activate WS  
alt store transaction enabled  
WS -&gt; WS: 10. storeTransaction  
end  
WS -&gt; RNS: 11. sendNotification(trxInfo)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 12. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 13. checkWalletSenderId  
MPA-&gt; SDK: 14. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
SDK -&gt; MPA: 15. onNewTransaction(trxDetails)  
deactivate SDK  
activate MPA  
MPA -&gt; User: 16. showSystemNotification(trxDetails)  
deactivate MPA  
@enduml

##### Setting Defaults for Payment

SDK manages default Payment Instrument for contactless payments. After digitization, if there is no default Payment Instrument, SDK sets digitized Payment Instrument after activation as default. In case where there are more than one active Payment Instruments and current default Payment Instrument is deleted or suspended, the SDK will set first active Payment Instrument as default. Default Payment Instrument can be changed at any time. Only active Payment Instrument can be set as default.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
MPA-&gt;User: 1. payment instrument list  
activate MPA  
User-&gt;MPA: 2. choose default for contactless payment)  
MPA-&gt;SDK: 3. UCP::setDefaultForContactless(paymentInstrumentId)  
activate SDK  
SDK-&gt; SDK: 4. storeDefault  
SDK--&gt;MPA: 5. result  
deactivate MPA  
deactivate SDK  
@enduml

##### Login On Wallet Server

User data are protected by User session token which is issued by Wallet Server after providing authentication factor. Authentication factor is provided first in pairing device and then session is created. Since session has limited period of validity, it needs to be refreshed using login on Wallet Server methods.

<div class="no-print" id="bkmrk--62"></div>Login on Wallet Server using Trusted Identity

<span class="inline-comment-marker" data-ref="9f5a29d0-cb23-4250-8d69-36eb12a9f054">In the Integrated implementation model </span><span class="inline-comment-marker" data-ref="69b19563-486d-488b-83c4-a22b63866f30">User authentication doesn't occur directly on Wallet Server</span><span class="inline-comment-marker" data-ref="9f5a29d0-cb23-4250-8d69-36eb12a9f054">. Wallet Server will require User authentication when some user data will be requested.</span><span class="inline-comment-marker" data-ref="2b4f7219-a07f-4150-8e26-7f7fb8df1303"> If</span><span class="inline-comment-marker" data-ref="9f5a29d0-cb23-4250-8d69-36eb12a9f054"> User session token is no longer valid, </span><span class="inline-comment-marker" data-ref="34504657-2221-4043-a22a-fc5cc2215dc2">SDK will return USER\_UNATHORIZED error</span><span class="inline-comment-marker" data-ref="9f5a29d0-cb23-4250-8d69-36eb12a9f054">. In such case Trusted Identity needs to be prepared on </span><span class="inline-comment-marker" data-ref="5cb1b457-14e4-4c99-96eb-08e5fa81ff03">Issuer server</span><span class="inline-comment-marker" data-ref="9f5a29d0-cb23-4250-8d69-36eb12a9f054"> and sent via Wallet SDK in loginByTrustedIdentity method. </span><span class="inline-comment-marker" data-ref="9f5a29d0-cb23-4250-8d69-36eb12a9f054">MPA can decide whether ask User to provide authentication data or not. The latter case regards situation when user is already authenticated and Trusted Identity can be immediately returned from Issuer based on already valid session on Issuer side</span>. During login process Wallet Server checks if given device still exists, if not then responds with CANT\_FIND\_DEVICE status which is interpreted on SDK side as given device is deleted and all local data stored on SDK side are cleared.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Issuer" as Issuer  
MPA -&gt; SDK: 1. invoke API  
activate MPA  
activate SDK  
SDK -&gt; WS: 2. invoke API  
activate WS  
WS --&gt; SDK: 3. response(USER\_UNATHORIZED)  
deactivate WS  
SDK --&gt; MPA: 4. result(USER\_UNATHORIZED)  
MPA-&gt;User: 5. show authenticate view  
User-&gt;MPA: 6. put authentication data  
MPA-&gt;Issuer: 7. authenticate  
activate Issuer  
Issuer -&gt; Issuer: 8. generateTrustedIdentity - signed user id  
Issuer --&gt; MPA: 9. response(trustedIdentity)  
deactivate Issuer  
MPA-&gt; SDK: 10. MDC::loginByTrustedIdentity(trustedIdentity)  
SDK-&gt; WS: 11. loginByTrustedIdentity(trustedIdentity)  
activate WS  
WS -&gt; WS: 12. check if device exists  
alt device exists  
WS-&gt; WS: 13. verify trusted identity  
WS --&gt; SDK: 14. response(userSessionToken)  
SDK -&gt; SDK: 15. store(userSessionToken)  
SDK--&gt;MPA: 16. result  
MPA -&gt; SDK: 17. invoke API  
else device not exists  
WS --&gt; SDK: 18. response(CANT\_FIND\_DEVICE)  
deactivate WS  
SDK -&gt; SDK: 19. clearAllLocalData  
SDK --&gt; MPA: 20. result(CANT\_FIND\_DEVICE)  
deactivate MPA  
deactivate SDK  
... Pair device ...  
note over MPA, WS #1C1E3F: See Pairing Device diagram  
MPA -&gt; SDK: 21. invoke API  
end  
@enduml

##### Getting Cards

When cards are already placed on Wallet Server, then they can be displayed to User in the application. Cards have identifiers which can be used e.g. for digitization.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
MPA-&gt;SDK: 1. MDC::getAllCards  
activate MPA  
activate SDK  
SDK -&gt; WS: 2. getAllCards(userSessionToken)  
WS --&gt; SDK: 3. response(userCards)  
deactivate WS  
SDK --&gt; MPA: 4. result(cardList)  
deactivate SDK  
deactivate MPA  
@enduml

##### Getting Payement Intruments

After digitization process, payment instrument is stored in UCP SDK module of Wallet SDK. Payment instrument in context of UCP SDK is digitized card and contains i<span class="inline-comment-marker" data-ref="c217c90e-aeb1-45cd-b912-b94a8b187a0f">nformation like</span>:

- id (specified id which helps MPA to identify payment instrument which was digitized from MPA),
- status,
- transaction credentials count,
- paymentTokenId etc. .

MPA can get information about all Payment Instruments from the Wallet SDK at any time. Payment instruments will be retrieved only from local storage that is part of SDK. Payment Tokens for Payment Instruments can be refreshed/pulled from Wallet Server on demand. This scenario should be considered only when User e.g. makes swipe to refresh.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Issuer" as IS  
MPA-&gt;SDK: 1. UCP::getAllPaymentInstruments(refresh)  
activate MPA  
alt refresh = true  
activate SDK  
SDK -&gt; WS: 2. getAllPaymentTokens(userSessionToken)  
activate WS  
WS -&gt; SDK: 3. response(devicePaymentTokens)  
deactivate WS  
SDK -&gt; SDK: 4. updateLocalStorage  
end  
SDK --&gt; MPA: 5. result(paymentInstrumentList)  
deactivate SDK  
deactivate MPA  
@enduml

##### Getting Transaction History

<span class="inline-comment-marker" data-ref="219e0d06-3d08-4c8e-b07b-edf00a9646e4">It is possible that transaction history will be stored on Wallet Server for infinite time</span>. <span class="inline-comment-marker" data-ref="9a21ab0b-13b1-4d44-a1c2-d37b19917ae3">This should be specified during onboarding.</span> <span class="inline-comment-marker" data-ref="d3c6fb05-0ad6-4801-a5a5-0b57de8724a4">If this options is enabled, MPA can retrieve transaction history for given user and filtering.</span> Transactions are returned in corresponding parts for better user experience. If next part is available then response from previous part contain information needed for requesting next part. MPA should check if next part is not empty and then make another request.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
loop next != null  
MPA-&gt;SDK: 1. MDC::getTransactionsHistory(filters, next?)  
activate MPA  
activate SDK  
SDK -&gt; WS: 2. getTransactionHistory(filters, next?, userSessionToken, ...)  
activate WS  
WS -&gt; SDK: 3. response(transactionHistoryList, next?)  
deactivate WS  
SDK --&gt; MPA: 4. result(transactionHistoryList, next?)  
deactivate SDK  
deactivate MPA  
end  
@enduml

##### Payment Token Lifecycle Management via SDK

Payment Token lifecycle management can be done via SDK.

<div class="no-print" id="bkmrk--63"></div>##### Delete Payment Token via SDK

Payment Token can be deleted using SDK.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
User -&gt; MPA: 1. Delete payment token  
activate MPA  
MPA -&gt; SDK: 2. UCP::delete(paymentInstrumentId, reason)  
deactivate MPA  
activate SDK  
SDK -&gt; WS: 3. deletePaymentToken(userSessionToken, paymentTokenId, reason)  
activate WS  
WS -&gt; MDES: 4. Delete token  
activate MDES  
MDES -&gt; MDES: 5. Delete token mapping  
MDES --&gt; WS: 6. response  
deactivate MDES  
WS --&gt; SDK: 7. response  
deactivate WS  
alt Request session if required  
SDK -&gt; MDES: 8. request session  
activate MDES  
MDES --&gt; SDK: 9. response  
MDES -&gt; WS: 10. sendRemoteNotificationMessage  
deactivate MDES  
activate WS  
WS -&gt; RNS: 11. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 12. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 13. checkWalletSenderId  
MPA-&gt; SDK: 14. UCP::CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK -&gt; MDES: 15. delete(tokenUniqueReference)  
activate MDES  
MDES --&gt; SDK: 16. response  
deactivate MDES  
SDK -&gt; SDK: 17. Delete transaction credentials, card profile  
SDK -&gt; MPA: 18. onPaymentInstrumentStatusChanged(id, status)  
deactivate SDK  
MPA --&gt; User: 19. show update view  
deactivate MPA  
@enduml

##### Errors Reporting

<span class="inline-comment-marker" data-ref="52e5d7e3-97f6-45df-ad12-9c992171ea03">Wallet SDK performs some security checks. When any issue is detected, Wallet SDK reports error to Wallet Server and clears own data. Also notification to MPA is called.</span>

<span class="inline-comment-marker" data-ref="52e5d7e3-97f6-45df-ad12-9c992171ea03">@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
SDK -&gt; SDK: 1. detectSecurityIssue  
activate SDK  
SDK -&gt; SDK: 2. clearSDKData  
SDK -&gt; WS: 3. reportSecurityIssue  
activate WS  
deactivate WS  
deactivate SDK  
SDK -&gt; MPA: 4. onSecurityIssueAppeared(event)  
activate MPA  
deactivate MPA  
MPA -&gt; User: 5. show information  
@enduml  
</span>

##### Device Unpairing

Unpairing device clears all modules data and report that fact only if possible to server. If server receives this signal then removes all device data including provisioned Payment Tokens. If not then data are cleared locally only - similar like during app uninstallation. This can be used for scenario when MPA does not want to use SDK at all or for scenario when MPA supports switching between users accounts on the same installation. If MPA detects that new User is trying to log into application in case when previous had digitized cards, immediately should clear all data from previous, since SDK stores data in context of one User only.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
MPA -&gt; SDK: 1. MDC::unpairDevice  
activate MPA  
activate SDK  
opt  
SDK -&gt; WS: 2. unpairDevice  
activate WS  
WS --&gt; SDK: 3. response  
deactivate WS  
end  
SDK -&gt; SDK: 4. clearAllData  
SDK --&gt; MPA: 5. result  
deactivate SDK  
deactivate MPA  
@enduml

#### MDES Initiated

This section describes use cases which are initiated from MDES.

<div class="no-print" id="bkmrk--64"></div>##### Re-digitization

Re-digitization process can be triggered by MDES for several use cases:

**Token Expiry**

One month before token expiry MDES will request for redigitization.

**Attribute Change**

Issuer may perform an attribute change at the BIN account-range level impacting theri MDES enabled ranges. Some device tokens may need to have their data refreshed to match the new attributes.

**BIN Account-Range Split**

Issuer may perform a BIN account-range split. Some existing tokens may need to be updated to ensure that they are linked to the correct funding BIN account ranges internally.

**PAN Update in Different Account Range**

Issuer may update existing PAN with new Pan in a different BIN account range.

For above cases:

- token unique reference remains the same
- token expiration date is extended by three years from the date of redigitization

After successful redigitization process transaction credentials replenishment is called in case where Payment Token is active.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
MDES -&gt; WS: 1. notifyTokenUpdated(redigitize=true)  
activate MDES  
activate WS  
WS -&gt; MDES: 2. redigitize  
MDES --&gt; WS: 3. response  
WS --&gt; MDES: 4. response  
deactivate MDES  
deactivate WS  
MDES-&gt;WS: 5. sendRemoteNotificationMessage(mdesRemoteMessage)  
activate MDES  
deactivate MDES  
activate WS  
WS-&gt; RNS: 6. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS-&gt; MPA: 7. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 8. checkWalletSenderId  
MPA-&gt; SDK: 9. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
SDK-&gt; MDES: 10. provision(redigitize=true)  
activate MDES  
MDES --&gt; SDK: 11. response(cardProfile)  
SDK-&gt; MDES: 12. notify provisioning result(redigitize=true)  
MDES --&gt; SDK: 13. response  
SDK -&gt; WS: 14. confirmReProvisioningStatus(SUCCESS/FAILURE)  
alt FAILURE  
WS -&gt; WS: 15. markRedigitizationAsFailed  
note left: redigitization process will be retried after some period of time  
SDK -&gt; MPA: 16. onReProvisioningFailure(paymentInstrument)  
else SUCCESS  
SDK -&gt; SDK: 17. clearTransactionCredentials  
SDK -&gt; MPA: 18. onReProvisioningSuccess(paymentInstrument)  
deactivate SDK  
MDES -&gt; WS: 19. notifyTokenUpdated(redigitized=false)  
deactivate MDES  
activate WS  
WS -&gt; RNS: 20. sendNotification(PAYMENT\_TOKEN\_INFO\_CHANGE(redigitized=true))  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 21. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 22. checkWalletSenderId  
MPA-&gt; SDK: 23. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
SDK -&gt; SDK: 24. replenish  
... Automatic Replenishment ...  
note over SDK, MDES #1C1E3F: Just after reprovisioning transaction credentials initial replenishment is performed by SDK\\r. See Transaction Credentials Initial Replenishment diagram  
end  
@enduml

#### Wallet Server Initiated

Since important processes are asynchronous in MDES and there are many point of failures, wallet server provides additional functionalities to resolve some failure scenarios by running some operations on own side.

<div class="no-print" id="bkmrk--65"></div>##### Removing Not Provisioned Tokens

Wallet Server checks periodically DEVICE Payment Tokens and verify if provisioning is completed. These Payment Tokens which have provisioning status in progress for long period of time are deleted automatically and from User perspective process needs to be started again. By default this period is set to 1 hour but can be modified.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
WS -&gt; WS: 1. find not provisioned payment tokens for a\\r long period of time  
activate WS  
loop Not provisioned payment tokens for a long period of time  
WS -&gt; MDES: 2. Delete token  
activate MDES  
MDES -&gt; MDES: 3. Delete token mapping  
MDES --&gt; WS: 4. response  
deactivate MDES  
WS -&gt; RNS: 5. sendNotification(paymentTokenDelete)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 6. deliverNotification  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 7. checkWalletSenderId  
MPA-&gt; SDK: 8. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
alt Request session if required  
SDK -&gt; MDES: 9. request session  
activate MDES  
MDES --&gt; SDK: 10. response  
MDES -&gt; WS: 11. sendRemoteNotificationMessage  
deactivate MDES  
activate WS  
WS -&gt; RNS: 12. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 13. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 14. checkWalletSenderId  
MPA-&gt; SDK: 15. UCP::CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK -&gt; MDES: 16. delete(tokenUniqueReference)  
activate MDES  
MDES --&gt; SDK: 17. response  
deactivate MDES  
SDK -&gt; SDK: 18. Delete transaction credentials, card profile  
SDK -&gt; MPA: 19. onPaymentInstrumentStatusChanged(id, status)  
deactivate SDK  
end  
deactivate MPA  
@enduml

#### Wallet Server Admin API Initiated

This section describes use cases which are initiated from Wallet Server Admin Panel.

<div class="no-print" id="bkmrk--66"></div>##### Admin Card Deletion

During this process all data related to given card are deleted. Payment Tokens are deleted asynchronously.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
participant "Admin Panel" as AP  
AP -&gt; WS: 1. deleteCard(cardId)  
activate WS  
activate AP  
WS -&gt; WS: 2. deleteCard  
WS --&gt; AP: 3. response  
deactivate AP  
loop All Payment Tokens for card  
WS -&gt; MDES: 4. Delete token  
activate MDES  
MDES -&gt; MDES: 5. Delete token mapping  
MDES --&gt; WS: 6. response  
deactivate MDES  
WS -&gt; RNS: 7. sendNotification(paymentTokenDelete)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 8. deliverNotification  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 9. checkWalletSenderId  
MPA-&gt; SDK: 10. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
alt Request session if required  
SDK -&gt; MDES: 11. request session  
activate MDES  
MDES --&gt; SDK: 12. response  
MDES -&gt; WS: 13. sendRemoteNotificationMessage  
deactivate MDES  
activate WS  
WS -&gt; RNS: 14. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 15. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 16. checkWalletSenderId  
MPA-&gt; SDK: 17. UCP::CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK -&gt; MDES: 18. delete(tokenUniqueReference)  
activate MDES  
MDES --&gt; SDK: 19. response  
deactivate MDES  
SDK -&gt; SDK: 20. Delete transaction credentials, card profile  
SDK -&gt; MPA: 21. onPaymentInstrumentStatusChanged(id, status)  
deactivate SDK  
end  
deactivate MPA  
@enduml

##### Admin Device Deletion

During this process all data related to given device are deleted. Payment Tokens are deleted asynchronously.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES  
participant "Admin Panel" as AP  
AP -&gt; WS: 1. deleteDevice(deviceInstallationId)  
activate AP  
activate WS  
WS --&gt; AP: 2. response  
deactivate AP  
loop All Payment Tokens for given device  
WS -&gt; MDES: 3. delete token  
activate MDES  
MDES --&gt; WS: 4. response  
deactivate WS  
deactivate MDES  
end  
@enduml

##### Admin Token Deletion

Payment Token can be unsuspended via admin panel.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
participant "Admin Panel" as AP  
AP -&gt; WS: 1. deletePaymentToken(paymentTokenId)  
activate AP  
activate WS  
WS -&gt; MDES: 2. Delete token  
activate MDES  
MDES -&gt; MDES: 3. Delete token mapping  
MDES --&gt; WS: 4. response  
deactivate MDES  
WS --&gt; AP: 5. response  
deactivate AP  
WS -&gt; RNS: 6. sendNotification(paymentTokenDeleted)  
deactivate WS  
activate RNS  
RNS-&gt;MPA: 7. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 8. checkWalletSenderId  
activate SDK  
MPA-&gt; SDK: 9. UCP::CloudMessage#process(pushData)  
deactivate MPA  
deactivate MPA  
deactivate MDES  
alt Request session if required  
SDK -&gt; MDES: 10. request session  
activate MDES  
MDES --&gt; SDK: 11. response  
MDES -&gt; WS: 12. sendRemoteNotificationMessage  
deactivate MDES  
activate WS  
WS -&gt; RNS: 13. sendNotification(mdesRemoteMessage)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 14. deliverPush  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 15. checkWalletSenderId  
MPA-&gt; SDK: 16. UCP::CloudMessage#process(pushData)  
deactivate MPA  
end  
SDK -&gt; MDES: 17. delete(tokenUniqueReference)  
activate MDES  
MDES --&gt; SDK: 18. response  
deactivate MDES  
SDK -&gt; SDK: 19. Delete transaction credentials, card profile  
SDK -&gt; MPA: 20. onPaymentInstrumentStatusChanged(id, status)  
deactivate SDK  
MPA --&gt; User: 21. show update view  
deactivate MPA  
@enduml

##### Admin Token Suspension

Payment Token can be suspended via admin panel.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
participant "Admin Panel" as AP  
AP -&gt; WS: 1. suspendToken(paymentTokenId)  
activate WS  
activate AP  
WS -&gt; MDES: 2. suspend token  
activate MDES  
MDES -&gt; MDES: 3. Suspend token  
MDES --&gt; WS: 4. response  
deactivate MDES  
WS --&gt; AP: 5. response  
deactivate AP  
WS -&gt; RNS: 6. sendNotification(paymentTokenSuspend)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 7. deliverNotification  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 8. checkWalletSenderId  
MPA-&gt; SDK: 9. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
SDK -&gt; SDK: 10. suspend  
SDK -&gt; MPA: 11. onPaymentInstrumentStatusChanged(id, status)  
deactivate SDK  
deactivate MPA  
@enduml

##### Admin Token Unsuspension

Payment Token can be unsuspended via admin panel.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant "Remote Notification Service" as RNS  
participant MDES  
participant "Admin Panel" as AP  
AP -&gt; WS: 1. unsuspendToken(paymentTokenId)  
activate WS  
activate AP  
WS -&gt; MDES: 2. unsuspend token  
activate MDES  
MDES -&gt; MDES: 3. Unsuspend token  
MDES --&gt; WS: 4. response  
deactivate MDES  
WS --&gt; AP: 5. response  
deactivate AP  
WS -&gt; RNS: 6. sendNotification(paymentTokenUnsuspend)  
deactivate WS  
activate RNS  
RNS -&gt; MPA: 7. deliverNotification  
deactivate RNS  
activate MPA  
MPA -&gt; MPA: 8. checkWalletSenderId  
MPA-&gt; SDK: 9. UCP::CloudMessage#process(pushData)  
deactivate MPA  
activate SDK  
SDK -&gt; SDK: 10. activate  
SDK -&gt; MPA: 11. onPaymentInstrumentStatusChanged(id, status)  
deactivate SDK  
deactivate MPA  
... Replenishment ...  
note over SDK, MDES #1C1E3F: Just after token activation transaction credentials replenishment is performed by SDK\\r. See Transaction Credentials Automatic Replenishment diagram  
@enduml

##### Admin User Deletion

During this process all data related to given User are deleted. Payment Tokens are deleted asynchronously.

@startuml  
skinparam ParticipantPadding 30  
skinparam BoxPadding 30  
skinparam noteFontColor #FFFFFF  
skinparam noteBackgroundColor #1C1E3F  
skinparam noteBorderColor #1C1E3F  
skinparam noteBorderThickness 1  
skinparam sequence {  
ArrowColor #1C1E3F  
ArrowFontColor #1C1E3F  
ActorBorderColor #1C1E3F  
ActorBackgroundColor #FFFFFF  
ActorFontStyle bold  
ParticipantBorderColor #1C1E3F  
ParticipantBackgroundColor #1C1E3F  
ParticipantFontColor #FFFFFF  
ParticipantFontStyle bold  
LifeLineBackgroundColor #1C1E3F  
LifeLineBorderColor #1C1E3F  
}  
actor User  
participant MPA  
participant "Wallet SDK" as SDK  
participant "Wallet Server" as WS  
participant MDES  
participant "Admin Panel" as AP  
AP -&gt; WS: 1. deleteUser(userId)  
activate AP  
activate WS  
WS -&gt; WS: 2. delete cards, devices  
WS --&gt; AP: 3. response  
deactivate AP  
loop All Payment Tokens for given User  
WS -&gt; MDES: 4. delete token  
activate MDES  
MDES --&gt; WS: 5. response  
deactivate WS  
deactivate MDES  
end  
@enduml

# 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"