WordPress.org

Ready to get started?Download WordPress

Plugin Directory

PayPal Framework

PayPal integration framework and admin interface as well as IPN listener.

How do I send a request to PayPal?

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);

How do I use the Listener to process PayPal messages?

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>';
}

Why do you set sslverify to false?

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: 2013-4-3
Downloads: 21,711

Ratings

4 stars
4.9 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1
100,2,2 0,1,0
100,1,1
100,1,1