Skip to content

Instantly share code, notes, and snippets.

@fsjuhl
Last active January 25, 2019 00:37
Show Gist options
  • Save fsjuhl/132e438b55ce3022ef86e20f9d8aec45 to your computer and use it in GitHub Desktop.
Save fsjuhl/132e438b55ce3022ef86e20f9d8aec45 to your computer and use it in GitHub Desktop.
Go follow me on twitter: https://twitter.com/fsjuhl - Instructions: 1) npm i request uuid 2) Change config 3) node amnotify.js
const request = require("request")
const uuid = require("uuid/v4")
const config = {
"domain": "amnotify.com", // "amnotify.com" or "canada.amnotify.com"
"name": "",
"email": "",
"card": {
"number": 1234123412341234,
"cvc": 123,
"exp_month": 12,
"exp_year": 23,
"address_zip": 55555
},
"stripe_key": "pk_live_sD8fSaI91Fm2ql9tWfC2AMfL",
"delay": 3000
}
async function generatetoken() {
return new Promise(resolve => {
request.post("https://api.stripe.com/v1/tokens", {
form: {
"card": config.card,
"guid": uuid(),
"muid": uuid(),
"sid": uuid(),
"payment_user_agent": "stripe.js/0ab7fa6f; stripe-js-v3/0ab7fa6f",
"key": confirm.stripe_key,
"referrer": `https://${config.domain}/purchase`
}
}, (err, res, body) => {
resolve(JSON.parse(body))
})
})
}
async function charge() {
console.log("Attempting to submit payment...")
request.post(`https://${config.domain}/api/stripe/charge`, {
json: {
"email": config.email,
"name": config.name,
"token": {
"token": await generatetoken()
}
},
headers: {
"am-powered": "67C48EE60B4D0CD65EF6EFFBDE900D7796F4B5311ABBD13F8CD8600288282BB7" // idk probably some random shit doggy implemented to look cool
}
}, (err, res, body) => {
console.log(err, body)
})
}
function check() {
request.get(`https://${config.domain}/api/stock/available`, (err, res, body) => {
if (err) {
console.log(err)
}
console.log(body)
const json = JSON.parse(body)
if (json.available) {
charge()
}
})
}
setInterval(check, config.delay)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment