Register a new consumer
Guides

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

mermaid
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.

  1. Optionally check that the phone number is free.
  2. Request an SMS OTP for the phone number.
  3. Verify the 6-digit code.
  4. Optionally check that the email and username are free.
  5. Create the user.
  6. 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()

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)

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)

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)

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.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). Only NATIVE_WOLLETTE / .nativeWollette may omit it. A supplied address is always validated.
  • The SDK attaches the device name and a locally generated serial number.
  • Returns CreateUserResult with the consumer id and fullyRegistered (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 inputExisting core read
CurrencyGET /api/v1/currencies
LanguageGET /api/v1/languages
Timezone entryGET /api/v1/timezone-metadata, then /api/v1/timezone-metadata/{metadataId}/entries
Gender entryGET /api/v1/gender-metadata, then /api/v1/gender-metadata/{metadataId}/entries
Accepted termsGET /api/v1/terms, then /api/v1/terms/{id}
Country and address dataGET /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

KindCauseSuggested handling
VALIDATIONBad input before the requestShow field errors
OTP_COOLDOWNToo many OTP requestsShow a wait message
OTP_INVALIDWrong codeLet the user retry
REGISTRATION_STATEStep out of orderRestart from the OTP request
NETWORK, SERVERTransport or server failureRetry if retryable is true

Verify the new-consumer journey

  1. Obtain approved phone/OTP, terms and reference data from the access pack.
  2. Request and verify the phone code in separate user actions on the same SDK instance.
  3. Submit one populated CreateUserRequest. A returned consumer ID is the registration checkpoint; fullyRegistered is not wallet-activation readiness.
  4. 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.