Register a new consumer
Registration creates a Wollette consumer from your own screens. The SDK exposes the API steps through sdk.onboarding; your app owns the consent, input and error UI. Registration returns a consumer id. It does not sign the user in and does not start wallet activation.
Flow
flowchart TD
accTitle: New-consumer journey
accDescr: Register a new consumer, then sign in and activate the wallet.
Phone["Your app + SDK<br/>Request and verify phone code"] --> Consumer["Wollette API<br/>Create consumer"]
Consumer --> Login["Your app + sign-in service<br/>Sign in"]
Login --> Wallet["SDK + hosted forms<br/>Activate wallet"]For new consumers. Registration returns a consumer ID; it does not sign the consumer in or activate the wallet. Existing consumers start with sign-in and their current activation state.
- Optionally check that the phone number is free.
- Request an SMS OTP for the phone number.
- Verify the 6-digit code.
- Optionally check that the email and username are free.
- Create the user.
- Proceed to Sign in.
Every registration API call takes your ApiContextProvider.
1. Check the phone (optional)
val availability = sdk.onboarding.checkPhone(Phone(countryCode = "+44", number = "7700900123"), provider)
if (!availability.unique) showAlreadyRegistered()let availability = try await sdk.onboarding.checkPhone(Phone(countryCode: "+44", number: "7700900123"), provider: provider)
if !availability.unique { showAlreadyRegistered() }countryCode is + followed by 1 to 3 digits. number is the national number without the country code. This call does not start an OTP session and is safe to retry.
2. Request the OTP
sdk.onboarding.requestOtp(Phone("+44", "7700900123"), provider)try await sdk.onboarding.requestOtp(Phone(countryCode: "+44", number: "7700900123"), provider: provider)The phone is held in memory for the rest of the flow. A new request replaces any previous session. HTTP 429 surfaces as OTP_COOLDOWN; show a wait message rather than retrying immediately. To send another code to the same number, call resendOtp(provider); this clears a previously verified code.
3. Verify the code
sdk.onboarding.verifyOtp(code, provider)try await sdk.onboarding.verifyOtp(code, provider: provider)The code must be exactly 6 digits. A wrong code is OTP_INVALID. Calling this without a requested OTP is REGISTRATION_STATE. On success the verified code is held for createUser.
4. Check email and username (optional)
val email = sdk.onboarding.checkEmail("anna@example.com", provider)
val username = sdk.onboarding.checkUsername("anna", provider)let email = try await sdk.onboarding.checkEmail("anna@example.com", provider: provider)
let username = try await sdk.onboarding.checkUsername("anna", provider: provider)Both return Availability with a unique flag and do not change the OTP session.
5. Create the user
val result = sdk.onboarding.createUser(
CreateUserRequest(
email = "anna@example.com",
password = password,
username = "anna",
firstName = "Anna",
lastName = "Smith",
birthDate = "1990-01-31",
gender = Gender(entryId = genderEntryId),
localeSettings = LocaleSettings(currencyId = gbp, languageId = en, timezoneId = london),
termsId = termsId,
address = Address(
countryId = gb, firstLine = "1 High Street", postCode = "SW1A 1AA",
provinceId = province, administrativeAreaId = area, townId = town,
),
),
provider,
)
val consumerId = result.idlet result = try await sdk.onboarding.createUser(
CreateUserRequest(
email: "anna@example.com",
password: password,
username: "anna",
firstName: "Anna",
lastName: "Smith",
birthDate: "1990-01-31",
gender: Gender(entryId: genderEntryId),
localeSettings: LocaleSettings(currencyId: gbp, languageId: en, timezoneId: london),
termsId: termsId,
address: Address(
countryId: gb, firstLine: "1 High Street", postCode: "SW1A 1AA",
provinceId: province, administrativeAreaId: area, townId: town
)
),
provider: provider
)
let consumerId = result.id- Requires a session where the OTP was requested and verified; otherwise
REGISTRATION_STATE. - All required strings must be non-blank and the email must contain
@. - An address is required for the default app type (
THIRD_PARTY/.thirdParty). OnlyNATIVE_WOLLETTE/.nativeWollettemay omit it. A supplied address is always validated. - The SDK attaches the device name and a locally generated serial number.
- Returns
CreateUserResultwith the consumeridandfullyRegistered(false if the API omits it). - On success the in-memory OTP session is cleared.
Obtain valid IDs using the reference-data reads for the approved environment. The SDK has no lookup methods for them. Variables such as genderEntryId, gbp and termsId are returned inputs, not literal test values.
Obtain registration reference data
Your host or reference-data service calls the existing core endpoints under the approved API origin. These are separate HTTP reads, not native SDK methods.
| Registration input | Existing core read |
|---|---|
| Currency | GET /api/v1/currencies |
| Language | GET /api/v1/languages |
| Timezone entry | GET /api/v1/timezone-metadata, then /api/v1/timezone-metadata/{metadataId}/entries |
| Gender entry | GET /api/v1/gender-metadata, then /api/v1/gender-metadata/{metadataId}/entries |
| Accepted terms | GET /api/v1/terms, then /api/v1/terms/{id} |
| Country and address data | GET /api/v1/countries, followed by the applicable address-controller reads and filters |
For gender/timezone fields, select the returned entry ID; do not pass its parent metadata ID. Use the terms actually shown to and accepted by the consumer. Confirm locale, required filters, pagination and permissions with the API owner. IDs from another environment are not test fixtures.
The hosted KYC form also reads BaaS account-purpose, source-of-funds and occupation data. Those values do not replace native registration IDs or OTPs. Obtain approved phone numbers, OTP procedures and bank/identity inputs from your access pack. Password-change OTP acquisition remains a separate requirement.
Restoring the UI
onboarding.state reports where the consumer is: Idle, OtpRequested(phone) or OtpVerified(phone). It never contains the code. On both platforms the state lives only in memory, so process death resets it to Idle. Use it to restore screens after navigation within the same SDK instance.
clearRegistration() drops the in-memory session without calling the API. Call it when the user abandons registration.
Errors to handle
| Kind | Cause | Suggested handling |
|---|---|---|
VALIDATION | Bad input before the request | Show field errors |
OTP_COOLDOWN | Too many OTP requests | Show a wait message |
OTP_INVALID | Wrong code | Let the user retry |
REGISTRATION_STATE | Step out of order | Restart from the OTP request |
NETWORK, SERVER | Transport or server failure | Retry if retryable is true |
Verify the new-consumer journey
- Obtain approved phone/OTP, terms and reference data from the access pack.
- Request and verify the phone code in separate user actions on the same SDK instance.
- Submit one populated
CreateUserRequest. A returned consumer ID is the registration checkpoint;fullyRegisteredis not wallet-activation readiness. - Sign in, then activate the wallet and confirm its current progress before enabling payment features.
After a lost account-creation response, determine whether the account exists through the approved onboarding/support process before submitting again. On process death the in-memory OTP flow is gone; restart verification as appropriate. Clear abandoned registration with onboarding.clearRegistration() and discard sensitive UI input.