Blog

Data

JS

Sample data

Sample movie data

Ragav Kumar V

Ragav Kumar V

Jan 14, 2023 ยท 3 min read

Prebuilt Checkout page

index.html
style.css
Copy

_37
<!DOCTYPE html>
_37
<html>
_37
<head>
_37
<title>Buy cool new product</title>
_37
<link rel="stylesheet" href="style.css" />
_37
</head>
_37
<body>
_37
<section>
_37
<div class="card-content">
_37
<h2>
_37
Get <span class="insight">insights</span> that help your business
_37
grow.
_37
</h2>
_37
<p class="card-info">
_37
Discover the benefits of data analytics and make better decisions
_37
regarding revenue, customer experience, and overall efficiency.
_37
</p>
_37
_37
<div class="card-social-media">
_37
<div>
_37
<p class="card-count">10k+</p>
_37
<p>companies</p>
_37
</div>
_37
<div>
_37
<p class="card-count">314</p>
_37
<p>templates</p>
_37
</div>
_37
<div>
_37
<p class="card-count">12m+</p>
_37
<p>queries</p>
_37
</div>
_37
</div>
_37
</div>
_37
<div class="office-image"></div>
_37
</section>
_37
</body>
_37
</html>

Explore a full, working code sample of an integration with Stripe Checkout. The client- and server-side code redirects to a prebuilt payment page hosted on Stripe.

Before you get started, confirm the payment methods you want to offer in your payment method settings. We enable cards and other common payment methods for you by default, and we recommend that you enable additional payment methods that are relevant for your business and customers.

index.html
style.css
Copy

_37
<!DOCTYPE html>
_37
<html>
_37
<head>
_37
<title>Buy cool new product</title>
_37
<link rel="stylesheet" href="style.css" />
_37
</head>
_37
<body>
_37
<section>
_37
<div class="card-content">
_37
<h2>
_37
Get <span class="insight">insights</span> that help your business
_37
grow.
_37
</h2>
_37
<p class="card-info">
_37
Discover the benefits of data analytics and make better decisions
_37
regarding revenue, customer experience, and overall efficiency.
_37
</p>
_37
_37
<div class="card-social-media">
_37
<div>
_37
<p class="card-count">10k+</p>
_37
<p>companies</p>
_37
</div>
_37
<div>
_37
<p class="card-count">314</p>
_37
<p>templates</p>
_37
</div>
_37
<div>
_37
<p class="card-count">12m+</p>
_37
<p>queries</p>
_37
</div>
_37
</div>
_37
</div>
_37
<div class="office-image"></div>
_37
</section>
_37
</body>
_37
</html>

Install the Stripe ruby gem and require it in your code. Alternatively, if youโ€™re starting from scratch and need a Gemfile, download the project files using the link in the code editor.

Add an endpoint on your server that creates a Checkout Session. A Checkout Session controls what your customer sees on the payment page such as line items, the order amount and currency, and acceptable payment methods. We enable cards and other common payment methods for you by default, and you can enable or disable payment methods directly in the Stripe Dashboard.

index.html
style.css
Copy

_37
<!DOCTYPE html>
_37
<html>
_37
<head>
_37
<title>Buy cool new product</title>
_37
<link rel="stylesheet" href="style.css" />
_37
</head>
_37
<body>
_37
<section>
_37
<div class="card-content">
_37
<h2>
_37
Get <span class="insight">insights</span> that help your business
_37
grow.
_37
</h2>
_37
<p class="card-info">
_37
Discover the benefits of data analytics and make better decisions
_37
regarding revenue, customer experience, and overall efficiency.
_37
</p>
_37
_37
<div class="card-social-media">
_37
<div>
_37
<p class="card-count">10k+</p>
_37
<p>companies</p>
_37
</div>
_37
<div>
_37
<p class="card-count">314</p>
_37
<p>templates</p>
_37
</div>
_37
<div>
_37
<p class="card-count">12m+</p>
_37
<p>queries</p>
_37
</div>
_37
</div>
_37
</div>
_37
<div class="office-image"></div>
_37
</section>
_37
</body>
_37
</html>

index.html
style.css
Copy

_99
@import url("https://fonts.googleapis.com/css2?family=Lexend+Deca&display=swap");
_99
_99
:root {
_99
font-size: 15px;
_99
}
_99
_99
/* vh view height */
_99
/* vw view width 100vw - 541 */
_99
body {
_99
font-family: "Lexend Deca", sans-serif;
_99
/* background: hsl(233, 47%, 7%); */
_99
background-image: linear-gradient(
_99
to right top,
_99
#051937,
_99
#33275d,
_99
#6f2d78,
_99
#b12681,
_99
#f01a78
_99
);
_99
display: flex;
_99
height: 100vh;
_99
align-items: center;
_99
justify-content: center;
_99
}
_99
.insight {
_99
color: hsl(277, 64%, 61%);
_99
}
_99
_99
.office-image {
_99
background: url(https://www.incimages.com/uploaded_files/image/1920x1080/getty_533979847_128300.jpg),
_99
hsl(277, 64%, 61%);
_99
min-height: 20rem;
_99
width: 100%;
_99
background-size: cover;
_99
background-blend-mode: luminosity;
_99
background-overflow: hidden;
_99
/* width: 100px; */
_99
}
_99
.card-info {
_99
font-size: 0.8rem;
_99
}
_99
_99
section {
_99
display: flex;
_99
background: hsl(244, 38%, 16%);
_99
color: hsl(0, 0%, 100%);
_99
border-radius: 2rem;
_99
overflow: hidden;
_99
flex-direction: column-reverse;
_99
text-align: center;
_99
}
_99
_99
.card-content {
_99
padding: 2rem;
_99
}
_99
_99
.card-social-media {
_99
display: flex;
_99
flex-direction: column;
_99
justify-content: space-between;
_99
align-items: center;
_99
}
_99
_99
.card-count {
_99
font-size: 1.3rem;
_99
font-weight: bold;
_99
margin-bottom: 5px;
_99
_99
background: linear-gradient(to left, hsl(277, 64%, 61%) 10%, #30cfd0);
_99
_99
-webkit-background-clip: text;
_99
-webkit-text-fill-color: transparent;
_99
}
_99
_99
.card-count + p {
_99
text-transform: uppercase;
_99
font-size: 0.8rem;
_99
font-weight: 100;
_99
margin: 0px;
_99
}
_99
_99
/* Responsive layout */
_99
/* 475px - breakpoint */
_99
@media (min-width: 600px) {
_99
section {
_99
flex-direction: row;
_99
text-align: left;
_99
}
_99
_99
.office-image {
_99
background: url(https://www.incimages.com/uploaded_files/image/1920x1080/getty_533979847_128300.jpg),
_99
orchid;
_99
background-size: cover;
_99
}
_99
_99
.card-social-media {
_99
flex-direction: row;
_99
}
_99
}

Always keep sensitive information about your product inventory, such as price and availability, on your server to prevent customer manipulation from the client. Define product information when you create the Checkout Session using predefined price IDs or on the fly with price_data.

Prebuilt Checkout page

Explore a full, working code sample of an integration with Stripe Checkout. The client- and server-side code redirects to a prebuilt payment page hosted on Stripe.

Before you get started, confirm the payment methods you want to offer in your payment method settings. We enable cards and other common payment methods for you by default, and we recommend that you enable additional payment methods that are relevant for your business and customers.

Install the Stripe ruby gem and require it in your code. Alternatively, if youโ€™re starting from scratch and need a Gemfile, download the project files using the link in the code editor.

Add an endpoint on your server that creates a Checkout Session. A Checkout Session controls what your customer sees on the payment page such as line items, the order amount and currency, and acceptable payment methods. We enable cards and other common payment methods for you by default, and you can enable or disable payment methods directly in the Stripe Dashboard.

Always keep sensitive information about your product inventory, such as price and availability, on your server to prevent customer manipulation from the client. Define product information when you create the Checkout Session using predefined price IDs or on the fly with price_data.

index.html
style.css
CopyExpandClose

_37
<!DOCTYPE html>
_37
<html>
_37
<head>
_37
<title>Buy cool new product</title>
_37
<link rel="stylesheet" href="style.css" />
_37
</head>
_37
<body>
_37
<section>
_37
<div class="card-content">
_37
<h2>
_37
Get <span class="insight">insights</span> that help your business
_37
grow.
_37
</h2>
_37
<p class="card-info">
_37
Discover the benefits of data analytics and make better decisions
_37
regarding revenue, customer experience, and overall efficiency.
_37
</p>
_37
_37
<div class="card-social-media">
_37
<div>
_37
<p class="card-count">10k+</p>
_37
<p>companies</p>
_37
</div>
_37
<div>
_37
<p class="card-count">314</p>
_37
<p>templates</p>
_37
</div>
_37
<div>
_37
<p class="card-count">12m+</p>
_37
<p>queries</p>
_37
</div>
_37
</div>
_37
</div>
_37
<div class="office-image"></div>
_37
</section>
_37
</body>
_37
</html>

@ragavkumarv
swipe to next โžก๏ธ