Cannot test KBA in sandbox

Dear concern,

I am trying to retrieve KBA questions in the sandbox environment.

I created users with kba as the first name. Then initiated a session and requested to retrieve the questions. But sometimes I get the questions, sometimes I am getting the following response:

The kba session is no longer valid.

When I try the second time, I get:

Customer verification status is not valid for kba.

I can see that the customer status is changed from kba to document. I have uploaded documents, but the customer status doesn’t change after document submission.

Here is my sample code:

<?php

try {
    /** @var User $user */
    $user = auth()->user();
    
    $customerApi = new CustomersApi();
    $response = $customerApi->initiateKba($user->dwolla_customer_id);
    $split = explode('/', $response);
    $kbaSessionId = end($split);
    
    $kbaApi = new KbaApi();
    $questions = $kbaApi->getQuestions($kbaSessionId);
    
    return $this->respondWithSuccess('KBA questions loaded.', $questions);
} catch (ApiException $e) {
    $errorResponse = json_decode($e->getResponseBody());
    
    if (isset($errorResponse->_embedded)) {
        $errorMessage = $errorResponse->_embedded->errors[0]->message;
    } else {
        $errorMessage = $errorResponse->message;
    }
    
    return $this->respondWithError($errorMessage);
}

Hi @SumonMSelim – thanks for posting!

The kba session is no longer valid.

This error is thrown when the current KBA session has expired. This places the them into a document status.

I can see that the customer status is changed from kba to document . I have uploaded documents, but the customer status doesn’t change after document submission.

In Sandbox, you’d have to upload one of the sample documents that wee provide in order to automatically simulate approved or rejected status for a document. Please make sure you’re using one of those documents listed in this guide - https://developers.dwolla.com/guides/sandbox#testing-customers

Hope that helps!

1 Like