When using the iframe embed option, generate a URL as per the steps outlined in the Configuration documentation.
Cross-frame communication (with tokenizeOnly)
tokenizeOnly)When the tokenize_only parameter is set to true, and the postmessage parameter to true, then your parent frame will receive an event, which you can subscribe with this code:
<script>
  window.paymentHost = "https://paynow.pmnts-sandbox.io";
var messageListener = function(event) {
  if (event.origin !== window.paymentHost) {
    return;
  }
  if ('data' in event === false) {
    return
  }
  switch (event.data.subject) {
    case "fz.click_to_pay.tokenization.success":
      // Handle successful tokenization.
    case "fz.click_to_pay.tokenization.error":
      // Handle tokenization error.
  }
};
window.addEventListener("message", messageListener)
</script>
The shape of the data is documented on the "Using tokenized cards" page.