Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook returns error 500 when same razorpay account is used on multiple websites #213

Open
StinkyBytes opened this issue Dec 22, 2021 · 0 comments

Comments

@StinkyBytes
Copy link

Webhook returns error 500 when same razorpay account is used on multiple domains.

What happens:
Razorpay retries webhook on Website B with order data from Website A.

Since the order number from Website A does not exist on Site B, $order = wc_get_order($orderId) returns FALSE which throws the following error with HTTP response code 500.
PHP Fatal error: Uncaught Error: Call to a member function needs_payment() on bool in /wp-content/plugins/woo-razorpay/includes/razorpay-webhook.php

Repeated failures result in the webhook being disabled automatically in the razorpay dashboard.

if ($order->needs_payment() === false)

suggested fix:
if ( ($order === false) || ($order->needs_payment() === false) )

if ($order->needs_payment() === false)

suggested fix:
if ( ($order === false) || ($order->needs_payment() === false) )

if ($order->needs_payment() === true)

suggested fix:
if ( ($order === false) || ($order->needs_payment() === true) )

This is how I am presently getting this to work. Please suggest a better fix if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant