Search Overlay

Profile Information

asdf

Introduction

The Profile service exposes operations for retrieving and managing customer-related information, accounts and balance:

  • Get full customer profile
  • Get all customer accounts
  • Get single customer account
  • Add account in a new currency

Use the following code to obtain an instance of ProfileService:

val profile = Wallet.getInstance().getProfileService()
import PaysafeWallet

let profile = Wallet.instance.profileService

Get Profile

Use getProfile method to retrieve the full customer's profile. Additional information can be requested by adding one or more of the ProfileIncludes values to the include parameter.

ProfileIncludes

Android iOS Description
ACCOUNTS .accounts Include full accounts list for this customer
RESTRICTIONS .restrictions Include customer restrictions and required actions to resolve them
ADDRESS .address Include customer's country, city, address, etc.
CONTACTINFO .contactInfo Include customer's phone, email, etc.
val include = listOf(ProfileIncludes.CONTACTINFO)

try {
    val profileInfo = profile.getProfile(include)
    Log.d(TAG, profileInfo.toString())
} catch (exception: Exception) {
    Log.d(TAG, exception.toString())
}
profile.getProfile(include: [.contactInfo], completion: { result in
    switch result {
    case .success(let customerInfo):
        // Display customer information
    case .failure(let error):
        // Handle error
    }
})

Get Customer Accounts

Use getAccounts method to retrieve all customer accounts. The result is a list of Account objects, containing the balance, currency code, etc.

try {
    val accounts = profile.getAccounts()
    Log.d(TAG, accounts.toString())
} catch (exception: Exception) {
    Log.d(TAG, exception.toString())
}
profile.getAccounts(completion: { result in
    switch result {
    case .success(let accounts):
        // Display accounts
    case .failure(let error):
        // Handle error
    }
})

Get Single Customer Account

Use getSingleAccount method to retrieve a single Account object by ID.

try {
    val account = profile.getSingleAccount("1234567890")
    Log.d(TAG, account.toString())
} catch (exception: Exception) {
    Log.d(TAG, exception.toString())
}
profile.getSingleAccount(accountID: "1234567890", completion: { result in
    switch result {
    case .success(let account):
        // Display account
    case .failure(let error):
        // Handle error
    }
})

Add Customer Account

Use addAccount method to create a new account for the customer in a provided currency. The result will be the newly created Account object.

val addAccountRequest = AddAccountRequest(currencyCode = "EUR")

try {
    val account = profile.addAccount(addAccountRequest)
    Log.d(TAG, account.toString())
} catch (exception: Exception) {
    Log.d(TAG, exception.toString())
}
let addAccountRequest = Wallet.AddAccountRequest(currencyCode: "EUR")
profile.addAccount(request: addAccountRequest, completion: { result in
    switch result {
    case .success(let account):
        // Display new account
    case .failure(let error):
        // Handle error
    }   
})
On this Page