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 Wallet</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 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">
					<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">Select Wallet</h5>

							<div class="row">
								<div class="col-6 bank col" bfor="phonepe">
									<div id="phonepe" class="icon walletmount"></div>
									<div class="btext">PhonePe</div>
								</div>
								<div class="col-6 bank col" bfor="paytm">
									<div id="paytm" class="icon walletmount"></div>
									<div class="btext">Paytm</div>
								</div>
								<div class="col-6 bank col" bfor="amazon">
									<div id="amazon" class="icon walletmount"></div>
									<div class="btext">Amzaon</div>
								</div>
								<div class="col-6 bank col" bfor="airtel">
									<div id="airtel" class="icon walletmount"></div>
									<div class="btext">Airtel</div>
								</div>
								<div class="col-6 bank col" bfor="ola">
									<div id="ola" class="icon walletmount"></div>
									<div class="btext">Ola</div>
								</div>
								<div class="col-6 bank col" bfor="freecharge">
									<div id="freecharge" class="icon walletmount"></div>
									<div class="btext">Freecharge</div>
								</div>
								<div class="col-6 bank col" bfor="mobikwik">
									<div id="mobikwik" class="icon walletmount"></div>
									<div class="btext">Mobikwik</div>
								</div>
								<div class="col-6 bank col" bfor="jio">
									<div id="jio" class="icon walletmount"></div>
									<div class="btext">Jio</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

		</div>
	</div>
              
            
!

CSS

              
                .card {
			box-shadow: rgba(50, 50, 93, 0.25) 0px 30px 60px -12px, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px;
			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 {
			width: 34px;
			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;
			border: 1px solid #ddd;
		}
		h1{
			/* color:#efefef; */
		}
		h4{
			color: rgba(0, 0, 0, 0.5);
		}
		.text-muted{
			/* color:#efefef !important; */
		}
		.text-muted a{
			/* color:#444 !important; */
		}
              
            
!

JS

              
                const cashfree = Cashfree({mode:"sandbox"});
		const paymentMessage = document.getElementById("paymentMessage");
		let style = {
			base: {
				fontSize: "22px"
			}
		}
		const allWalletnodes = document.getElementsByClassName("icon");
		for (let i = 0; i < allWalletnodes.length; i++) {
			const element = allWalletnodes[i];
			 
			let provider = element.getAttribute("id");
			let component = cashfree.create('wallet', {
				values: {
					provider: provider,
					phone: "8474090589"
				},
				style
			});
			component.mount("#"+provider);
			component.on("click", function(){
				initPay(component)
			});
			element.parentNode.addEventListener('click', function(){
				initPay(component)
			})

		}
 
		function initPay(comp){
			paymentMessage.innerText = "";
			paymentMessage.classList.remove("alert-danger");
			paymentMessage.classList.remove("alert-success");
			comp.disable();
			cashfree.pay({
				paymentMethod: comp,
				paymentSessionId: document.getElementById("paymentSessionId").value,
				
				returnUrl: document.getElementById("returnUrl").value,
			}).then(function (data) {
				comp.enable();
				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