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

              
                <div class="container ">
		<div class="row">

			<div class="col  ">
				<div class="row">
					<h1>Demo of QR</h1>
				</div>
			</div>
			<hr>
			<div class="col offset-1 col-10">

			</div>
		</div>
		<div class="row">
			<div class="col col-lg-8 col-sm-12">
				<div class="row">
					<h4>Payment Session ID</h4>
					<div class="col">
						<textarea name="" id="paymentSessionId" class="form-control"></textarea>
						<span class="form-text ">Don't have a paymentSessionId? Get a sample one <a href="https://test.cashfree.com/pgappsdemos/sample-psi.php" target="_blank">here</a> for sandbox mode</span>
					</div>
				</div>
				
				<div class="row mt-4">
					<h4>Return URL <span class="badge h6 bg-danger">Required</span></h4>
					<div class="col">
						<textarea name="" id="returnUrl" class="form-control">https://test.cashfree.com/pgappsdemos/v3success.php?myorder={order_id}</textarea>
						<span class="form-text text-muted">Don't have a paymentSessionId? Get a sample one <a href="https://test.cashfree.com/pgappsdemos/sample-psi.php" target="_blank">here</a> for sandbox mode</span>
					</div>
				</div>
				<div class="row mt-4">
					<div class="col ">
						<p class="alert" id="paymentMessage">

						</p>
					</div>
				</div>
			</div>
			<div class="col col-lg-4 col-sm-10">
				<div class=" ">
					<div class="card" style="width: 18rem;">
						<div class="card-body pb-0">
							<h5 class="card-title">
								QR
								<button class="btn btn-primary btn-sm float-right" id="showqr" type="button">Show QR</button>
							</h5>

							<div class="">
								<div class="" bfor="qr">
									<div id="qr" class="icon qrmount"></div>
								</div>
								 
							</div>
						</div>
					</div>
				</div>
			</div>

		</div>
	</div>
              
            
!

CSS

              
                .card {
			 
			padding-bottom: 0px;
			border-radius: 14px;
			float: right;
		}

		.bank {
			text-align: center;
			padding: 20px;
			border-top: 1px solid #efefef;

		}

		.bank:nth-child(3) {
			border-right: 1px solid #efefef;
		}

		.bank:nth-child(1) {
			/* border-right: 1px solid #efefef; */
		}
		.bank:nth-child(5) {
			border-right: 1px solid #efefef;
		}
		.bank:nth-child(7) {
			border-right: 1px solid #efefef;
		}

		.icon {
			margin: 0 auto;
		}

		.btext {
			margin-top: 10px
		}

		.bank {
			cursor: pointer;
		}
		.gradient{
			background-image: linear-gradient( 83.2deg,  rgba(150,93,233,1) 10.8%, rgba(99,88,238,1) 94.3% );
		}
		.container{
			border-radius: 20px;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			padding: 20px;
			 
		}
		h1{
			/* color:#efefef; */
		}
		h4{
			color: rgba(0, 0, 0, 0.5);
		}
		.text-muted{
			/* color:#efefef !important; */
		}
		.text-muted a{
			color:#444 !important;
		}
		.float-right{
			float: right;
			margin-top: -4px;
		}
              
            
!

JS

              
                const paymentBtn = document.getElementById("showqr");
		const cashfree = Cashfree({mode: "sandbox"});
		const paymentMessage = document.getElementById("paymentMessage");
		let qr = cashfree.create("upiQr", {
				values: {
					size: "220px",
				}
			});
		qr.mount("#qr");
		qr.on('paymentrequested', function(){
			paymentBtn.disabled = true
		})
		paymentBtn.addEventListener("click", function(e){
			paymentMessage.innerText = "";

			paymentMessage.classList.remove("alert-danger");
			paymentMessage.classList.remove("alert-success");
			cashfree.pay({
				paymentMethod: qr,
				paymentSessionId: document.getElementById("paymentSessionId").value,
				
				returnUrl: document.getElementById("returnUrl").value,
			}).then(function (data) {
				paymentBtn.disabled = false
				if(data.error) {
					paymentMessage.innerHTML = data.error.message;
					paymentMessage.classList.add("alert-danger");
				}
				if(data.paymentDetails) {
					paymentMessage.innerHTML = data.paymentDetails.paymentMessage;
					paymentMessage.classList.add("alert-success");
				}
				if(data.redirect){
					console.log("We are redirtion");
				}
				 
			});
		})
              
            
!
999px

Console