Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>

<head>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
<meta charset="UTF-8">
</head>

<body>
  <div>
    <div id="embeddedComponentStyle">
      <h4>Add Payment Method</h4>
      <div class="tabs">
        <ul class="nav nav-tabs" id="tabs" role="tablist">
          <li class="nav-item" role="presentation">
            <a class="nav-link active" id="card-tab" data-bs-toggle="tab" data-bs-target="#pay-component-card-cont" role="tab" aria-controls="pay-component-card-cont" aria-selected="true">Payment Card</a>
          </li>
          <li class="nav-item" role="presentation">
            <a class="nav-link" id="bank-tab" data-bs-toggle="tab" data-bs-target="#pay-component-ach-cont" role="tab" aria-controls="pay-component-ach-cont" aria-selected="false">Bank Debit</a>
          </li>
        </ul>
      </div>
      <div class="payment-form tab-content">
        <div class="tab-pane fade show active" id="pay-component-card-cont" role="tabpanel" aria-labelledby="pay-component-card-cont">
          <div id="pay-component-card">

          </div>
          <button id="btn-pay" class="mt-20">
            <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAPxJREFUSEvtldGNwjAMhr9/AnQTAJNwbMAG9CZATAC3ARvABjACN8mVDW4DI6Mg9VqStEWVeMAvjSrb3x8ndsTApoHz0wpgZgtgBXwGQWfgW5J/k5YFmNkBWEayOGSbIiQBQfkxJFgDp7AugE1Yz1M7yQG8BDNgLWlXVWpmrtwhP5LupWtsJgewEPEh6a8GmAC//k9SNE8rQCyBmd0EDAbI3aAbPOXURmEO0gCYmR/YHvAad7ES+KrfqEcAdxx3yVzxLSVNq7GPAPeb04tRP/A3oNm5taZ7l+g1S+RTc9SrCeAi6d8EiI0Kf8W6dvMFKLKjoqfyaFj2TX4WeAX0MmsZ8nx06AAAAABJRU5ErkJggg==" />
            Save Payment
          </button>
        </div>
      </div>
    </div>
  </div>
  <script src="https://embedded-component-sandbox.payabli.com/component.js" data-test></script>

</body>

</html>
              
            
!

CSS

              
                body {
  font-family: Arial, Helvetica, sans-serif;
}

#payabliComponentsIframeContainerMethodEmbeded iframe {
  border: solid 1px rgba(255, 255, 255, 0);
  width: 90%;
}

#embeddedComponentStyle label {
  font-size: 13px;
  display: inline-block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #707070;
  text-transform: uppercase;
}

#embeddedComponentStyle button {
  background-image: -webkit-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
  background-image: -moz-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
  background-image: -ms-linear-gradient(0deg, #7121ff 0%, #21d4fd 100%);
  border: none;
  padding: 10px 20px;
  color: #ffffff;
  font-size: 13px;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  font-size: 12px;
  padding: 15px 30px;
  border-radius: 5px;
  width: 100%;
}

#embeddedComponentStyle {
  display: block;
  width: 500px;
  margin: 50px auto;
  border: solid 2px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 25px 25px;
  background-color: rgb(255, 255, 255);
}

#embeddedComponentStyle .payment-form {
  background-color: #f0f0f0;
  padding: 20px 25px;
  margin: 0 -25px;
}

#embeddedComponentStyle .text-center {
  text-align: center;
}

#embeddedComponentStyle h4 {
  color: #707070;
  font-size: 16px;
  margin-top: 0px;
}

#embeddedComponentStyle .mt-20 {
  margin-top: 20px;
}

#embeddedComponentStyle .text-blue {
  color: #008bce;
}

#embeddedComponentStyle button img {
  vertical-align: middle;
  width: 17px;
  height: 17px;
  opacity: 1;
  margin-right: 8px;
}

#embeddedComponentStyle .tabs {
  margin: 0 -25px;
}

#embeddedComponentStyle .tabs a {
  color: #707070;
  text-decoration: none;
  padding: 0 20px 14px 20px;
  font-size: 12px;
  display: inline-block;
  border-bottom: solid 3px transparent;
  width: 42%;
  text-align: center;
  cursor: pointer;
}

#embeddedComponentStyle .tabs a.active {
  color: #008bce;
  border-bottom: solid 3px #008bce;
}

#embeddedComponentStyle .input-checkbox {
  vertical-align: middle;
  width: 22px;
  height: 22px;
  color: rgb(12, 96, 188);
}

#embeddedComponentStyle .payment-info {
  border-bottom: solid 1px rgb(230, 230, 230);
  padding: 14px 0 10px 0;
  margin: 0 -25px;
}

iframe {
  border: solid 1px transparent;
}

#tabs .nav-item a {
  width: auto !important;
  padding: 10px 20px;
}

.hidden {
  display: none;
}

              
            
!

JS

              
                var token =
  "o.z8j8aaztW9tUtUg4dlVeYAx+L2MazOFGr0DY8yuK3u79MCYlGK4/q0t5AD1UgLAjXOohnxN8VTZfPswyZcwtChGNn1a8jFMmYWHmLN2cPDW9IrBt1RtrSuu+85HJI+4kML5sIk9SYvULDAU2k0X0E1KFYcPwjmmkUjktrEGtz48XCUM70aKUupkrTh8nL7CXpAXATzVUZ2gEld9jGINwECPPLWmu+cZ4CJb7QMJxnzKFD073+nq/eL+pMth7+u/SkmAWC0+jn8y+Lf6T5Q5PqB6wN7Mvosp8g7U7lbEW2wC0DA92pjblfDHVJOQUkjgT7B1GvryMokLvBjoiaLhKa55iKZE1YDlyqruILkoNF+zGSPS9r17qU6w4ziKhoMdSPzPBJBlLhQhz3MVANXbjfEfJwmtr/JJ1uStUfBFJ710cS1x7goxMJO/cl+q+LVtPy788EKFkgMc5OjfBNCsNL+dBDVbK5CiIJUSbOFzdqdjY/VJ14MEodsHYOwMAjuF4.KRFMeEj0SOur8MLZ362c/UZ/U/Az3CSUkr3/8EVDE6Y=";
var entryPoint = "bozeman-aikido";
var customCssUrl = "https://embedded-component-sandbox.payabli.com/customForm.css";
var payabliConfigCard = {
  type: "methodEmbedded",
  rootContainer: "pay-component-card",
  defaultOpen: "card",
  token: token,
  customCssUrl: customCssUrl,
  entryPoint: entryPoint,
  card: {
    enabled: true,
    amex: false,
    discover: true,
    visa: true,
    mastercard: true,
    inputs: {
      //here we are customizing the input fields
      cardHolderName: {
        label: "NAME ON CARD",
        placeholder: "",
        floating: false,
        value: "John Doe",
        size: 12,
        row: 0,
        order: 0
      },
      cardNumber: {
        label: "CARD NUMBER",
        placeholder: "1234 1234 1234 1234",
        floating: false,
        size: 6,
        row: 1,
        order: 0
      },
      cardExpirationDate: {
        label: "EXPIRATION DATE",
        placeholder: "MM/YY",
        floating: false,
        size: 6,
        row: 1,
        order: 1
      },
      cardCvv: {
        label: "CVV/CVC",
        placeholder: "CVV/CVC",
        floating: false,
        size: 6,
        row: 2,
        order: 0
      },
      cardZipcode: {
        label: "ZIP/POSTAL CODE",
        placeholder: "Zip/Postal Code",
        floating: false,
        size: 6,
        row: 2,
        order: 1,
        country: ["us", "ca"]
      }
    }
  },
  ach: {
    enabled: false
  },
  customerData: {
    customerNumber: "00001",
    firstName: "John",
    lastName: "Doeee",
    billingEmail: "johndoe@email.com"
  },
  functionCallBackSuccess: function (response) {
    alert("card success");
    // paycomponentCard.removeListener();
    paycomponentCard.payabliExec("reinit");
  },
  functionCallBackReady: function (data) {},
  functionCallBackError: function (errors) {
    alert("Error!");
    console.log(errors);
  }
};

var payabliConfigACH = {
  type: "methodEmbedded",
  entryPoint: entryPoint,
  rootContainer: "pay-component-card",
  defaultOpen: "ach",
  token: token,
  customCssUrl: customCssUrl,
  customerData: {
    customerNumber: "00001",
    firstName: "John",
    lastName: "Doe",
    billingEmail: "johndoe@email.com"
  },
  card: {
    enabled: false
  },
  ach: {
    enabled: true,
    checking: true,
    savings: true,
    inputs: {
      achAccountHolderName: {
        label: "ACCOUNTHOLDER NAME",
        floating: false,
        size: 6,
        row: 0,
        order: 0
      },
      achAccountType: {
        label: "ACCOUNT TYPE",
        floating: false,
        size: 6,
        row: 0,
        order: 1
      },
      achRouting: {
        label: "ROUTING NUMBER",
        floating: false,
        size: 6,
        row: 1,
        order: 0,
        confirm: true // Confirm routing number
      },
      achAccount: {
        label: "ACCOUNT NUMBER",
        floating: false,
        size: 6,
        row: 1,
        order: 1,
        confirm: true // Confirm account number
      }
    }
  },
  

  functionCallBackSuccess: function (response) {
    alert("ach");
    // paycomponentCard.payabliExec('reinit');
  },
  functionCallBackError: function (errors) {
    console.log(errors);
  },
  functionCallBackReady: function (data) {}
};

var paycomponentCard = new PayabliComponent(payabliConfigCard);

function executeActionCard() {
  paycomponentCard.payabliExec("pay", {
    paymentDetails: {
      totalAmount: 100,
      serviceFee: 0,
      categories: [
        {
          label: "payment",
          amount: 100,
          qty: 1
        }
      ]
    }
  });
}

let cardTab = document.getElementById("card-tab");
let bankTab = document.getElementById("bank-tab");
let payBtn = document.getElementById("btn-pay");

cardTab.addEventListener("click", function () {
  paycomponentCard.updateConfig(payabliConfigCard);
});

bankTab.addEventListener("click", function () {
  paycomponentCard.updateConfig(payabliConfigACH);
});

payBtn.addEventListener("click", () => {
  paycomponentCard.payabliExec("pay", {
    paymentDetails: {
      totalAmount: 100,
      serviceFee: 0,
      categories: [
        {
          label: "payment",
          amount: 100,
          qty: 1
        }
      ]
    }
  });
});

              
            
!
999px

Console