以编程方式将电子邮件添加到Stripe Charge

时间:2019-07-29 03:50:50

标签: javascript node.js express stripe-payments payment-processing

我有以下代码处理表单中的POST:

app.post('/:advertorial/payment', async (req, res) => {
  const advertorial = req.params.advertorial
  const stripeToken = req.body.stripeToken

  stripe.charges.create({
    amount: COSTS.RESTBETTER_DILATOR_PRICE,
    currency: 'usd',
    description: `Example charge for ${new Date()}`,
    source: stripeToken,
    receipt_email: req.body.result.token.email,
    metadata: {
      'customer_email': req.body.result.token.email
    }
  }).then(
    function (result) { res.send(JSON.stringify(result)) },
    function (err) { res.json(err) }
  )
})

有趣的是,元数据可以很好地保存。根据{{​​3}}

另一方面,元数据片段似乎起作用:

documentation, receipt_email should be a field that I can include but in the resulting charge item in Stripe it is nowhere to be found

我在这里想念什么?

0 个答案:

没有答案