Wallet Setup
This API is available only to merchants with standaloneWallet
access and walletSetup
scope to the config token.
Introduction Feature in development
The Wallet Setup service exposes operations for setting up the Paysafe Embedded Wallet:
- Initiate a customer data verification process
- Submit a customer data verification attempt
- Onboard a new customer
- Change customer credentials
Use the following code to obtain an instance of WalletSetupService
:
- Kotlin
- Swift
val walletSetup = Wallet.getInstance().getWalletSetupService()
import PaysafeWallet
let walletSetup = Wallet.instance.walletSetupService
Initiate a customer data verification process
Use initiateDataVerificationProcess
method to initiate a verification process for a specific customer attribute, such as email
or mobile
.
The method requires an object of type CustomerDataVerificationRequest
. More information about it, you can find here for Android and here for iOS.
- Kotlin
- Swift
val emailDataVerificationRequest = CustomerDataVerificationRequest(
CustomerDataVerificationAttribute(
CustomerDataVerificationAttributeType.EMAIL,
"john.doe@paysafe.com"
),
CustomerDataVerificationFlow.WALLET_SETUP
)
try {
val emailDataVerificationResponse = walletSetup.initiateDataVerificationProcess(emailDataVerificationRequest)
Log.d(TAG, response.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}
let emailDataVerificationRequest = Wallet.CustomerDataVerificationRequest(
attribute: Wallet.CustomerDataVerificationAttribute(
type: .email,
value: "john.doe@paysafe.com"
),
flow: .walletSetup
)
walletSetup.initiateDataVerificationProcess(request: emailDataVerificationRequest,
completion: { result in
switch result {
case .success(let emailDataVerificationResponse):
// Display status
case .failure(let error):
// Handle error
}
})
After calling the initiateDataVerificationProcess
you will receive a CustomerDataVerificationResponse
object, containing a verificationId
attribute.
This attribute is key for submitting a customer data verification attempt and onboarding a customer.
See Submit a customer data verification attempt and Onboard a customer.
Submit a customer data verification attempt
Use submitDataVerificationAttempt
method to submit a verification attempt for a specific customer attribute tied to an already initiated verification process.
The method submitDataVerificationAttempt
requires a verificationId
. You should obtain it from the CustomerDataVerificationResponse
object
that you received after calling initiateDataVerificationProcess
. This verification id is the link to the data verification process initiated by the customer.
The second parameter, required by the submitDataVerificationAttempt
method is a CustomerDataVerificationAttemptRequest
object. A more detailed information about the object, you can find here for Android and here for iOS.
- Kotlin
- Swift
val dataVerificationAttemptRequest = CustomerDataVerificationAttemptRequest(
attribute = CustomerDataVerificationAttribute(
type = CustomerDataVerificationAttributeType.EMAIL,
value = "john.doe@example.com"
),
notificationType = CustomerDataVerificationNotificationType(
method = CustomerDataVerificationNotificationMethod.OTP,
channel = CustomerDataVerificationNotificationChannel.EMAIL
),
value = "123456"
)
try {
val dataVerificationAttemptResponse = walletSetup.submitDataVerificationAttempt(
emailDataVerificationResponse.verificationid,
dataVerificationAttemptRequest
)
Log.d(TAG, response.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}
let dataVerificationAttemptRequest = Wallet.CustomerDataVerificationAttemptRequest(
attribute: CustomerDataVerificationAttribute(
type: .email,
value: "john.doe@paysafe.com"
),
notificationType: CustomerDataVerificationNotificationType(
method: .otp,
channel: .email
),
value: "123456"
)
walletSetup.submitDataVerificationAttempt(verificationId: emailDataVerificationResponse.verificationId,
request: dataVerificationAttemptRequest,
completion: { result in
switch result {
case .success(let dataVerificationAttemptResponse):
// Display status
case .failure(let error):
// Handle error
}
})
Onboard a customer
Use onboardCustomer
method to onboard a new customer. You need to provide an object of type CustomerPersonRequest
. Details about the object can be found here for Android and here for iOS.
By onboarding a customer, we will ensure that they meet all the necessary requirements to use the wallet. Once successful, customer can be authenticated using provided contact method and credentials.
The CustomerIdentifiersOnboarding
consists of two CustomerIdentifier
objects. Both identifiers must be provided in the request. Each identifier has a verificationId
which will be used to ensure that the customer has been verified through the data verification process.
See Inititate a customer data verification process and Submit a customer data verification attempt and Onboard a customer for more details.
- Kotlin
- Swift
val customerPersonRequest = CustomerPersonRequest(
title = null,
firstName = "John",
lastName = "Doe",
birthDate = "1981-08-24",
nationality = "GB",
occupation = Occupation.ARCHITECTURE_CARTOGRAPHY_SURVEYOR,
vulnerabilities = listOf(
Vulnerability.PHYSICAL_DISABILITY
),
additionalAttributes = mapOf("KEY_ALIGNED_WITH_PAYSAFE" to "VALUE_GIVEN_BY_CUSTOMER"),
customerIdentifiers = CustomerIdentifiersOnboarding(
email = CustomerIdentifier(
value = "john.doe@paysafe.com",
verificationId = emailDataVerificationResponse.verificationId
),
mobile = CustomerIdentifier(
value = "+359897765463",
verificationId = mobileDataVerificationResponse.verificationId
)
),
customerCredentials = CustomerCredentials(
password = "Password1.",
pin = null,
),
currencyCode = "EUR",
address = Address(
countryCode = "GB",
stateProvince = null,
city = "London",
postalCode = "E1 8RU",
address1 = "221b Baker St",
address2 = null,
),
preferences = Preferences(
marketing = MarketingPreferences(
receivePushNotifications = true,
receiveMarketingEmails = true,
receiveMarketingSms = true,
receiveSocialAds = false,
receiveTargetedAds = false,
receiveThirdPartyAds = false,
),
data = DataPreferences(
consentForTargetedAds = true,
consentForAnalytics = false,
consentForPerformanceTracking = true
)
),
termsAndConditions = true,
isPoliticallyExposed = false,
)
try {
val customerInfo = walletSetup.onboardCustomer(customerPersonRequest)
Log.d(TAG, customerInfo.toString())
} catch(e: Exception) {
Log.d(TAG, exception.toString())
}
let customerPersonRequest = Wallet.CustomerPersonRequest(
title: nil,
firstName: "John",
lastName: "Doe",
birthDate: Date(timeIntervalSince1970: 367459200),
nationality: "GB",
occupation: .architectureCartographySurveyor,
vulnerabilities: [.gamblingAddiction],
additionalAttributes: ["KEY_ALIGNED_WITH_PAYSAFE" : "VALUE_GIVEN_BY_CUSTOMER"],
customerIdentifiers: Wallet.CustomerIdentifiersOnboarding(
email: Wallet.CustomerIdentifier(
value: "john.doe@paysafe.com",
verificationId: emailDataVerificationResponse.verificationId
),
mobile: Wallet.CustomerIdentifier(
value: "+359897765463",
verificationId: mobileDataVerificationResponse.verificationId
)
),
customerCredentials: Wallet.CustomerCredentials(
password: "Password1.",
pin: nil
),
currencyCode: "EUR",
address: Wallet.CustomerPersonRequest.Address(
countryCode: "GB",
stateProvince: nil,
city: "London",
postalCode: "E1 8RU",
address1: "221b Baker St",
address2: nil
),
preferences: Wallet.Preferences(
marketing: Wallet.MarketingPreferences(
receivePushNotifications: true,
receiveMarketingEmails: true,
receiveMarketingSms: true,
receiveSocialAds: false,
receiveTargetedAds: false,
receiveThirdPartyAds: false
),
data: Wallet.DataPreferences(
consentForTargetedAds: true,
consentForAnalytics: false,
consentForPerformanceTracking: true
)
),
termsAndConditions: true,
isPoliticallyExposed: false
)
walletSetup.onboardCustomer(customer: customerPersonRequest,
completion: { result in
switch result {
case .success(let customerInfo):
// Display status
case .failure(let error):
// Handle error
}
})
Change customer credentials
Use changeCredentials
method to change a specific customer credential, such as password
.
You need to provide an object of type ChangeCustomerCredentialsRequest
to the method. The CustomerIdentifiers
consists of two CustomerIdentifier
objects. At least one identifier must be provided in the request. Each identifier has a verificationId
which will be used to ensure that the customer has been verified through the data verification process.
See Inititate a customer data verification process and Submit a customer data verification attempt for more details how to obtain the verificationId
parameter.
The CustomerCredentials
is a struct representing the credentials you wish to change (e.g. password).
ChangeCustomerCredentialsRequest
Parameter | Data type | Description | Example |
---|---|---|---|
customerIdentifiers | CustomerIdentifiers | Required. The client's email or mobile. | CustomerIdentifiers(CustomerIdentifier("john.doe@paysafe.com", "06bdcd2c"), null ) / CustomerIdentifiers(email: CustomerIdentifier(value: "john.doe@paysafe.com", verificationId: "06bdcd2c"), mobile: nil) |
customerCredentials | CustomerCredentials | Required. The new client credentials. | CustomerCredentials("Password1.") / CustomerCredentials(password: "Password1.") |
- Kotlin
- Swift
val changeCustomerCredentialsRequest = ChangeCustomerCredentialsRequest(
CustomerIdentifiers(
email = CustomerIdentifier(
value = "john.doe@paysafe.com",
verificationId = "06bdcd2c-0cce-4b36-97ec-281c8f5d743c"
),
mobile = null
),
CustomerCredentials(
password = "Password1."
)
)
try {
walletSetup.changeCredentials(changeCustomerCredentialsRequest)
Log.d(TAG, "Credentials changed successfully")
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}
let changeCustomerCredentialsRequest = Wallet.ChangeCustomerCredentialsRequest(
customerIdentifiers: Wallet.CustomerIdentifiers(
email: Wallet.CustomerIdentifier(
value: "john.doe@paysafe.com",
verificationId: "06bdcd2c-0cce-4b36-97ec-281c8f5d743c"
),
mobile: nil
),
customerCredentials: Wallet.CustomerCredentials(
password: "Password1."
)
)
walletSetup.changeCredentials(request: changeCustomerCredentialsRequest,
completion: { result in
switch result {
case .success:
// Display status
case .failure(let error):
// Handle error
}
})