Paypal IPN 脚本:在我的网站上创建一个 php,用于接收确认的付款消息并插入到 wordpress 数据库中

发布于 2024-08-22 15:24:11 字数 378 浏览 3 评论 0原文

这个问题有两个部分,所以我将把它作为两个单独的问题发布。第一个涉及与 IPN 的接口,如下:

我需要创建一个简单的 .php 脚本,每次我收到给定产品的确认付款时,该脚本都可以与 Paypal 的 IPN 系统接口。

然后,该脚本会将用户作为“成员”(这是我定义的自定义角色)安装到我的 WordPress 用户数据库中,使用他们的电子邮件地址作为用户名,使用 Paypal 交易 ID 作为密码。

我这样做是因为我可以轻松地将所有在此之前购买过的人输入数据库,而不必为每个人生成随机密码。

与 IPN 接口有什么帮助吗?

第二个问题就容易多了,那就是如何使用 IPN 数据(名字、姓氏、电子邮件地址和交易 ID)将用户输入到 WordPress 会员数据库中。

There are two parts to this question, so I'm going to pubish it as two separate questions. The first one deals with interfacing with IPN and is this:

I need to create a simple .php script that can interface with Paypal's IPN system everytime I receive a confirmed payment for a given product.

The script will then install the user into my wordpress user's database as a "member" (which is a custom role I've defined) using their email address as their username and the paypal transaction id as their password.

I'm doing it this way because I can easily enter all the people who have purchased prior to this, into the database without having to generate random passwords for everyone.

Any help with interfacing with IPN?

The second question will be much easier and that's how to use the IPN data (firstname, lastname, email address and transaction id) to enter the user into the wordpress member database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

得不到的就毁灭 2024-08-29 15:24:11

只需使用 Micah Carrick Paypal IPN 类。它有 validate_ipn() 方法,可用于保护要放置更新脚本的代码块:

if ( $paypal->validate_ipn() )
{
  $ipn_data = $paypal->ipn_data;
  $invoice = $ipndata['invoice'];
  //do update here, based on invoice
  //...
}

Just use Micah Carrick Paypal IPN Class. It have validate_ipn() method that can be used to protect a block of code where you want to put update script:

if ( $paypal->validate_ipn() )
{
  $ipn_data = $paypal->ipn_data;
  $invoice = $ipndata['invoice'];
  //do update here, based on invoice
  //...
}
黑色毁心梦 2024-08-29 15:24:11

https://cms.paypal .com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables#id085KN030WXW

所有内容在 Paypals 自己的文档上都解释得相当好。

交易 ID 只是一个整数,所以我仍然建议为它们生成一个随机密码。

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables#id085KN030WXW

All explained fairly well on Paypals own docs.

The transaction ID will just be an integer, so I'd still recommend generating a random password for them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文