-
-
Save devjaime/83be5bf730877501a3d1bcbf2275a7d8 to your computer and use it in GitHub Desktop.
index.js El código de la interfaz debe realizar una solicitud a la función de la nube para crear un cargo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Coinbase Demo</title> | |
| </head> | |
| <body> | |
| <button id="btn">Comprar cn Criptomonedas</button> | |
| <p id="pay"></p> | |
| <script> | |
| const btn = document.getElementById('btn'); | |
| const pay = document.getElementById('pay'); | |
| btn.onclick = async() => { | |
| const res = await fetch('https://us-central1-criptocoins.cloudfunctions.net/createCharge'); | |
| const data = await res.json(); | |
| console.log(data); | |
| pay.innerHTML = `<a href="${data.hosted_url}">Nuevo Pago!</a>` | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment