DocumentationAPI Reference
Help CenterAPI ChangelogOpenAPI SpecStatus
Documentation

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, status, fields }) => {
      // 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 cancelClient() { client.cancel(true); }
</script>
open()Use client.open() to show the embedded flow.
cancel(force: boolean)Use client.cancel(false) to transition to the cancel confirmation screen. Use client.cancel(true) to instantly hide the the embedded flow without displaying the cancel confirmation screen.