Skip to main content
Version: v5

Payment

warning
This type of integration is only available during the product trial for Enterprise customers. The dashboard and data produced during this integration will not be available after the trial period ends.

Overview#

The SDK-only trial integration for payments depends on calling the trackTransaction method. Each method call generates a payment event, which is processed and has a risk assessment and supporting evidence attributed to it.

Upon completing this integration, you'll have access to the Payment dashboard that shows a detailed analysis of the risk assessments provided by Incognia for each payment.

The setUserId method#

In order to verify a payment attempt, Incognia needs to have an association between a device and a unique account identifier. The Account ID is used for this purpose.

This association must happen in two moments:

1. Whenever the application initializes#

This covers the scenario where the application is updated with the Incognia SDK and the user is already logged in. The Application.onCreate() on Android and the [AppDelegate application:didFinishLaunchingWithOptions:] on iOS are good places to do this.

If the Account Id is not available in those locations, it is important to forward the value to the Incognia SDK as soon as it is available. The important action here is to call setUserId whenever the application initializes so it is guaranteed that we always know that a specific user is associated with a specific device.

2. Whenever the user logs in and out#

It is necessary to call the setUserId method when the user finishes the login and clearUserId when the user logs out. This is usually done in the callback of these two actions.

Incognia.setUserId(context, <accountId>)

To clear the Account ID, call a Incognia.clearUserId when the user logs out.

Incognia.clearUserId(context)

The trackTransaction method#

The trackTransaction method can receive the following parameters:

  • Transaction ID (Optional): A unique identifier for a payment event, allowing you to identify and analyze Incognia's results per transaction event.
  • Transaction Addresses (Optional): A list of addresses that are related to the payment, such as Home, Billing or Shipping addresses. The provided address(es) are compared against the device's location behavior to assess whether the payment is being made from a secure location.

Creating the TransactionAddress object#

To use the transactionAddresses parameter, a TransactionAddress object must be created by using the appropriate helper method (i.e., home, billing, shipping). An example of the transactionAddress is shown below.

// Creating an Android Addressval address = Address(LOCALE)
address.countryName = COUNTRY_NAME //E.g: United Statesaddress.countryCode = COUNTRY_CODE //E.g: USaddress.adminArea = ADMIN_AREA //E.g: New York (REQUIRED)address.subAdminArea = SUB_ADMIN_AREA //E.g: New Yorkaddress.locality = LOCALITY //E.g: New York City (REQUIRED)address.subLocality = SUB_LOCALITY // E.g: Manhattanaddress.thoroughfare = THOROUGHFARE //E.g: Fifth Avenue (REQUIRED)address.subThoroughfare = SUB_THOROUGHFARE //E.g: 350 (REQUIRED)'address.postalCode = POSTAL_CODE //E.g: 10118 (REQUIRED)
// Creating a Transaction Addressval transactionAddress1 = TransactionAddress.homeAddress(address)val transactionAddress2 = TransactionAddress.billingAddress(address)val transactionAddress3 = TransactionAddress.shippingAddress(address)

Calling trackTransaction#

The trackTransaction method must be called after a payment happens in your application.

// Records a payment event.IncogniaDemo.trackTransaction(context, accountID, transactionID, transactionAddress1, transactionAddress2)

Simpler method signatures are also available if the Transaction ID or the Transaction Addresses are not readily available in your application.

// Records a payment event.IncogniaDemo.trackTransaction(context, accountID)IncogniaDemo.trackTransaction(context, accountID, transactionID)

If the method is correctly called, payment events will start being generated and sent to Incognia. The following line should also be printed on the Logcat console.

Event sent: pov_transaction_event

Results#

After your application is released and enough events are generated, the processed events will be available at the Payment dashboard.