Methods

Use the client's methods to show or hide the embedded flow.

<script src="https://cdn.withpersona.com/dist/persona-v3.4.1.js"></script>

<script>
  const client = new Persona.Client({
    templateId: "tmpl_JAZjHuAT738Q63BdgCuEJQre",
    environment: "sandbox",
    onComplete: inquiryId => {
      // Inquiry completed. Optionally tell your server about it.
      console.log(`Sending finished inquiry ${inquiryId} to backend`);
      fetch(`/server-handler?inquiry-id=${inquiryId}`);
    }
  });
  
  function openClient() { client.open(); }
  function exitClient() { client.exit(true); }
</script>
open()Use client.open() to show the embedded flow.
exit(force: boolean)Use client.exit(false) to transition to the exit confirmation screen. Use client.exit(true) to instantly hide the the embedded flow without displaying the exit confirmation screen.