dsqdpn31467 2017-10-25 14:30
浏览 49
已采纳

用户通过PayPal付款从我的网站购买机票后,如何在mysite的数据库中存储成功的交易详情?

I am making a event hosting website using php as backend language.So in this site we are showing various kind of events. So when user comes to our site he/she can register on the site and after registering he/she can browse through the events of their choices. Now they can buy a ticket for any event in which they want to participate.

To make the payment process I have integrated paypal api. So when a user will click on Buy Ticket button on any event and he/she will be redirected to paypal portal to proceed for payment.

I also need to store the info in my database that whom has made successful payments for which event. But the problem I am facing is that when someone returns from paypal after making successful or may be unsuccessful payment then the session variable in which I have stored the userid, that variables becomes empty. Now if I don't know the userid who have done the transaction, then how I can store the user with the transaction to the database.

I know that on various shopping sites same kind of functionality must be implemented but I want to know how people implement this with paypal.

  • 写回答

1条回答 默认 最新

  • drkrsx3135168 2017-10-26 02:12
    关注

    You can integrate the IPN function(which is PayPal's service) to fix the issue.

    IPN(Instant Payment Notification)  is a PayPal feature that sends messages about payments (and other transactional events) directly from PayPal to your website(s)' back-end systems. 

      Logic: While a payment received on your PayPal account, PayPal will send IPN message to your IPN script almost at the same time. After receiving the IPN , your system can refer the IPN message to do the subsequent processing- update payment status into your system or send email etc. But the follow-up actions need to be integrated by your system(Including send email system).   This process is complex, but it is the only way to achieve your marketing goal.

    Following and the IPN integration guide.

    Please kindly refer them.

     https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNIntro/

      IPN code samples:

    https://github.com/paypal/ipn-code-samples

      IPN variables:

    https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNandPDTVariables/  

    Thanks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。