开发者

Paypal IPN script: create a php on my site that receives confirmed payment messages and inserts into wordpress db

开发者 https://www.devze.com 2022-12-21 01:41 出处:网络
There are two parts to this question, so I\'m going to pubish it as two separate qu开发者_如何学JAVAestions. The first one deals with interfacing with IPN and is this:

There are two parts to this question, so I'm going to pubish it as two separate qu开发者_如何学JAVAestions. 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.


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
  //...
}


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消