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

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

Related

Recurring and non-recurring items in single PayPal checkout flow

I'm currently migrating a website from WooCommerce to Shopware 6, which needs to support recurring payments for a membership subscription.
WooCommerce is still using PayPal Standard, which allows you to mix non-recurring line items with a recurring subscription, in a single checkout flow.
Shopware 6 uses the REST API, which doesn't appear to support this ability and the only solution appears to be using the Javascript SDK:
User clicks Pay with PayPal.
Subscription is created via actions.subscription.create
Dialog is displayed requesting approval.
Customer approves.
Submit original checkout.
Redirect to PayPal.
Complete payment.
Redirect back to website with confirmation.
A potential solution I'm looking into now is changing the return URL of the initial order creation to redirect to a billing agreement approval URL and have the return URL's of that redirect back to the original return url.
Overly complicated and the worse UX I've ever seen.
Before I tear what's left of my hair out, does anyone have any suggestions?
UPDATE
Although it isn't the solution I was hoping for, I ended up removing the Shopware 6 PayPal plugin and implementing my own payment method using the NVP API.
From the user perspective, there is only one approval process. In the backend, once the user has approved the transaction (that has been marked as needing a billing agreement) the transaction is verified and then a recurring profile is created.
There's no way to combine Subscriptions and one-time payments in a single checkout. Such items even require different parameters on the PayPal SDK line, if using the PayPal buttons to show an in-context experience.
The in-context experience is best, since it involves no redirects away from your site to PayPal and back. Here is the flow for one-time payments:
Make two routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). The latter one should (on success) store the payment details in your database before it does the return (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID)
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
A similar (separate) flow can be used for PayPal Subscriptions. Only one subscription can be approved at a time.

WooCommerce - Send new order emails at different order status

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.

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

WooCommerce IPN Notification

I need some help typing to figure out what im doing wrong.
My site is setup to manage orders using WooCommerce. the site is a public site, but my Perl Script needs to be implemented as im testing a few things out and displaying some messages. The public site is called 'publicwebsite.com'. But the other site im displaying all this information and proccess it is called 'mywebsite.com'
I have setup my API credentials and setup my IPN for paypal payment. To direct the IPN to my website i have gone into the 'My Selling Tools' on the sandbox side of Paypal, and set the IPN to http://mywebsite.com/test_pl.html
when i place and order, somehow the IPN is not being directed to the URL. I went to the IPN tabe again on the Paypal side, and clicked on history, and i see that the 'Notification URL' is still set to http://publicwebsite.com/WC_Gateway_Paypal, whereas it should have been http://mywebsite.com/test_pl.html.
I cannot seem to find the place where i can change the preferences such that Woocommerce pushes the information onto the site.
Please Help.
Thanks in advance
WooCommerce will set the IPN location of each transaction so that it can be notified when an item is paid for and continue its process.
Not knowing your data flow, I would suggest looking into woocommerce available hooks and hook into the IPN notification and then send the data (and user) to your perl script.
This way you satisfy WooCommerce's condition that it needs to know about payments, and you satisfy your need to have your perl script called so that it can do additional processing.
One possible solution is to update your IPN settings in your PayPal Account. If you have a standard PayPal account here are the instructions directly from PayPal Documentation:
Go to the PayPal website and log in to your account.
Click Profile at the top of the page.
Click My selling tools.
Click Update beside "Instant payment notifications" in the "Getting paid and managing risk" section.
Enter the notification URL and select "Receive IPN messages."
Click Save.
Just in case you need it below is the PayPal Instant Payment Notification Guide. It includes an IPN simulator.
PayPal Instant Payment Notification Integration Information

Payment gateway possible issues

I have implemented 2 payment gateways in my app (paypal and datatrans). In both gateways payment happens on gateway site i.e. user is redirected to payment gateway site where he pays and then redirected back to our site.
I have identified some scenarios where there is some issue in entire payment flow. E.g.
lost internet connection after payment and so order is not placed but money got debited from user's account
PayPal sent response but application got exception and so user did not get confirmation
Double payment due to hitting refresh button when transaction was in progress
I would like to know what are standard exceptions should be handled in payment gateway integration.
Any example with paypal would help me lot, I use asp.net mvc 3. thanks.
Double payment.
To avoid them you need to create a unique ID for every order, after the user move from your site to the paypal or other site, this ID must be read-only, and if the user return to your site after fail or other reason, and ask to re-order the same cart, you must create a new cart, and a new order ID.
For every order id, paypal and other sites allow only one payment (or one fail).
Lost the internet connections, or not get confirmations
Paypal have 3 ways that contact with your.
IPN
PDT
emails.
The one is that you get information from the return of the user after the payment, the other method is that paypal communicate with you and send you the payment informations, and final you get email.
In the rare case that all fails, user will inform you after some days that he did not get his order.
Practical they never fail all of them. Actually they never fail any of them.
Exceptions and bugs
Well some times you can not avoid bugs, so monitor your payments and log any possible errors to fix it. After 7 years of payments with paypal I still monitor them for problems, fraud, issues, new thinks etc, and still make some small adjustments time to time.

Resources