From dc7bd809c2450e19fb859c9c9dd9dbcd81a900ca Mon Sep 17 00:00:00 2001 From: Venu Vishnu Date: Fri, 23 Jan 2026 09:59:05 +0530 Subject: [PATCH 1/2] Autocapture issue fix --- PluginRazorpay.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/PluginRazorpay.php b/PluginRazorpay.php index 6430352..4dff1f3 100644 --- a/PluginRazorpay.php +++ b/PluginRazorpay.php @@ -158,6 +158,21 @@ function singlepayment($params) try { $payment = $api->payment->fetch($razorpay_payment_id); // Returns a particular payment $pricePaid = sprintf("%01.2f", round(($payment->amount / 100), 2)); // paise in rupees + + // If payment is authorized but not captured, capture it + if ($payment->status === 'authorized') { + try { + $payment->capture(array('amount' => $payment->amount)); + // Refetch to confirm capture + $payment = $api->payment->fetch($razorpay_payment_id); + if ($payment->status !== 'captured') { + throw new Exception('Payment capture failed'); + } + } catch (Exception $e) { + $success = false; + $error = 'Razorpay Error : Capture failed - ' . $e->getMessage(); + } + } } catch (Exception $e) { $pricePaid = $params['invoiceTotal']; } From 017b10a779ddde21f017167506e628b3fb26a51d Mon Sep 17 00:00:00 2001 From: Venu Vishnu Date: Sat, 31 Jan 2026 09:46:55 +0530 Subject: [PATCH 2/2] currency added --- PluginRazorpay.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PluginRazorpay.php b/PluginRazorpay.php index 4dff1f3..cc7b27f 100644 --- a/PluginRazorpay.php +++ b/PluginRazorpay.php @@ -162,9 +162,14 @@ function singlepayment($params) // If payment is authorized but not captured, capture it if ($payment->status === 'authorized') { try { - $payment->capture(array('amount' => $payment->amount)); + $payment->capture(array( + 'amount' => $payment->amount, + 'currency' => $payment->currency + )); + // Refetch to confirm capture $payment = $api->payment->fetch($razorpay_payment_id); + if ($payment->status !== 'captured') { throw new Exception('Payment capture failed'); } @@ -231,7 +236,7 @@ public function getForm($args) $orderData = array( 'receipt' => $args['invoiceId'], 'amount' => sprintf("%01.2f", round($args['invoiceBalanceDue'], 2)) * 100, // rupees in paise - 'currency' => 'INR', + 'currency' => $args['currency'], 'payment_capture' => 1 // auto capture ); $razorpayOrder = $api->order->create($orderData);