Account Activation

Please follow the documentation below on how to activate an user via the API

1) Check If Customer Exists

    Endpoint: `/api/account/registered/:email_address - or - :username`
    Method: `GET`
    Response: {
        "customer_id": number
        "activated": boolean -- Whether the customer has a password set or not
        "mobile_number": string - Masked mobile number
        "email": string - Masked email address
    }

Conditions: - If customer exists & activated is true - proceed to normal login - If customer exists & activated is false - proceed to account activation - If customer DOES NOT exist - proceed to account creation

2) Request Account Verification Use: Send an email/sms with an activation code to verify account ownership

    Endpoint: `/api/verify/activate`
    Method: `POST`
    Body: {
        "customer_id": number,
        "callback": string, - Only needed if using "email" as the send method
        "method": "email" || "sms"
    }
    Response: {
       "success": boolean,
       "message": string,
       "code":  "activate_code_sent" | "activate_link_sent" | "activate_code_error"
    }

Note: If sending via SMS - the code will be a 5-digit number - callback body parameter is the URL to prepend to the activation code in the sent email - activate_code_sent - returned when sending an SMS - activate_link_sent - returned when sending an email - activate_code_error - returned when sending an SMS code has failed - Email links expire in 24 hours - SMS codes expire in 1 hour

3A) Verify Activation Code - SMS Use: Verify a previously sent SMS account activation code

    Endpoint: `/api/verify/activate?code=:activation_code&customer_id=:customer_id`
    Method: `GET`
    Response: {
        "success": boolean
        "message": string,
        "send_method": "email" | "sms"
        "id": number - The ID is the customer ID this activation code was sent to
    }

3B) Verify Activation Code - Email Use: Verify an activation code sent via email - This would be the page the customer would be sent to from the email link, i.e. “https://somesite.somewhere.com/activate/:activation_code

    Endpoint: `/api/verify/activate?code=:activation_code`
    Method: `GET`
    Response: {
        "success": boolean
        "message": string,
        "send_method": "email" | "sms"
        "id": number - The ID is the customer ID this activation code was sent to
    }

4) Set a Password Use: Set a new password on a customer’s account once the activation code is validated

    Endpoint: `/api/account/activate`
    Method: `POST`
    Body: {
        "code": string - Activation code from previous step,
        "customer_id": number,
        "password": Customer's new password
    }
    Response: Base customer object