【问题标题】:How to match Paypal user that triggered transaction (frontend) to IPN (backend)?如何将触发交易(前端)的 Paypal 用户与 IPN(后端)匹配?
【发布时间】:2019-05-09 04:17:51
【问题描述】:

我正在使用 Paypal 托管的按钮来触发付款,然后像这样在 Google Cloud 功能上接收 IPN。

exports.ipn = functions.https.onRequest((req, res) => {
   var reqBody = req.body;
   let reqPaymentDate = reqBody.payment_date;
   admin.database().ref('transactions/' + reqPaymentDate).set(reqBody);
   res.sendStatus(200);
});

邮件正文不允许我知道我的 Firebase 注册用户中的哪一个触发了交易。该函数由 http 触发,因此 firebase 上下文未定义。

有没有办法知道在这种情况下是哪个用户触发了付款?

【问题讨论】:

    标签: firebase google-cloud-functions paypal-ipn


    【解决方案1】:

    在托管按钮类型上

    <input name="custom" value="<yourUserId>" type="hidden">
    

    IPN 将包含名为 custom 和您的用户 ID 的字段

    【讨论】:

      猜你喜欢
      • 2020-07-01
      • 2012-11-16
      • 1970-01-01
      • 1970-01-01
      • 2011-09-12
      • 2012-11-02
      • 2012-03-05
      • 2010-12-09
      • 2020-04-02
      相关资源
      最近更新 更多