How to use the stripe.initialize function in stripe

To help you get started, we’ve selected a few stripe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github green-bot / greenbot-core / kisst / cloud / app.js View on Github external
app.post('/new_order', function (req, res) {
  console.log('Entered new_order function ')
  console.log(req.body)
  var token_info = req.body

  Stripe.initialize('sk_live_CDYuW7Nsp4dtyKXT7ifjZ47q')
  Stripe.Customers.create({
    source: token_info.id,
    plan: token_info.plan_id,
    email: token_info.email,
    metadata: {
      owner_cell: token_info.owner_cell
    }
  }, {
    success: function (httpResponse) {
      console.log('Subscription successfully performed')
      res.send('Success')
    },
    error: function (httpResponse) {
      console.log(JSON.stringify(httpResponse.body, null, 4))
      res.send('Uh oh, something went wrong')
    }