APP ID
Secret Key
Harmony Clean Pro
Simple Card Payment Example

Harmony Clean Pro

₹1.00

Introducing the Harmony Clean Pro — a revolutionary washing machine that turns noise into a symphony of efficiency. With its unique and vibrant character, this noisy washing machine is here to redefine your laundry experience like never before..

PCI Compliant   Secured   Customizable


visa 4111 1111 1111 1111

You will need a payment_session_id to try out this code. Search for yourPaymentSession and replace with yours.

1
<!DOCTYPE html>
2
<html lang="en">
3
	
4
	<head>
5
		<meta charset="UTF-8">
6
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
7
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
8
		<title>Document</title>
9
		<script src="https://sdk.cashfree.com/js/v3/cashfree.js"></script>
10
	</head>
11

12
	<body>
13
	
14
		<div id="cardNumber" />
15
		<div id="cardCvv" />
16
		<div id="cardExpiry" />
17
		<div id="cardHolder" />
18
	<input type="button" id="payBtn" value="Pay" />
19
	<script>
20
		
21
		const cashfree = await load({ 
22
			mode: "sandbox", //or production
23
		});
24

25
		const cardComponent = cashfree.create("cardNumber", {});
26
		cardComponent.mount("#cardNumber");
27

28
		const cardCvv = cashfree.create("cardCvv", {});
29
		cardCvv.mount("#cardCvv");
30

31
		const cardExpiry = cashfree.create("cardExpiry", {});
32
		cardExpiry.mount("#cardExpiry");
33

34
		const cardHolder = cashfree.create("cardHolder", {});
35
		cardHolder.mount("#cardHolder");
36

37
		const showError = function(e){
38
			alert(e.message)
39
		}
40

41
		document.querySelector("#payBtn").addEventListener("click", async () => {
42
			cashfree.pay({
43
				paymentMethod: cardComponent,
44
				paymentSessionId: "yourPaymentSession",
45
				returnUrl: "https://merchantsite.com/return?order_id={order_id}",
46
			}).then(function (data) {
47
				if (data != null && data.error) {
48
					return showError(data.error)
49
				}
50
			});
51
		})
52
		</script>
53
	</body>
54
</html>
55

The site is built using the Brutopia theme. Get it for free here