woocommerce woocommerce_payment_complete is not working, please help.

23 posts
  • 2 Years of Membership
  • Author Level 3
  • Collector Level 1
  • Exclusive Author
+1 more
yourkishore
says

I am using paypal sandbox mode for testing payments. and this hook woocommerce_payment_complete after payement returning to website. It doesnot fire the function.

add_action( 'woocommerce_payment_complete', 'payment_complete_func' );

function payment_complete_func(){

    file_get_contents("http://localhost/wordpress/test.php?i
d=paymentagain2");
}
23 posts
  • 2 Years of Membership
  • Author Level 3
  • Collector Level 1
  • Exclusive Author
+1 more
yourkishore
says

please help

5492 posts
  • 5 Years of Membership
  • Affiliate Level 1
  • Australia
  • Author Level 3
+5 more
Australia
says

winner of this weeks div buster title thread.

can you not use curl

780 posts
  • Trendsetter
  • 3 Years of Membership
  • Author Level 5
  • Exclusive Author
+2 more
Typps
says

@yourkishore, Couldn’t help but notice your URL. Your on localhost, hence Paypal IPN ( instant payment notification) will not work for you.

You are required to provide a URL that can be accessed from the outside (outside your localhost), one that Paypal can reach ( from their servers). How are you expecting Paypal to send you a notification with just a localhost address ? Hence why you end up not getting a notification at all :P

23 posts
  • 2 Years of Membership
  • Author Level 3
  • Collector Level 1
  • Exclusive Author
+1 more
yourkishore
says

i am using file_get_contnets just for testing the function, the actual code is different. to ust test wheather its working or not.

23 posts
  • 2 Years of Membership
  • Author Level 3
  • Collector Level 1
  • Exclusive Author
+1 more
yourkishore
says

@yourkishore, Couldn’t help but notice your URL. Your on localhost, hence Paypal IPN ( instant payment notification) will not work for you. You are required to provide a URL that can be accessed from the outside (outside your localhost), one that Paypal can reach ( from their servers). How are you expecting Paypal to send you a notification with just a localhost address ? Hence why you end up not getting a notification at all :P

Thanks for the reply, the local host file is nothing to do with paypal. I just wantted to fire that function and check its working or not the local host link is connected to my local database.

780 posts
  • Trendsetter
  • 3 Years of Membership
  • Author Level 5
  • Exclusive Author
+2 more
Typps
says

OK, but do verify that in your actual code, the notify URL provided is not a localhost address. If you have provided a public URL, then I’m out of ideas :)

780 posts
  • Trendsetter
  • 3 Years of Membership
  • Author Level 5
  • Exclusive Author
+2 more
Typps
says

By the way, if it is not clear, at some point somewhere you’ve specified the notify URL, this is the URL that Paypal will hit to send you a notification.

For the record, my response has got nothing to do with the URL you’ve used in file_get_contents, but it did help to see that your testing in localhost ( the root of your problem).

23 posts
  • 2 Years of Membership
  • Author Level 3
  • Collector Level 1
  • Exclusive Author
+1 more
yourkishore
says

By the way, if it is not clear, at some point somewhere you’ve specified the notify URL, this is the URL that Paypal will hit to send you a notification. For the record, my response has got nothing to do with the URL you’ve used in file_get_contents, but it did help to see that your testing in localhost ( the root of your problem).

Yeah, thats what i think. The localhost may be the problem. I will test it in a live wordpress environment and will let you know the result :) Thansk for the reply.

by
by
by
by
by
by