Skip to content

Commit 9e2337c

Browse files
Stripe Integration and updated favicon
1 parent e0f27bb commit 9e2337c

File tree

9 files changed

+68
-8748
lines changed

9 files changed

+68
-8748
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"react-redux": "^7.2.0",
1111
"react-router-dom": "^5.2.0",
1212
"react-scripts": "2.1.8",
13+
"react-stripe-checkout": "^2.6.3",
1314
"redux": "^4.0.5",
1415
"redux-logger": "^3.0.6",
1516
"redux-persist": "^6.0.0",

public/favicon.ico

11.3 KB
Binary file not shown.

public/index.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&display=swap" rel="stylesheet">
5-
<meta charset="utf-8" />
6-
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
7-
<meta
8-
name="viewport"
9-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
10-
/>
11-
<meta name="theme-color" content="#000000" />
12-
<!--
3+
4+
<head>
5+
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght@300&display=swap" rel="stylesheet">
6+
<meta charset="utf-8" />
7+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
8+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
9+
<meta name="theme-color" content="#000000" />
10+
<!--
1311
manifest.json provides metadata used when your web app is installed on a
1412
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1513
-->
16-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
17-
<!--
14+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
15+
<!--
1816
Notice the use of %PUBLIC_URL% in the tags above.
1917
It will be replaced with the URL of the `public` folder during the build.
2018
Only files inside the `public` folder can be referenced from the HTML.
@@ -23,12 +21,13 @@
2321
work correctly both with client-side routing and a non-root public URL.
2422
Learn how to configure a non-root public URL by running `npm run build`.
2523
-->
26-
<title>React App</title>
27-
</head>
28-
<body>
29-
<noscript>You need to enable JavaScript to run this app.</noscript>
30-
<div id="root"></div>
31-
<!--
24+
<title>ECOM-AK</title>
25+
</head>
26+
27+
<body>
28+
<noscript>You need to enable JavaScript to run this app.</noscript>
29+
<div id="root"></div>
30+
<!--
3231
This HTML file is a template.
3332
If you open it directly in the browser, you will see an empty page.
3433
@@ -38,5 +37,6 @@
3837
To begin the development, run `npm start` or `yarn start`.
3938
To create a production bundle, use `npm run build` or `yarn build`.
4039
-->
41-
</body>
42-
</html>
40+
</body>
41+
42+
</html>

src/Pages/checkout/checkout.component.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react'
33
import { connect } from 'react-redux'
44
import { createStructuredSelector } from 'reselect'
55
import CheckoutItem from '../../components/checkout-item/checkout-item.component'
6-
6+
import StripeButton from '../../components/stripe-button/stripe-button.component'
77
import { selectCartItems, selectCartTotal } from '../../redux/cart/cart.selectors'
88

99
import './checkout.styles.scss'
@@ -36,6 +36,11 @@ function CheckoutPage({ cartItems, total }) {
3636
<div className="total">
3737
<span>Total= ${total}</span>
3838
</div>
39+
<div className="test-warning">
40+
Please use any data for address and name and email, also use <br />
41+
card number: 4242 4242 4242 4242, expiry: 02/22, cvv: 123 for dummy payment
42+
</div>
43+
<StripeButton price={total} />
3944
</div>
4045
)
4146
}

src/Pages/checkout/checkout.styles.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@
2828
margin-left: auto;
2929
font-size: 36px;
3030
}
31+
button {
32+
margin-left: auto;
33+
margin-top: 50px;
34+
}
35+
.test-warning {
36+
margin-top: 20px;
37+
color: red;
38+
}
3139
}

src/components/collection-item/collection-item.styles.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
}
1919

2020
.image {
21-
width: 100%;
21+
width: 22vw;
2222
height: 95%;
2323
background-size: cover;
2424
background-position: center;
2525
margin-bottom: 5px;
26+
overflow: hidden;
2627
}
2728
.custom-button {
2829
width: 80%;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react'
2+
import StripeCheckout from 'react-stripe-checkout'
3+
4+
export default function StripeButton({ price }) {
5+
const priceForStripe = price * 100
6+
const publishableKey = 'pk_test_51Hcr59If3Hn5BLfLNdteyaTLDzz6Sf4g9CMEK21WZm7BHjEXbVLl2uqXNK4b9Gex3GBZrZTiP2aqV5QkncN7uasa001eoP4pJr'
7+
8+
const onToken = token => {
9+
console.log(token)
10+
alert("dummy payment successfull")
11+
}
12+
return (
13+
<StripeCheckout
14+
label="Pay Now"
15+
name='AK Clothing Ltd.'
16+
billingAddress
17+
shippingAddress
18+
image='https://svgshare.com/i/QaG.svg'
19+
description={`Your total is ${price}`}
20+
amount={priceForStripe}
21+
panelLabel="Pay Now"
22+
token={onToken}
23+
stripeKey={publishableKey}
24+
/>
25+
)
26+
}

0 commit comments

Comments
 (0)