#vismaya_40545

1 messages · Page 1 of 1 (latest)

tender foxBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

queen plover
faint vector
#

req_45y0AvBs67rydh

faint vector
queen plover
#

there's no 400 error there

faint vector
#

I have created the session and there is no error.
What i am trying to do is display the end user about their verification request STATUS, right after their submission.
So i created a GET request
<?php
// Retrieve the session ID from the client-side
$sessionid = $_POST['sessionid'];

$stripe = new \Stripe\StripeClient($clientSecret);

try {
$verificationSession = $stripe->identity->verificationSessions->retrieve(
$sessionid,
[]
);

$status = $verificationSession->status;
echo json_encode(['status' => $status]);

} catch (\Stripe\Exception\ApiErrorException $e) {
// Handle errors, e.g., log the error or respond accordingly
echo 'Error: ' . $e->getMessage();
}

?>

#

This is giving me 400 error in my browser console

queen plover
#

which line specifically is erroring?

faint vector
#

verifyButton.addEventListener('click', function() {
// Get the VerificationSession client secret using the server-side endpoint you created
fetch('verify_identity.php', {
method: 'POST',
})
.then(function(response) {
return response.json();
})
.then(function(session) {
// Show the verification modal.
verify_sessionid = session.sessionid; // Assign the value here
clientSecret = session.clientSecret;

  // Verify identity using the client-side method
  return stripe.verifyIdentity(clientSecret);
})
.then(function(result) {
  if (result.error) {
    alert(result.error.message);
  } else {
    // Server-side verification using PHP
    return fetch('confirmation.php', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ sessionID: verify_sessionid}),
    });
  }
})
.then(function(response) {
  if (!response.ok) {
    throw new Error('Server error: ' + response.statusText);
  }
  return response.json();
})
.then(function(status) {
  // Handle the verification status as needed
  alert('Verification Status: ' + status.status);
  // You can redirect here if necessary
  // window.location.href = 'verificationresult.php?message=' + encodeURIComponent(status.status);
})
.catch(function(error) {
  console.error('Error:', error);
  // Handle the error appropriately, e.g., show an error message to the user
  alert('Error: ' + error.message);
});

});
</script>

This is my client side script.
The line where the fetch to confirmation.php is throwing the error.
The content of confirimation.php is the first code i sent you

queen plover
#

okay sure, but which line in confirmation.php specifically is causing the 400 error? You should at least step through your code to track down which line that the error is occurring at. If you don't know how to use the debugger, you can add logging to track down which line the issue is occurring at.