Profile Information
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
:
- Kotlin
- Swift
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. |
- Kotlin
- Swift
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
}
})
Update Profile Feature in development
Use updateProfile
method to update customer's personal information. The result it CustomerInfo
with the full personal information about the customer.
This API is available only to merchants with standaloneWallet
access and walletSetup
scope to the config token.
Updating the following customer details might result in customer restriction and require new KYC Verification.
firstName
,lastName
- re-trigger KYC verificationaddress
- re-trigger address verification of KYC process
To update the following details, the customer must be non-KYC verified. If the customer is KYC verified, you cannot update these details:
birthDate
- Kotlin
- Swift
val updateCustomerRequest = UpdateCustomerRequest(
title = "Mr.",
firstName = "John",
lastName = "Doe",
birthDate = "1991-06-16",
nationality = "US",
occupation = Occupation.ENGINEERING,
vulnerabilities = listOf(Vulnerability.GAMBLING_ADDICTION),
address = UpdateAddressRequest(
stateProvince = "FL",
city = "Tallahassee",
postalCode = "32003",
address1 = "Traditions way 1",
address2 = "Apt. 101"
),
)
val fullCustomerInfo = profile.updateProfile(updateCustomerRequest)
let request = Wallet.UpdateCustomerRequest(title: "Mr.",
firstName: "John",
lastName: "Doe",
birthDate: Date(timeIntervalSince1970: 677030400), nationality: "US",
occupation: .engineering,
vulnerabilities: [.gamblingAddiction],
address: .init(stateProvince: "FL",
city: "Tallahassee",
postalCode: "32003",
address1: "Traditions way 1",
address2: "Apt. 101"))
profile.updateProfile(request: request,
completion: { result in
switch result {
case .success(let customerInfo):
// Display updated 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.
- Kotlin
- Swift
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.
- Kotlin
- Swift
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.
- Kotlin
- Swift
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
}
})