• Resolved natinho68

    (@natinho68)


    Hi,

    I have an issue with the notification. I think that I don’t call the correct hook.
    I have a notification when somebody pay on my website.
    But all of my products are recurrents payments, monthly or yearly.
    Today, I’ve had notification for a payment since last month.
    I use this function :
    paypal_ipn_for_wordpress_payment_status_completed

    I just want 1 notification when the customer pay for the first time and that’s it.

    Can you help me ?

    https://wordpress.org/plugins/paypal-ipn/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor angelleye

    (@angelleye)

    I’m not sure I’m fully understanding what you’re trying to do.

    First, are you working with Standard Subscriptions or are you working with the full Recurring Payments APIs through Express Checkout and/or Payments Pro?

    Can you provide a sample of an IPN you got from one of the recurring payments?

    Thread Starter natinho68

    (@natinho68)

    Hi,
    I’m using the standard suscription.
    By notification, I mean email notification with this function :

    //Paypal IPN mail
    add_action('paypal_ipn_for_wordpress_payment_status_completed', 'paypal_ipn_for_wordpress_payment_status_completed', 10, 1);
    function paypal_ipn_for_wordpress_payment_status_completed($posted) {
    
        // Parse data from IPN $posted array
    
        $payment_status = isset($posted['payment_status']) ? $posted['payment_status'] : '';
        $mc_gross = isset($posted['mc_gross']) ? $posted['mc_gross'] : '';
        $first_name = isset($posted['first_name']) ? $posted['first_name'] : '';
        $last_name = isset($posted['last_name']) ? $posted['last_name'] : '';
        $item_name = isset($posted['item_name']) ? $posted['item_name'] : '';
        $payer_email = isset($posted['payer_email']) ? $posted['payer_email'] : '';
    
        /**
         * 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.
         */
        $to = array(
                'xxxx@xx.com',
                'xxxx@xx.com'
                );
        $subject = 'Notification Paypal pour '. $first_name . ' ' . $last_name . '';
        $message = 'Prix: ' . $mc_gross . "\n";
        $message .= 'Statut de paiement: ' . $payment_status . "\n";
        $message .= 'Prénom et nom: ' . $first_name . ' ' . $last_name . "\n";
        $message .= 'Email: ' . $payer_email . "\n";
        $message .= 'Cotisation: ' . print_r($item_name, true);
        wp_mail( $to, $subject, $message );
    }

    For example, this customer have payed his first cotisation the 14th October.
    I had an email notification.
    The 14th November, I had the same email notification. 1 month later.
    I just want the “suscription” notification, if it’s called like that… 1 email when customer pay his first cotisation.
    But the transaction_type field is already called “subscr_payment” for both of payments… So I don’t know what to do.

    Screenshot : http://hpics.li/ff21655

    Am I clear ?

    Plugin Contributor angelleye

    (@angelleye)

    You could do it based on the subscr_signup transaction type instead of payment_status. That way your function would be triggered any time a new subscription is created but not when actual payments are made. Is that what you’re after?

    Thread Starter natinho68

    (@natinho68)

    Yes that is what I want to do, thanks !

    Thread Starter natinho68

    (@natinho68)

    The hook is paypal_ipn_for_wordpress_txn_type_subscr_signup ?

    Plugin Contributor angelleye

    (@angelleye)

    Yes, that hook should do what you’re wanting. It would only be triggered when the subscription profile is created, but nothing would be triggered when payments are completed.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Notification Paypal every months’ is closed to new replies.