CzostiX
CzostiX

Reputation: 1

How to display payment information with PayPal IPN WordPress

I using plugin for wordpress - IPN PayPal and I want to display on my Home site list with payments. I wont to use to this paypal hooks.

    <?php

add_action('paypal_ipn_for_wordpress_ipn_response_handler', 'process_recurring_handler', 10, 1);

function process_recurring_handler( $posted )
{
    // Parse data from IPN $posted[] array
    $first_name = isset($posted['first_name']) ? $posted['first_name'] : '';
    $last_name = isset($posted['last_name']) ? $posted['last_name'] : '';
    $mc_gross = isset($posted['mc_gross']) ? $posted['mc_gross'] : '';
    $recurring_payment_id = isset($posted['recurring_payment_id']) ? $posted['recurring_payment_id'] : '';
    $payer_email = isset($posted['payer_email']) ? $posted['payer_email'] : '';
    $txn_id = isset($posted['txn_id']) ? $posted['txn_id'] : '';

    /**
     * At this point you can use the data to generate email notifications,
     * update your local database, hit 3rd party web services, or anything
     * else you might want to automate based on this type of IPN.
     */
}


?>

This I add to function.php but how this call to be displayed the appropriate data in the table on page? I tried by

<?php do_action('paypal_ipn_for_wordpress_ipn_response_handler')?>

But it doesn't work. I'm totally laic, help

Upvotes: 0

Views: 477

Answers (1)

Drew Angell
Drew Angell

Reputation: 26036

The hook/function you're showing here would be triggered when any IPN hits your site. You can use it to automate your own procedures based on the IPN being triggered. It won't display anything to the site page/post itself.

If you want to display IPN data on your page/post content then you'll need to use the shortcodes that are provided by the plugin. Check out the Shortcode options in the plugin's developer guide.

For example, if you want to display the last 10 IPN records you would use this shortcode:

[paypal_ipn_list field1="txn_id" field2="payment_date" field3="first_name" field4="last_name" field5="mc_gross"]

Upvotes: 1

Related Questions