razorpay / razorpay-woocommerce

Razorpay Payment Extension for Woocommerce
https://wordpress.org/plugins/woo-razorpay/
GNU General Public License v2.0
40 stars 30 forks source link

Delayed payment successful response from Razorpay despite successfully capturing payments #571

Open shrenikr235 opened 2 months ago

shrenikr235 commented 2 months ago

This is the flow a customer takes on our website:

  1. Customer clicks on a "Proceed to pay" button and is shown the Razorpay payment screen - At this point, a WooCommerce order gets created and a subsequent Razorpay order order_someString gets created.
  2. Customer makes the payment and is redirected to the success version of the thankyou page if successful and the failure version of the thankyou page if he cancels the payment.
  3. In case of successful payment, these are what the order notes on WooCommerce look like: image
  4. In case of a failed payment, these are what the order notes on WooCommerce look like: image
  5. In case of a successful payment but failed order, these are what the order notes on WooCommece look like: image
    • The rzp_webhook_notified_at field is also set to 1725630166 which is 7:12PM i.e about 2 mins post creation of the Razorpay order when we successfully received the payment on Razorpay. image

The issue:

  1. We however, received the payment confirmation from Razorpay only about 5 hrs later at ~12:14AM. This has multiple effects because the WooCommerce order status doesn't change to Completed when it should and triggers based on that order status are affected consequently.
  2. Not sure if this is relevant but I found a few fatal errors in my WooCommerce logs related to Razorpay. Can you please help me make sense of this error? 2024-08-14T13:36:55+00:00 CRITICAL Uncaught Razorpay\Api\Errors\BadRequestError: Too many requests in /var/www/awesome-enterprise-new/vendor/razorpay/razorpay/src/Request.php:142 CONTEXT: {"error":{"type":1,"file":"\/var\/www\/awesome-enterprise-new\/vendor\/razorpay\/razorpay\/src\/Request.php","line":142},"backtrace":["","#0 \/var\/www\/awesome-enterprise-new\/vendor\/razorpay\/razorpay\/src\/Request.php(109): Razorpay\\Api\\Request->processError()","#1 \/var\/www\/awesome-enterprise-new\/vendor\/razorpay\/razorpay\/src\/Request.php(58): Razorpay\\Api\\Request->checkErrors()","#2 \/var\/www\/go2andaman.com\/htdocs\/wp-content\/plugins\/woo-razorpay\/woo-razorpay.php(1420): Razorpay\\Api\\Request->request()","#3 \/var\/www\/go2andaman.com\/htdocs\/wp-content\/plugins\/woo-razorpay\/woo-razorpay.php(1054): WC_Razorpay->generateOrderForm()","#4 \/var\/www\/go2andaman.com\/htdocs\/wp-content\/plugins\/woo-razorpay\/woo-razorpay.php(857): WC_Razorpay->generate_razorpay_form()","#5 \/var\/www\/go2andaman.com\/htdocs\/wp-includes\/class-wp-hook.php(324): WC_Razorpay->receipt_page()","#6 \/var\/www\/go2andaman.com\/htdocs\/wp-includes\/class-wp-hook.php(348): WP_Hook->apply_filters()","#7 \/var\/www\/go2andaman.com\/htdocs\/wp-includes\/plugin.php(517): WP_"]}
abdulwahidsharief commented 2 months ago

@shrenikr235 please share site logs

shrenikr235 commented 2 months ago

@abdulwahidsharief are you referring to Wordpress logs / WooCommerce logs?

shrenikr235 commented 2 months ago

Additionally, Razorpay has informed me that for the payment ID we had a delayed response for: The webhook payload was sent immediately after the payment was authorised but the same was not consumed at my website's end and we received a non 2xx response from the server hence the same was retried till success response was received.

image

Can you help me make sense of what could cause this? Razorpay support seems to think it could be due to non-whitelisted Razorpay webhook IPs but if that were the case this would be the case for all orders, right? But I see this issue only with specific orders.

abdulwahidsharief commented 2 months ago

@shrenikr235 please send woocommerce logs (woocommerce->status->logs->razorpay-log). share all logs with respect to delayed orders from logs we can find how many webhook requests received for an order and can find if anything is breaking at your site