代码之家  ›  专栏  ›  技术社区  ›  Joao Alves Marrucho

如何将触发交易的Paypal用户(前端)与IPN(后端)匹配?

  •  0
  • Joao Alves Marrucho  · 技术社区  · 6 年前

    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上下文未定义。

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

    1 回复  |  直到 6 年前
        1
  •  0
  •   Joao Alves Marrucho    6 年前

    在托管按钮类型上

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

    然后,IPN将包含名为custom的字段和您的用户Id