app/Http/Controllers/PaymentController.php
// In this function we return boolean if signature is correct
In this function we return boolean if signature is correct
In this function we return boolean if signature is correct
private function SignatureVerify($_signature,$_paymentId,$_orderId)
    {
        try
        {
            $pay_info = PaymentIntegration::where('gateway', 'Razorpay')->first();
            if( $pay_info->enabled == 'live') {
                $api = new Api($pay_info->live_access_key, $pay_info->live_secret_key);
            } else {
                $api = new Api($pay_info->test_access_key, $pay_info->test_secret_key);
            }
            $attributes  = array('razorpay_signature'  => $_signature,  'razorpay_payment_id'  => $_paymentId ,  'razorpay_order_id' => $_orderId);
            $order  = $api->utility->verifyPaymentSignature($attributes);
            return true;
        }
        catch(\Exception $e)
        {
            return false;
        }
    }
private function SignatureVerify ( $ _signature , $ _paymentId , $ _orderId ) { try { $ pay_info = PaymentIntegration :: where ( 'gateway' , 'Razorpay' ) -> first ( ) ; if ( $ pay_info -> enabled == 'live' ) { $ api = new Api ( $ pay_info -> live_access_key , $ pay_info -> live_secret_key ) ; } else { $ api = new Api ( $ pay_info -> test_access_key , $ pay_info -> test_secret_key ) ; } $ attributes = array ( 'razorpay_signature' => $ _signature , 'razorpay_payment_id' => $ _paymentId , 'razorpay_order_id' => $ _orderId ) ; $ order = $ api -> utility -> verifyPaymentSignature ( $ attributes ) ; return true ; } catch ( \ Exception $ e ) { return false ; } }
In this function we return boolean if signature is correct
In this function we return boolean if signature is correct
// Create an object of razorpay class // If Signature is not correct its give a excetption so we use try catch