Pen Settings



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


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


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.


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.


                <span class="payment-session">Payment Session Id:</span>  <input type="text" placeholder="payment_session" id="paymentSessionId" value="session_XaAxBAAZLPQa1-ppTvfwfCRh4nd4rpsHm99RBWBiN79fim_42A81DX94ADJ2LoQUyp4-Umz4DD-xDoY4C_55aj6f0M7Y-DuBG_RZ0meTYcpN" class="inputText">
  <p class="payment-session">Choose components</p> 
  <input class="drops" type="checkbox" value="order-details" checked>
  Order Details
  <input class="drops" type="checkbox" value="card" checked>
  <input class="drops" type="checkbox" value="upi">
  <input class="drops" type="checkbox" value="app">
  <input class="drops" type="checkbox" value="netbanking">
<input class="drops" type="checkbox" value="paylater">
<input class="drops" type="checkbox" value="credicardemi">
  Credit Card EMI
<input class="drops" type="checkbox" value="cardlessemi">
  Cardless EMI
<div class="style-container" style="display:none">
<p class="order-token">Style your Dropin</p> 
  <input class="style-dropin" type="text" 
   id="backgroundColor"      placeholder="Background Color"></input>
<input class="style-dropin" type="text"     id="theme" placeholder="Theme">
<input class="style-dropin" type="text"  id="color" placeholder="Color">
<input class="style-dropin" type="text"  id="errorColor" placeholder="Error Color">
<input class="style-dropin" type="text" id="fontSize" placeholder="Font Size">
<input class="style-dropin" type="text" id="fontFamily" placeholder="Font Family">
<button class="btn-render" onclick=render()>Render</button>
<div class="dropin-parent" id="drop_in_container">
  Your drop will come here


                body {
  text-align: center;
  font-family: 'Inter';
  margin: auto;

.order-token {
  font-weight: 600;

.inputText {
  width: 200px;
.btn-render {
      border-radius: 6px;
    background-color: rgb(105, 51, 211);
    color: rgb(255, 255, 255);
  border: none;
  font-size: 14px;
   padding: 11px 16px;
input {
  padding: 0.67857143em 1em;
  border-radius: 6px;
  border: 1px solid #979797;
input:focus {
  outline-color: rgb(105, 51, 211);

.style-dropin {
  outline: 0;
  border-width: 0 0 1px;
  border-radius: 0px;

.style-dropin:focus {
  border-color: rgb(105, 51, 211);

.style-container {
  margin-bottom: 8px;


                const cbs = function (data) {
  if (data.order && data.order.status == "PAID") {
    alert("order is paid. Call api to verify");
const cbf = function (data) {
  // alert(data.order.errorText)
function render() {
  let paymentSessionId = document.getElementById("paymentSessionId").value;
  let parent = document.getElementById("drop_in_container");
  if (paymentSessionId == "") {
    alert("No token specified");
  parent.innerHTML = "";

  const cashfree = new Cashfree(paymentSessionId);
  var checkedValue = [];
  var inputElements = document.getElementsByClassName("drops");
  for (var i = 0; inputElements[i]; ++i) {
    if (inputElements[i].checked) {
  if (checkedValue.length == 0) {
    alert("No drop in specified");
  var styleElements = document.getElementsByClassName("style-dropin");
  let style = {};
  for(var i=0;i<styleElements.length;i++) {
  if(styleElements[i].value) {
    style[styleElements[i].id] = styleElements[i].value;
  cashfree.drop(parent, {
    onSuccess: cbs,
    onFailure: cbf,
    components: checkedValue,
    style: style,