PayPal integration framework and admin interface as well as IPN listener.
To send a request to PayPal, simply build the request as an associative array and pass it to the hashCall helper function like this:
$ppParams = array(
'METHOD' => 'doDirectPayment',
'PAYMENTACTION' => 'Sale',
'IPADDRESS' => '123.123.123.123',
'AMT' => '222.22',
'DESC' => 'some product',
'CREDITCARDTYPE' => 'VISA',
'ACCT' => '4111111111111111',
'EXPDATE' => '112011',
'CVV2' => '123',
'FIRSTNAME' => 'Aaron',
'LASTNAME' => 'Campbell',
'EMAIL' => 'pptest@xavisys.com',
'STREET' => '123 some pl',
'STREET2' => '',
'CITY' => 'San Diego',
'STATE' => 'CA',
'ZIP' => '92101',
'COUNTRYCODE' => 'US',
'INVNUM' => '12345',
);
$response = hashCall($ppParams);
First you have to tell PayPal to send message to the correct URL. Go to the PayPal Framework settings page and click the "PayPal IPN Listener URL" link to see instructions on how to use the URL that's listed there. Once your PayPal account has been set up the listener will automatically process all IPN messages and turn them into WordPress actions that you can hook into. You can use the 'paypal-ipn' action to look at every message you ever get, or hook directly into a 'paypal-{transaction-type}' hook to process a specific type of message:
add_action('paypal-ipn', 'my_process_ipn');
function my_process_ipn( $data ) {
echo 'Processing IPN Message:<pre>';
var_dump( $data );
echo '</pre>';
}
add_action('paypal-recurring_payment_failed', 'my_process_ipn_recurring_payment_failed');
function my_process_ipn_recurring_payment_failed( $data ) {
echo 'A recurring payment has failed. Here is the data I have to process this:<pre>';
var_dump( $data );
echo '</pre>';
}
Many servers have out of date certificate lists, so this is necessary to be as portable as possible. However, if your server is set up right you can force sslverify like this:
add_filter( 'paypal_framework_sslverify', '__return_true' );
Requires: 2.8 or higher
Compatible up to: 3.1.4
Last Updated: 2012-5-20
Downloads: 12,117
Got something to say? Need help?