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);
}