tags:

views:

298

answers:

2

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.

A: 

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.

MQA
@MQA - THanks for responding to my question. I'm really just looking for a quick bit of help to get a stub of a PHP script going that echos out the variables of an IPN transaction from Paypal's sandbox server to my PHP script. I can't find a suitable example on the docs site.
Scott B
A: 

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
  //...
}
Donny Kurnia
Thanks Donny. Exactly what I was looking for.
Scott B