Skip to content

Commit 0376911

Browse files
committed
v0.2.8
1 parent 4bc37c5 commit 0376911

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
stripe-keys.js
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict'
2+
3+
// Importaciones de la STRIPE_KEYS
4+
import STRIPE_KEYS from './stripe-keys.js';
5+
6+
const d = document;
7+
const $courses = d.getElementById('courses');
8+
const $template = d.getElementById('course-template').content;
9+
const $fragment = d.createDocumentFragment();
10+
11+
// Peticion para obtener los datos como nombre, descripcion , imagenes de los cursos
12+
fetch("https://api.stripe.com/v1/products",{
13+
headers: {
14+
Authorization: `Bearer ${STRIPE_KEYS.secret}`
15+
}
16+
})
17+
.then(response => response.json())
18+
.then(json=>{
19+
json.data.forEach(course =>{
20+
console.log(course);
21+
});
22+
23+
// $courses.appendChild($clone);
24+
})
25+
26+
// Peticion para obtener los precios de los cursos
27+
fetch("https://api.stripe.com/v1/prices",{
28+
headers: {
29+
Authorization: `Bearer ${STRIPE_KEYS.secret}`
30+
}
31+
})
32+
.then(response => response.json())
33+
.then(json=>{
34+
json.data.forEach(course =>{
35+
console.log(course);
36+
});
37+
// $courses.appendChild($fragment);
38+
})
39+
40+
// $template.querySelector('img').setAttribute("src", `${course.images[0]}`);
41+
// $template.querySelector('.tittle').textContent = course.name;
42+
// $template.querySelector('.subtittle').textContent = course.description;
43+
// $fragment.appendChild($template);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'
2+
3+
// Exportamos nuestras llaves publicas y secreta
4+
5+
// ATENCION : POR CUESTIONES DE SEGURIDAD NO SUBIRE MIS KEYS USTEDES DEBEN PONER SUS PROPIAS KEY EN EL SIGUIENTE LINK => https://dashboard.stripe.com/test/apikeys
6+
export default {
7+
public : "Your public Stripe key here!!!",
8+
secret : "Your secret Stripe key here!!!"
9+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Checkout with Stripe</title>
8+
</head>
9+
<body>
10+
<h1>Checkout with Stripe</h1>
11+
<section class="courses" id="courses">
12+
13+
</section>
14+
<template id="course-template">
15+
<figure class="course">
16+
<img>
17+
<figcaption>
18+
<h2 class="tittle"></h2>
19+
<h4 class="subtittle"></h4>
20+
</figcaption>
21+
</figure>
22+
</template>
23+
24+
<!-- Importamos la libreria de Stripe Js -->
25+
<script src="https://js.stripe.com/v3/"></script>
26+
27+
<!-- Importamos nuestro script para manejar el stripe-->
28+
<script type="module" src="./assets/stripe-checkout.js"></script>
29+
30+
</body>
31+
</html>

0 commit comments

Comments
 (0)