WooCommerce Compatibility

Issue #7 closed
Drew Angell repo owner created an issue

WooCommerce PayPal Standard uses IPN via the notify_url parameter in the HTTP/form request to PayPal.

We need to check to see if WooCommerce is installed, and if so, use the 'woocommerce_paypal_args' hook to override the 'notify_url' parameter with the URL that our plugin uses.

Then, we need to setup a forwarder to the WooCommerce IPN URL so that it still runs and updates the WC system as expected.

Comments (21)

  1. Drew Angell reporter

    We also need to include my PayPal Partner code for this plugin with the same hook. Here's a sample of that hook being used to update the partner code and the notify_url together.

    /**
     * Add additional parameters to the PayPal Standard checkout built into WooCommerce.
     *
     */
    add_filter( 'woocommerce_paypal_args', array($this,'angelleye_paypal_standard_parameters'));
    
    public function angelleye_paypal_standard_parameters($paypal_args)
    {
        $paypal_args['bn'] = 'AngellEYE_SP_WooCommerce';
        $paypal_args['notify_url'] = 'http://www.domain.com/ipn/url';
        return $paypal_args;
    }
    

    Of course, the notify_url value would be the primary IPN URL this plugin uses for the site.

  2. jignesh kaila

    I am done with finalised and push to Issue-7 for you review.

    Note: Today I am stuff with this functionality. the problem is server automatically add slashes in IPN response array so woocommerce order status remain pending instead Processing due to IPN validate problem. finally I found actual problem and resolved it.

  3. Drew Angell reporter

    Ok, great, I'll take a look. I understand stuff like that comes up sometimes. No worries. Glad you got it resolved.

    I may not be able to get to this tonight, but you can move forward with the other plugins if you're all done here.

  4. jignesh kaila

    Thank you !!

    OK, will move forward to PayPal IPN for WordPress - MailChimp, Once I finalize Issue- 15.

  5. Drew Angell reporter
    • changed status to open

    Reopening this because I can't seem to find this in the development branch anymore..?? Did we lose it somehow, or am I just not seeing it?

  6. Drew Angell reporter

    That is not what this issue was for, though. This issue was for WooCommerce compatibility. I'm not seeing my BN code parameter anywhere like in the sample I provided above.

    That's part of what's confusing me looking at this issue branch in the repo, too. It seems to have a lot of commits that don't involve this particular issue. I remember seeing it at one point, though, because I merged it into the dev branch, and you had commented on how you struggled with it temporarily because of formatting of the IPN URL and the WC order status not getting updated as it should from the IPN.

  7. jignesh kaila

    Yes I understand your concern. I have checked "BN" code it is there in development branch as well as in issue-7 branch. Please see the link: https://bitbucket.org/angelleye/paypal-ipn-for-wordpress/src/b0191323efdc4167b760ae62a2552456bff42e61/includes/class-paypal-ipn-for-wordpress-paypal-ipn-forwarder.php?at=development

    public static function paypal_ipn_for_wordpress_standard_parameters($paypal_args) {
            $paypal_args['bn'] = 'AngellEYE_SP_WooCommerce';
            update_option('woo_notify_url', site_url('?wc-api=WC_Gateway_Paypal'), true);
            $paypal_args['notify_url'] = site_url('?AngellEYE_Paypal_Ipn_For_Wordpress&action=ipn_handler');
            return $paypal_args;
        }
    

    Please let me know if any.

  8. Drew Angell reporter

    Ah, thanks for looking into that. I see where I was confused. I see that it's in the Forwarder class, and I'm guessing you put it there because we're also adding that forwarding rule for WooCommerce, which makes sense. I was just thinking it would be in one of the main class files, but this is good.

    One more thing, though. I don't see that we're actually checking for the WooCommerce plugin before running this hook..?? Shouldn't we have something in place looking for an existing WC class, and only use this hook if it finds it? I don't want people who aren't using WooCommerce to run into PHP errors.

  9. Drew Angell reporter

    I went ahead and disabled WooCommerce and I don't seem to be getting any PHP errors. I guess the hooks sort of take care of that on their own..?? If you call a hook that isn't available it simply ignores it..??

  10. Drew Angell reporter

    Everything looks good here now, and I was able to successfully test a PayPal payment through WooCommerce and see it hit both our IPN and the WC IPN, so that's awesome!

    The PayPal Standard log file in WC only provides the IPN data, though. I'd like to verify that my bn code is getting placed in the PayPal standard checkout code as expected. Where can I see that?

  11. jignesh kaila

    It not required to check WooCommerce is enable or not because hook and filter trigger hit by WooCommerce itself, suppose WooCommerce is not install then function not call.

    There is two way to verify that bn code is getting placed in the PayPal standard checkout code as expected.

    1) you may verify using your PayPal partner portal transaction report

    2) I also I have add into IPN log file like "PayPal Request args:"

    01-13-2015 @ 09:29:20 - PayPal Request args: Array
    (
        [cmd] => _cart
        [business] => nishit.langaliya@multidots.in
        [no_note] => 1
        [currency_code] => USD
        [charset] => utf-8
        [rm] => 1
        [upload] => 1
        [return] => http://paypalipn.projectsmd.in/checkout/order-received/323?key=wc_order_54b4e5704c61c&utm_nooverride=1
        [cancel_return] => http://paypalipn.projectsmd.in/cart/?cancel_order=true&order=wc_order_54b4e5704c61c&order_id=323&redirect&_wpnonce=38c1d6fc56
        [page_style] => 
        [paymentaction] => sale
        [bn] => AngellEYE_SP_WooCommerce
        [invoice] => WC-323
        [custom] => a:2:{i:0;i:323;i:1;s:22:"wc_order_54b4e5704c61c";}
        [notify_url] => http://paypalipn.projectsmd.in/?AngellEYE_Paypal_Ipn_For_Wordpress&action=ipn_handler
        [first_name] => Jignesh
        [last_name] => Kaila
        [company] => multidots
        [address1] => h-102
        [address2] => 
        [city] => Ahmedbad
        [state] => Gujarat
        [zip] => 363330
        [country] => IN
        [email] => jignesh@multidots.in
        [night_phone_b] => 9978800036
        [day_phone_b] => 9978800036
        [no_shipping] => 1
        [tax_cart] => 0
        [item_name_1] => test
        [quantity_1] => 1
        [amount_1] => 50
    )
    
  12. Drew Angell reporter

    Unfortunately, PayPal's partner portal doesn't provide detailed reporting like that, so I just have to be sure that I'm sending it on my end. This looks good, so I'll go ahead and close this. Thanks!

  13. Log in to comment