Javascript Disabled!

Please Enable Javascript if you disabled it, or use another browser we preferred Google Chrome. Please Refresh Page After EnablePowered By UnCopy Plugin.

PhonePe Payment Gateway | PhonePe Payment Gateway Integration in CodeIgniter | Hindi |Code With Code

PhonePe Payment Gateway | PhonePe Payment Gateway Integration in CodeIgniter | Hindi |Code With Code

💻 Regardless of your business niche, whether it’s an e-commerce store, booking platform, or service-based website, integrating PhonePe will give your customers the flexibility they desire in making payments. 

🎓 Join us on this journey to elevate your website’s payment options! Hit the subscribe button and turn on notifications to stay updated with the latest tips and tutorials for your online business. 

🔔 Don’t miss out on this opportunity to enhance your website’s payment capabilities and offer a seamless checkout experience with PhonePe Payment Gateway integration. Let’s get started on empowering your website with the seamless integration of PhonePe Payment Gateway! 🚀💳

Payment Request Response Wityh Payment Gateway URL
				
					

<button class="gateway phonepe-gateway payment-button float-end" id="phonePePayButton" onclick="fninitPhonePePaymentGateway()">Pay with phonepe</button>
				
			
				
					 <script type="litespeed/javascript">var buyBtn=document.getElementById('phonePePayButton');var responseContainer=document.getElementById('PphonePePaymentResponse');function fninitPhonePePaymentGateway(){buyBtn.disabled=!0;buyBtn.textContent='Please wait...';$.ajax({type:'POST',url:"http://localhost/yourdomainname/payment/create_phonepe_payment/",dataType:"json",headers:{"Content-Type":"application/json",},success:function(response){console.log(response);if(response.Code=="200"){window.location.href=response.url}else{alert(response.message)}},error:function(){alert('Error: Failed to update payment information.')}})}</script>
				
			

Create New Method Name - create_phonepe_payment

				
					    function create_phonepe_payment()
    {

        $test_mode = $payment_gateway['enabled_test_mode'];
        if ($test_mode == 1) {
            $merchantId = $keys['sandbox_merchantId'];
            $merchantKey = $keys['sandbox_merchant_key'];
            $payment_url = $keys['sandbox_payment_url'];
        } else {
            $merchantId = $keys['prod_merchantId'];
            $merchantKey = $keys['prod_merchant_key'];
            $payment_url = $keys['prod_payment_url'];
        }

        define('PHONEPE_SUCCESS_URL', base_url() .'PaymentPhonePe/success_course_payment_by_phonePe/'.$user_id);
        $PhonePeAmount = round($payment_details['total_payable_amount'] * 100, 2);
        $PhoenPedata = array(
            "merchantId" => $merchantId,
            "merchantTransactionId" => rand(100,999)." - MT785058104",
            "merchantUserId" => "MUID123",
            "amount" => $PhonePeAmount,
            "redirectUrl" => PHONEPE_SUCCESS_URL,
            "redirectMode" => "POST",
            "callbackUrl" => PHONEPE_SUCCESS_URL,
            "mobileNumber" => "8056496398",
            "paymentInstrument" => array(
                "type" => "PAY_PAGE",
                "param1" => "PAY_PAGE",
            )
        );
        // Convert the Payload to JSON and encode as Base64
        $payloadMain = base64_encode(json_encode($PhoenPedata));
        $payload = $payloadMain . "/pg/v1/pay" . $merchantKey;
        $Checksum = hash('sha256', $payload);
        $Checksum = $Checksum . '###1';

        $curl = curl_init();
        curl_setopt_array($curl, [
            CURLOPT_URL => $payment_url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => json_encode([
                'request' => $payloadMain
            ]),
            CURLOPT_HTTPHEADER => [
                "Content-Type: application/json",
                "X-VERIFY: " . $Checksum,
                "accept: application/json"
            ],
        ]);
        $response = curl_exec($curl);
        $err = curl_error($curl);
        curl_close($curl);
        if ($err) {
            $data = ['Code' => "400", 'message' => "Something went wrong..!"];
            echo json_encode($data);
        } else {
            $responseData = json_decode($response, true);
            $url = $responseData['data']['instrumentResponse']['redirectInfo']['url'];
            $data = ['Code' => "200", "url" => $url];
            echo json_encode($data);
        }

    }
				
			
				
					
class PaymentPhonePe extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();
        
    }

    function success_course_payment_by_phonePe($payment_method = "")
    {
        $user_id = $this->uri->segment(3);
        $this->session->set_userdata('user_id', $user_id);
        $payment_details = $this->session->userdata('payment_details');
        $providerReferenceId = $_POST['providerReferenceId'];
        if ($_POST['code'] == 'PAYMENT_SUCCESS') {
            $this->session->set_flashdata('flash_message', site_phrase('payment_successfully_done'));
            redirect('home/my_courses', 'refresh');
        } else {
            $this->session->set_flashdata('error_message', site_phrase('an_error_occurred_during_payment'));
            redirect('home/shopping_cart', 'refresh');
        }
    }

}
				
			

If you want any help from my side please Email me on [email protected] OR WhatsApp Me On 6267465901

Payment Request Response Wityh Payment Gateway URL

Array ( [success] => 1 [code] => PAYMENT_INITIATED [message] => Payment initiated [data] => Array ( [merchantId] => MERCHANTUAT [merchantTransactionId] => MT785058104 [instrumentResponse] => Array ( [type] => PAY_PAGE [redirectInfo] => Array ( [url] => https://mercury-uat.phonepe.com/transact/simulator?token=BwDguDaJUIWnnpQ00uXbTv3mhxshgKVGO04bGjLHqbd [method] => GET ) ) ) )

Official Website = https://developer.phonepe.com/v1/reference/pay-api

phonepe payment gateway integration in php laravel phonepe integration phonepe payment gateway phonepe payment phonepe payment gateway example phonepe payment gateway integration in laravel payment gateway laravel payment gateway example payment gateway companies phonepe payment failed phonepe payment processing problem payment gateway in laravel laravel multiple payment gateway payment gateway laravel 10 laravel custom payment gateway integration phonepe latest version phonepe latest update payment processing in phonepe phonepe payment gateway charges payment gateway integration in laravel 10 Phone pe payment gateway Payu Payment Gateway Razorpay payment gateway Sab paisa payment gateway Payji payment gateway Insta mojo payment gateway Cash free payment gateway Paytm payment gateway Best payment gateway

8 Comments

  1. gold ira companiessays:

    Quality posts is the secret to be a focus for the viewers to pay a visit the
    website, that’s what this web site is providing.

  2. Celebs Networthsays:

    Hi Neat post There is a problem along with your website in internet explorer would test this IE still is the market chief and a good section of other folks will pass over your magnificent writing due to this problem

  3. Celebs Networthsays:

    Wonderful beat I wish to apprentice while you amend your web site how could i subscribe for a blog web site The account aided me a acceptable deal I had been a little bit acquainted of this your broadcast provided bright clear idea

  4. I was recommended this website by my cousin I am not sure whether this post is written by him as nobody else know such detailed about my difficulty You are wonderful Thanks

  5. firestickdownloadersays:

    Thank you for the good writeup It in fact was a amusement account it Look advanced to far added agreeable from you However how could we communicate

  6. Wonderful web site Lots of useful info here Im sending it to a few friends ans additionally sharing in delicious And obviously thanks to your effort

  7. british iptvsays:

    Nice blog here Also your site loads up fast What host are you using Can I get your affiliate link to your host I wish my web site loaded up as quickly as yours..

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock