-
-
Save isaacs/084d4e0755e2463cded4ab5288b8ae1e to your computer and use it in GitHub Desktop.
This file contains 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
const apiKey = {{ stripe test private key goes here }} | |
const html = ` | |
<!doctype html> | |
<html> | |
<head> | |
<script type="module"> | |
import { Tier } from 'https://unpkg.com/tier@5.0.3/dist/mjs/client.js' | |
const tier = new Tier({ | |
apiKey: ${JSON.stringify(apiKey)}, | |
baseURL: 'https://api.tier.run', | |
}) | |
tier.whoami().then(result => { | |
document.body.innerHTML = '<pre>' + JSON.stringify(result) + '</pre>' | |
}).catch(er => { | |
document.body.innerHTML = '<pre>' + String(er) + '\\n(probably cors related)</pre>' | |
}) | |
</script> | |
<body>fetching whoami...</body> | |
` | |
require('http').createServer((_req, res) => { | |
res.setHeader('content-type', 'text/html') | |
res.end(html) | |
}).listen(8080, () => console.log('http://localhost:8080/')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if api.tier.run had CORS setup to allow localhost:8080, this would work