How to verify PayPal payment and complete orders automatically?
-
Hi
I have WooCommerce v2.3.11 with PayPal for WooCommerce v1.1.6.3.4 on WordPress 4.2.2
I am not sure how I go about getting a paypal payment verified in WooCommerce so that the order shows up as COMPLETE instead of manually having to click Complete for each order.
I currently only have Paypal Express setup.
Thanks
-
That requires the use of IPN, which is not built directly into this plugin.
We have another plugin, PayPal IPN for WordPress, that can be used to update the status of the WooCommerce order when it receives notifications. It does not yet automatically do this for you, though, so for now you would have to build your own hook function to get that done.
Are you familiar with that sort of thing?
We do have an issue in our GitHub repo for this already, and it’s planned to be included on our 1.2 update.
So the PayPal IPN for WordPress plugin does NOT automatically change the order status to complete? So not sure I understand the point of the plugin if it does not do anything. Or maybe I am misunderstanding what you are saying.
THanks
PayPal IPN is a powerful feature that can be used to do all sorts of things based on different types of transactions that hit your PayPal. So the IPN plugin acts as a stand-alone plugin that can be used to enable IPN itself on WordPress. It comes with developer hooks that allow you to trigger your own functions/events when IPNs hit your site. Using it you could automate tasks based on payments, refunds, disputes, recurring profiles, etc.
So, by installing that plugin and then adding a quick snippet of code to your functions.php file in your theme you can get it to update your WooCommerce order status for you.
I actually just did this on my test server with the following code snippet…
function update_wc_order_status($posted) { $order_id = isset($posted['invoice']) ? str_replace('woo-','',$posted['invoice']) : ''; $order = new WC_Order($order_id); $order->update_status('completed', 'PayPal IPN updated order to completed.'); } add_action('paypal_ipn_for_wordpress_payment_status_completed', 'update_wc_order_status', 10, 1);
In my case I’m using “woo-” as an invoice prefix in my plugin settings, so this code strips that back off, then pulls the order from WooCommerce and updates the status to Completed when the IPN payment status is completed.
Using the
paypal_ipn_for_wordpress_payment_status_completed
hooks ensures the order will not be updated until the payment is actually completed. If the payment was pending for any reason it would not update.If you’re not comfortable setting that up on your own I’d be happy to do it for you. I would need access to your WP admin panel and FTP access to your site files.
If you’d like me to do that, please submit a ticket here and provide those credentials for me. I would recommend setting up temporary credentials that you can delete when I’m done.
I’m going to close this thread here, but let me know if you have any other questions about that.
Okay I will submit ticket shortly.
Thanks
Hi, If I understood corectly, after instaling this plugin trough cms, I need to add this code snippet to functions.php or my Custom functions plugin, and all my orders are automaticly marked as complete after purchase?
Also, isnt woocommerce already integrated with paypal? I mean, I after instalation of woocommerce there is by defaulth ‘paypal’ tab in backend.
What do I gain by installing this plugin?Also, I have found this https://docs.woothemes.com/document/automatically-complete-orders/
/** * Auto Complete all WooCommerce orders. */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); function custom_woocommerce_auto_complete_order( $order_id ) { if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); $order->update_status( 'completed' ); }
Which means I do not really need any plugin to mark successfull orders as complete.
But then again, there is paid plugin again by woocomm. doing the same thing for $29.This really doesn’t make sense. lmfao
@ocisutiocean, the PayPal integration that comes with WooCommerce is PayPal Standard. There are many advantages to using Express Checkout instead of Standard. This video will cover most of that.
Basically, Express Checkout has a lot more features that can be utilized, and our plugin makes use of them to provide you with a lot more options than what the PayPal Standard that comes with WC includes.
As for updating the orders, the built in PayPal Standard uses a simplified IPN solution to update the status automatically when the payment is completed. Rather than build a similar simplified IPN solution into ours, we built an entirely separate plugin, PayPal IPN for WordPress, that is much more powerful. You can automate all sorts of tasks based on different IPN types or the payment status of transactions. So, our IPN plugin could be used along-side the PayPal for WooCommerce to update the WC order status as explained above.
Hope that helps!
Ok, sounds great. But for this exact site I really do not need extra fetures except automatic complete order. I want people to write their info bc I set automatic account creation if they do not register previously. After that they proceed to paypal.
I only wonder why I cant use credit cards without making paypal account in some countries, and in the others, like Australia, I do not?
Does paypal express removes that, and give to people from all countries to pay via credit cards without need to make paypal account?
PayPal Standard that comes with WooCommerce should be updating itself already when orders are completed. At least it was doing that last time I played with it, but I don’t typically use it, so maybe it has changed.
PayPal simply does not offer “guest checkout” to all people in all countries. There are a number of variables involved. Express Checkout does allow you to force the guest checkout experience regardless of any cookies that are set (which is one of the primary reasons people upgrade to Express Checkout over Standard) but it still does not guarantee that all users will have the option.
Ok, thanks, I will play with this plugin in near future, I have a project on my mind and I could use something like this plugin, need to test it first.
As for automatic complete, I do not know why there are plugins to do that if you can set woocommerce in backend with ease to do it. Or am I missing something?
I’m not sure either. As I said, I really don’t use Standard all that much, but in my experience it already does the update.
You can study /woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-ipn-handler.php if you’d like to review that in more depth. It’s doing various things based on the payment_status that IPN returns.
Thanks, I’ll swing a look.
I’ll also look into woo options little more thoroughly ??
- The topic ‘How to verify PayPal payment and complete orders automatically?’ is closed to new replies.