VendorOnboardingController Actions
14 actions registered.
VendorOnboardingController:fetchSessionDisclaimers
Package: @metamask/kyc-controller
Fetches the idOS and identity provider (SumSub) documents the user consents to once the vendor session exists, with which ones are already consented. Nothing is saved on the phone.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
Returns: The documents and the reusability consent.
Handler signature:
({ vendor, }: {
vendor: OnboardingVendor;
}) => Promise<KycSessionDisclaimers>
VendorOnboardingController:getPartnerEmail
Package: @metamask/kyc-controller
The verified MetaMask email the vendor's session is opened with: the address a screen should start its email field with. Reads it from a partner identity token minted for the vendor.
It records no identity-sharing consent. Before the user has granted it,
MetaMask Auth refuses the token and this returns undefined.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
Returns: The email, or undefined when no token can be minted yet or it carries no verified email.
Handler signature:
({ vendor, }: {
vendor: OnboardingVendor;
}) => Promise<string | undefined>
VendorOnboardingController:getState
Package: @metamask/kyc-controller
Handler signature:
() => VendorOnboardingControllerState
VendorOnboardingController:launchProviderFlow
Package: @metamask/kyc-controller
Presents the identity provider flow (SumSub) for the vendor's session. When the user finishes it, the next step is read: kyc-api works out from the relay whether idOS still needs anything. Nothing about the flow is kept on the phone.
The session must already have its authorizations (see
VendorOnboardingController.startSession) and its consents (see
VendorOnboardingController.recordSessionDisclaimers).
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.locale | BCP-47 locale for the SDK UI. |
params.debug | Enables SDK debug logging. |
Returns: How the flow ended.
Handler signature:
(params: {
vendor: OnboardingVendor;
locale?: string;
debug?: boolean;
}) => Promise<OnboardingProviderOutcome>
VendorOnboardingController:recordMfaCompleted
Package: @metamask/kyc-controller
Records that the user finished MetaMask's MFA on this device, then reads the step. Call it when MFA succeeds, before any session exists: kyc-api cannot see MFA until the session is created, and without this it would ask for MFA again.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
Returns: The next step.
Handler signature:
(params: {
vendor: OnboardingVendor;
}) => Promise<KycStep>
VendorOnboardingController:recordSessionDisclaimers
Package: @metamask/kyc-controller
Records the user's idOS and identity provider consents with kyc-api right away, then reads the next step. Nothing is kept on the phone.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.idOS | Accepted idOS documents (key and version from VendorOnboardingController.fetchSessionDisclaimers). |
params.kycProvider | Accepted identity provider documents. |
params.credentialReusabilityConsentGiven | Whether the user lets idOS reuse their existing credentials. The screen asks for it, so it is an argument and never a default. |
Returns: The next step.
Handler signature:
(params: {
vendor: OnboardingVendor;
idOS: KycConsentRecord[];
kycProvider: KycConsentRecord[];
credentialReusabilityConsentGiven: boolean;
}) => Promise<KycStep>
VendorOnboardingController:refreshStep
Package: @metamask/kyc-controller
Asks kyc-api for the vendor's current step and saves it. Call it when a screen opens: the answer replaces whatever was saved. Calls that overlap share one request.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
Returns: The step.
Handler signature:
({ vendor, }: {
vendor: OnboardingVendor;
}) => Promise<KycStep>
VendorOnboardingController:reset
Package: @metamask/kyc-controller
Forgets what the phone saved, for one vendor or all of them. kyc-api keeps the session and what it holds, so the next refresh brings that step back. What only the phone knew is gone: MFA done before a session, the accepted terms, and any consents still waiting for a session. A decision it was waiting on stops being read.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor to forget. Omit to forget all. |
Handler signature:
({ vendor }?: {
vendor?: OnboardingVendor;
}) => void
VendorOnboardingController:sendEmailOtp
Package: @metamask/kyc-controller
Sends the vendor's email code again.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.email | The Kalshi email to sign into the new users/link. Required for Kalshi, including when the user corrects the address. |
Returns: The next step.
Handler signature:
(params: {
vendor: OnboardingVendor;
email?: string;
}) => Promise<KycStep>
VendorOnboardingController:sendPhoneOtp
Package: @metamask/kyc-controller
Sends the vendor's SMS code to the phone number.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.phoneNumber | The phone number in E.164 format. |
Returns: The next step.
Handler signature:
(params: {
vendor: OnboardingVendor;
phoneNumber: string;
}) => Promise<KycStep>
VendorOnboardingController:startSession
Package: @metamask/kyc-controller
Opens the vendor's UKYC session, or picks up the one kyc-api already has,
then reads the next step. Call it from the step that asks for MFA
(mfa), with the token MFA returned.
A new session creates the user's local_user_secret when it is missing,
then wraps the encryption key and a capability token for idOS. The
consents the user gave on the terms pages are posted to the new session,
then cleared from the phone. An existing session gets fresh
authorizations every time, because the step does not say whether its
capability authorization is still valid, and any consents still waiting
on the phone are posted to it. A Kalshi email given while resuming sends
a code to that address.
The MFA flag is cleared once the session exists, because kyc-api reads MFA from the session from then on.
This does not create a vendor customer. A vendor that needs one before its session (Iron) adds that when it moves to this controller.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.aal2Token | AAL2 token from MFA. Required only when a new session has to be created. Omit it to pick up an existing session. Held in memory by the caller and never saved here. |
params.email | The Kalshi email the phone signs into users/link. Required when creating a Kalshi session, and when resuming one to send a code. kyc-api does not receive it: the relay is given the verified email from the partner identity token, so this must be that address. Any other is refused with kalshi_signed_request_email_mismatch before anything is signed. |
params.intentOpen | Whether the user already has an open Kalshi enrollment intent. The phone then signs users/link alone, where a new session signs enrollment/intents first. |
Returns: The step the user is on once the session exists.
Handler signature:
(params: {
vendor: OnboardingVendor;
aal2Token?: string;
email?: string;
intentOpen?: boolean;
}) => Promise<KycStep>
VendorOnboardingController:submitTerms
Package: @metamask/kyc-controller
Records the user's acceptance of the vendor's terms, then reads the step.
Kalshi keeps the acceptance on the phone and sends it with every step read. The idOS and identity provider consents wait on the phone until the session exists, because kyc-api only takes consents on a session. If a session already exists they are posted to it straight away.
Other vendors send the acceptance to kyc-api right away.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.disclaimerIds | Accepted terms ids from the vendor catalog. |
params.country | Iron only. ISO 3166-1 alpha-3 country the terms were fetched for. |
params.idOS | Kalshi only. Accepted idOS documents (key and version from KycService.fetchSessionDisclaimersByCountry). |
params.kycProvider | Kalshi only. Accepted identity provider documents. |
params.credentialReusabilityConsentGiven | Kalshi only. Whether the user lets idOS reuse their existing credentials. The screen asks for it, so it is an argument and never a default. |
Returns: The step the user is on once the terms are recorded.
Handler signature:
(params: SubmitKalshiTermsParams | SubmitVendorTermsParams) => Promise<KycStep>
VendorOnboardingController:verifyEmailOtp
Package: @metamask/kyc-controller
Verifies the vendor's email code.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.code | The code from the user. |
Returns: The next step.
Handler signature:
(params: {
vendor: OnboardingVendor;
code: string;
}) => Promise<KycStep>
VendorOnboardingController:verifyPhoneOtp
Package: @metamask/kyc-controller
Verifies the vendor's SMS code.
Parameters:
| Name | Description |
|---|---|
params | The parameters. |
params.vendor | The vendor. |
params.code | The code from the user. |
Returns: The next step.
Handler signature:
(params: {
vendor: OnboardingVendor;
code: string;
}) => Promise<KycStep>