Click to Pay - iFrame Embed

When using the iframe embed option, generate a URL as per the steps outlined in the Configuration documentation.

Cross-frame communication (with 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:

  window.paymentHost = "";

var messageListener = function(event) {
  if (event.origin !== window.paymentHost) {

  if ('data' in event === false) {

  switch ( {
    case "fz.click_to_pay.tokenization.success":
      // Handle successful tokenization.
    case "fz.click_to_pay.tokenization.error":
      // Handle tokenization error.

window.addEventListener("message", messageListener)

The shape of the data is documented on the "Using tokenized cards" page.