Documentation

Web H5

Integration Steps

There are 3 steps to integrate the Liveness Detection Service.

  1. Request Generate URL API to get a signatureId and a url. ( Generate URL API)
  2. Integrate the Web SDK. ( H5)
  3. (Optionally) Receive the COMPLETED callback notification. ( Callback Notification)
  4. Request Get Result API to get the liveness score and its corresponding image with signatureId returned from step 1 as request parameter. ( Get Result API)

Integration FlowChart

sequenceDiagram
    participant CB as Customer's backend
    participant CA as Customer's App
    participant AH5 as AAI H5 Frontend
    participant AB as AAI backend
    participant ADB as AAI DB Log

    Note over CB,ADB: Phase 1: Generate Url

    CB->>AB: Request Signature ID, URL
    AB-->>CB: Signature ID, URL

    Note over CB,ADB: Phase 2: Liveness Detection

    CB->>CA: URL
    CA->>AH5: Start liveness detection
    activate AH5
    AH5->>AH5: Liveness checking
    AH5->>AB: Upload liveness data
    activate AB
    AB->>ADB: Store Liveness Result
    ADB-->>AB: stored

    %% 并发逻辑
    par Callback to customer
        AB-->>CB: POST callbackUrl (COMPLETED)
    and Frontend flow
        AB-->>AH5: send liveness result
        AH5->>AH5: check liveness result

        alt success
            AH5-->>CA: jump returnUrl
        else fail
            AH5-->>CA: jump failReturnUrl
        end
        deactivate AH5
    end
    deactivate AB

    Note over CB,ADB: Phase 3: Get Result

    CB->>AB: Get liveness result (Signature ID)
    activate AB
    AB->>ADB: Query Liveness Result
    ADB-->>AB: Liveness Result
    AB-->>CB: Liveness score + images
    deactivate AB

Backend Integration

Frontend Integration