简体   繁体   English

识别谁进行购买PayPal-IPN

[英]Identify who made the purchase PayPal - IPN

I am developing a Twitter web app in which users can buy packages of coins. 我正在开发一个Twitter Web应用程序,用户可以在其中购买硬币包。

Once they click on a paypal button and wants to checkout, they are directred to enter their credentials and finalize the paypal. 一旦他们单击贝宝按钮并想要结帐,就被指示输入凭据并完成贝宝结算。 The PayPal server will then in turn send a HTTP to a backend servlet of mine (Im doing this in Java) with info about the transaction. 然后,PayPal服务器将发送HTTP到我的后端Servlet(我在Java中是这样做的),其中包含有关交易的信息。

My problem here is that how do I know which user made the purchase? 我的问题是,我如何知道哪个用户进行了购买? The thing is, the IPN message sent by the PayPal server contains a set of predefined parameters from their side. 事实是,贝宝服务器发送的IPN消息从它们的侧面包含一组预定义的参数。 This means that I can not really identify which user made the payment! 这意味着我无法真正确定哪个用户付款了!

Since this is a twitter application, no username/email/password is needed to register for the website. 由于这是一个Twitter应用程序,因此不需要用户名/电子邮件/密码即可注册该网站。

All I need and want is a way to send the dbUserId of the user that is making the purchase to the paypal IPN request so that once PayPal sends the IPN POST I know who made the purchase and thus add the coins to his/her record. 我需要和想要的是一种将要购买的用户的dbUserId发送到Paypal IPN请求的方法,这样,一旦PayPal发送IPN POST,我就知道是谁进行了购买,从而将硬币添加到他/她的记录中。

I need all help please. 我需要所有帮助。

Thanks 谢谢

You can send your ID value in the "custom" parameter of your Standard button code or API requests. 您可以在标准按钮代码或API请求的“自定义”参数中发送ID值。 This parameter allows you to store anything you want up to 256 characters, and that same value will be returned in IPN in the "custom" parameter as well. 此参数允许您存储最多256个字符的任何内容,并且相同的值也将在IPN中的“ custom”参数中返回。

Another option would be to save a local invoice/order record for the user prior to sending them over to PayPal for payment. 另一种选择是为用户保存本地发票/订单记录,然后再将其发送到PayPal进行付款。 That way you can send the invoice/order ID in the "invoice" parameter within the PayPal request, and again, that value would be returned in IPN in the "invoice" parameter there. 这样,您可以在PayPal请求中的“发票”参数中发送发票/订单ID,然后再次在该IPN的“发票”参数中返回该值。

Either way, you can pull that value and then pull out any additional details you need from your own system within the IPN script. 无论哪种方式,您都可以提取该值,然后在IPN脚本中从自己的系统中提取所需的任何其他详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM