WooCommerce - Send new order emails at different order status - wordpress

I have an issue that WooCommerce sends out the “New Order” / “Order Confirmation” email as soon as an order is placed.
When working with a payment provider like stripe or paypal, this leads to issues since people have the option to cancel within the payment process (for example at paypal with “Cancel and go back to store X”).
This works fine so far, the order gets set to “canceled” and nothing more happens.
But the Order Confirmation email gets still send, even though the user is not even done with the payment itself or cancels it.
Is there any solution how to send this email only at a different status – for example “Processing” or “Completed”?
I tried using Send WooCommerce New Order email notification only for paid orders with processing status answer code, but it didn't worked for me.

Related

I'm having a problem with my website, using wordpress / woocommerce

I'm having some trouble with the rejected payments in my online store, I want something more "clear" for the people trying to buy stuff and their payments fails. The problem is when a payment is rejected or it fails, the website sends the users to the "order confirmation" site again in a infinite loop, all what I want is that the website sends the users to the payment screen/website so they can try to do the process again.
Is there a woocommerce webhook that can do what I need?
Or better, in short:
Instead of sending me to the order confirmation screen/website again, i want the website to send me to the payment site, so the process can start again in the event of a rejected payment. It's like, I need to change the way it redirects me from the orders to the payments. I don't now if I'm clear enough

WooCommerce Email on Payment Done but not received to Admin

I would like to know which WooCommerce email is sent to the admin when user has done the payment, money left from the user (bank) account, but admin haven't received the amount. Is there an email trigger for this situation by default ?
The new order email to the admin looks for the order status to switch to Processing (it also looks at other states, but Processing is the one relevant to your question). The payment gateway will decide what makes an order "paid" (and thus Processing in WooCommerce), so the answer to your question may vary with different providers.

Prevent an order from being created if credit card is declined?

When a user places an order on my woocommerce site, an order will be created in the back end with a pending status even if the user's credit card is declined.
I want to be able to prevent the order from being created until a successful response is recieved. I am using Authorize.net as my payment gateway.
You can use the woocommerce_order_status_failed hook to handle this use case.

Paypal website payment standard not returning to return url from Sandbox test account

I am using Paypal Website Standard integration with Asp.Net and my problem is even after payment is successful, paypal is not returning me to my thank-you.aspx page. I have already set return-url in code as
sbForm.Append("<input type=\"hidden\" name=\"return\" value=\"" + successUrl + "\">");
means, I have created form mark-up using Code-Behind. Success url is absolute reachable (I can copy url and paste in browser, it works). I have my sand-box settings as below:
Profile -> Selling Tools
Under Selling Online -> Website Payment Preferences
Auto Return: On
Return URL: http://mywebsite/thank-you.aspx
Payment Data Transfer: Off
PayPal Account Optional:On
Contact Telephone:Off (PayPal recommends this option)
Support giropay and bank transfer payments:No
However it return to cancel page without fail if I cancel payment.
Edit
Taking reference if this, I set PayPal Account Optional:Off but no luck.
Edit
When I click the link after payment success message on Paypal's success page, I can go back and debug but it not returning any QueryString with the key name tx which results always Fail\n response.
With Payments Standard, enabling auto-return with a return URL should redirect, but it can sometimes take up to 10 seconds or so for the redirection to happen. That's why there is no guarantee users will make it to your thank you page even when it's all configured and working well.
If you need to ensure users end up at your site and there's no chance they wouldn't reach your thank you page then you'll want to use the Express Checkout API instead of Payments Standard.
The Express Checkout flow doesn't get completed until the user is back at your site (where you make the final API call) so you can rest assured you'll always end up on your thank you page.
Even still, if you're trying to automate procedures like updating your database, sending email notifications, etc. you'll want to use Instant Payment Notification (IPN).
IPN's are triggered instantly, so you can automate procedures in real-time. It also allows you to handle things like pending payments that have cleared (which you wouldn't want to deliver or ship right away), disputes, refunds, etc.
Turned Payment Data Transfer On and get it worked

PayPal Failure notification

I have an asp.net application
The User can purchase items and/or upgrade an existing service. I use PayPal to handle payments.
When the order is placed I put the order details into a table as a record. I also do this so that if the User revisits my page I check a flag in that table to tell them whether payment has been received.
If not received then I display a message on my web page telling them they have requested and upgrade and that we are currently waiting for payment.
I also disable any future purchases for that User so that they do not upgrade twice (or more).
Now, it occurs to me that when the User is redirected to PayPal to make that purchase that a payment could fail or they could close the web page.
In that case then the User would not be able to ever upgrade unless they send me a support email.
What is best practice? Wait for a time period to elapse and if no payment then allow User to try again or stick with the support email route?
If it is best to wait for a period of time what is an acceptable period of time to wait for?
I am using the post back of Form values method to imitate payment to PayPal:
https://www.paypal.com/cgi-bin/webscr
What you can do.
Each time the user is ready to leave your page and move to paypal to pay, you create
Clone of their order
A new unique ID connected with that cloned order.
So, if one order if fail, at any time the user come back is find a new set "Order"+"Unique ID". With that 2 elements can make a final payment.
You may end up with two or tree or more cloned orders, but from my experience because this is what I really do, is rare, and its safe for your customer and you.
Also please note that paypal is accept only one unique id for each order. If one ID is fail, then you must create a new one anyway.
The unique id you send to paypal go to the invoice parametre.
The manual for all parametres is this pdf - PayPal Payments Standard Intergration Guide... and there are more pdf for paypal...

Resources