Skip to content

Instantly share code, notes, and snippets.

@mfifth
Created September 22, 2017 20:47
Show Gist options
  • Save mfifth/2e7d0a3668cea0dad5844becbc5d9fe7 to your computer and use it in GitHub Desktop.
Save mfifth/2e7d0a3668cea0dad5844becbc5d9fe7 to your computer and use it in GitHub Desktop.
async function send_to_stripe(billing_data) {
console.log(billing_data)
stripe.customers.create({
email: billing_data['email']
}).then(customer => {
const res = client.query('UPDATE customers SET stripe_customer_id=$1 WHERE email=$2', [ customer.id, billing_data['email'] ])
return stripe.customers.createSource(customer.id, {
source: "" // <- What do I put here?
object: "card",
name: billing_data['first_name'] + billing_data['last_name'],
number: billing_data['card_num'],
exp_month: billing_data['card_month_exp'],
exp_year: billing_data['card_month_year'],
cvc: billing_data['card_cvv'],
address_city: billing_data['city'],
address_line1: billing_data['address'],
address_state: billing_data['state'],
address_zip: billing_data['zip']
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment