简体   繁体   English

使用IPN验证PayPal付款

[英]Verify PayPal Payment with IPN

On my website, I want to set up a "pay to remove ads" feature, and I want to collect payments for it through PayPal. 我想在我的网站上设置“付费删除广告”功能,并希望通过PayPal收取付款。 The setup that I want for this is quite simple: 我想要的设置非常简单:

  1. User pays 用户付费
  2. Payment is verified 付款已验证
  3. The entry in the MySQL database containing the user's information is updated to disable ads on the site for that user MySQL数据库中包含用户信息的条目已更新,以禁用该用户在网站上的广告

To do this, I want to use PayPal's IPN service. 为此,我想使用PayPal的IPN服务。 I understand the basics of it, but I am not quite sure how to implement it, nor do I understand how I can trigger the script to update the database for the correct user. 我了解它的基础知识,但是我不确定如何实现它,也不确定如何触发脚本为正确的用户更新数据库。 I would imagine that to do this, I need to include some means of user identification whenever they begin the payment process, but I am not sure how to do that either. 我可以想象要做到这一点,我需要在用户开始付款过程时包括一些用户识别方法,但是我也不知道该怎么做。 I am trying to implement this in PHP. 我正在尝试在PHP中实现这一点。

The process would be: 该过程将是:

  • The user has an ID 用户有一个ID
  • When he pays, you attach this ID as the custom parameter in the PayPal request 当他付款时,您将此ID作为PayPal请求中的自定义参数附加
  • You also define what url you want to call for the IPN 您还可以定义要为IPN调用的URL
  • Once the payment is complete, PayPal sends the IPN 付款完成后,贝宝(PayPal)发送IPN
  • You verify that the actual status of the payment is "Completed" 您确认付款的实际状态为“已完成”
  • You retrieve the user'ID from the custom parameter 您从自定义参数中检索用户ID
  • You update your table 您更新表格

I hope it's clear :) 我希望很清楚:)

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

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