B2C Customer Registration Flow

This guide details the complete flow for registering individual (B2C) customers in the FinHub platform. The registration process involves several steps including account creation, email verification, phone verification, and more.

Flow Overview

The following sequence diagram illustrates the complete B2C registration process:

Detailed API Flow

Step 1: Create Customer Account

The first step is to create a customer account with basic information.

API Request:

POST /api/v2/customer/individual
Content-Type: application/json

Request Body:

{
  "person": {
    "firstName": {
      "name": "John"
    },
    "lastName": {
      "name": "Doe"
    },
    "email": "john.doe@example.com",
    "password": "SecureP@ssw0rd",
    "nationality": "United States"
  }
}

Response:

{
  "id": "cust_12345678",
  "status": "PENDING_VERIFICATION",
  "createdAt": "2025-06-01T09:15:00Z"
}

Implementation Notes:

  • The customer ID is stored in localStorage
  • The initial status is set to PENDING_VERIFICATION
  • The system creates a basic customer profile that will need verification

Step 2: Email Verification

After creating the account, the system sends a verification code to the customer’s email.

API Request:

POST /api/v2/customer/verification/email
Content-Type: application/json

Request Body:

{
  "customerId": "cust_12345678",
  "email": "john.doe@example.com"
}

Response:

{
  "status": "VERIFICATION_SENT",
  "message": "Verification code sent to email"
}

Implementation Notes:

  • The verification code is typically a 6-digit number
  • The code is valid for a limited time (usually 10 minutes)
  • The email contains instructions for entering the code

Step 3: Verify Email Code

The customer receives the verification code via email and submits it to verify their email address.

API Request:

POST /api/v2/customer/verification/email/verify
Content-Type: application/json

Request Body:

{
  "customerId": "cust_12345678",
  "verificationCode": "123456"
}

Response:

{
  "status": "EMAIL_VERIFIED",
  "message": "Email successfully verified"
}

Implementation Notes:

  • If the code is incorrect, the system returns an error
  • The customer can request a new code if needed
  • After successful verification, the system updates the customer’s verification status

Step 4: Phone Number Verification

After email verification, the system sends a verification code to the customer’s phone number.

API Request:

POST /api/v2/customer/verification/phone
Content-Type: application/json

Request Body:

{
  "customerId": "cust_12345678",
  "phoneNumber": "+12125551234",
  "countryCode": "US"
}

Response:

{
  "status": "VERIFICATION_SENT",
  "message": "Verification code sent to phone"
}

Implementation Notes:

  • The SMS verification code is typically a 6-digit number
  • The code is valid for a limited time (usually 10 minutes)
  • International phone number format is required

Step 5: Verify SMS Code

The customer receives the verification code via SMS and submits it to verify their phone number.

API Request:

POST /api/v2/customer/verification/phone/verify
Content-Type: application/json

Request Body:

{
  "customerId": "cust_12345678",
  "verificationCode": "123456"
}

Response:

{
  "status": "PHONE_VERIFIED",
  "message": "Phone successfully verified"
}

Implementation Notes:

  • If the code is incorrect, the system returns an error
  • The customer can request a new code if needed
  • After successful verification, the system updates the customer’s verification status
  • The customer’s account is now ready for KYC verification

Error Handling

The registration process includes comprehensive error handling for various scenarios:

Error ScenarioError CodeDescription
Invalid email formatINVALID_EMAILThe provided email does not match required format
Duplicate emailEMAIL_ALREADY_EXISTSAn account with this email already exists
Weak passwordWEAK_PASSWORDPassword does not meet security requirements
Invalid verification codeINVALID_CODEThe provided verification code is incorrect
Expired verification codeCODE_EXPIREDThe verification code has expired
Too many attemptsTOO_MANY_ATTEMPTSToo many failed verification attempts
Invalid phone numberINVALID_PHONEThe provided phone number is invalid

Next Steps

After completing the registration process, the customer should proceed with:

  1. KYC Verification
  2. Setting up 2FA
  3. Creating a financial account

Implementation Considerations

When implementing the B2C registration flow, consider the following:

  • Security: Implement proper password hashing and secure communication
  • Rate Limiting: Apply rate limiting to prevent abuse of verification endpoints
  • User Experience: Provide clear error messages and instructions
  • Compliance: Ensure the registration process complies with relevant regulations
  • Accessibility: Make the registration process accessible to all users