<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PhonePe Payment Gateway Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/phonepe-payment-gateway/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/phonepe-payment-gateway/</link>
	<description>Code Solution</description>
	<lastBuildDate>Thu, 22 Feb 2024 09:52:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>PhonePe Payment Gateway Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/phonepe-payment-gateway/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>PhonePe Payment Gateway PHP Example</title>
		<link>https://codeplaners.com/phonepe-payment-gateway-php-example/</link>
					<comments>https://codeplaners.com/phonepe-payment-gateway-php-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 22 Feb 2024 09:52:47 +0000</pubDate>
				<category><![CDATA[Codeplaners]]></category>
		<category><![CDATA[PhonePe Payment Gateway]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1707</guid>

					<description><![CDATA[<p>Hi Dev, Today, we will show you PhonePe Payment Gateway PHP Example. This article will give you simple example of PhonePe Payment Gateway PHP Example. Let&#8217;s discuss PhonePe Payment Gateway PHP Example. In this article, we will implement a PhonePe Payment Gateway PHP Example. So let’s follow few step to create example of PhonePe Payment &#8230; <a href="https://codeplaners.com/phonepe-payment-gateway-php-example/" class="more-link">Continue reading<span class="screen-reader-text"> "PhonePe Payment Gateway PHP Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/phonepe-payment-gateway-php-example/">PhonePe Payment Gateway PHP Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, we will show you PhonePe Payment Gateway PHP Example. This article will give you simple example of PhonePe Payment Gateway PHP Example. Let&#8217;s discuss PhonePe Payment Gateway PHP Example. In this article, we will implement a PhonePe Payment Gateway PHP Example.</p>
<p>So let’s follow few step to create example of PhonePe Payment Gateway PHP Example.</p>
<ul>
<li>Create a Business Account with PhonePe
<li>Generate API Keys</li>
<li>Use Below php code</li>
<li>Make API Requests</li>
<li>Handle the Payment Response</li>
<li>Test the Integration</li>
</ul>
<h3 class="step_code">Step 1: Install Payment</h3>
<p><strong>index.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

$jayParsedAry = &#x5B;
    &quot;merchantId&quot; =&gt; 'MERCHANTUAT', // &lt;THIS IS TESTING MERCHANT ID&gt;
    &quot;merchantTransactionId&quot; =&gt; rand(111111,999999),
    &quot;merchantUserId&quot; =&gt; 'MUID' . time(),
    &quot;amount&quot; =&gt; (1 * 100),
    &quot;redirectUrl&quot; =&gt;  '&lt;YOUR_SITE_REDIRECT_URL&gt;',
    &quot;redirectMode&quot; =&gt; &quot;POST&quot; // GET, POST DEFINE REDIRECT RESPONSE METHOD,
    &quot;redirectUrl&quot; =&gt;  '&lt;YOUR_SITE_CALLBACK_URL&gt;',
    &quot;mobileNumber&quot; =&gt; &quot;&lt;YOUT MOBILE NUMBER&gt;&quot;,
    &quot;paymentInstrument&quot; =&gt; &#x5B;
        &quot;type&quot; =&gt; &quot;PAY_PAGE&quot;
    ]
];

$encode = json_encode($jayParsedAry);
$encoded = base64_encode($encode);
$key = '099eb0cd-02cf-4e2a-8aca-3e6c6aff0399'; // KEY
$key_index = 1; // KEY_INDEX
$string = $encoded . &quot;/pg/v1/pay&quot;.$key;
$sha256 = hash(&quot;sha256&quot;, $string);
$final_x_header = $sha256 . '###'.$key_index;

// $url = &quot;https://api.phonepe.com/apis/hermes/pg/v1/pay&quot;; &lt;PRODUCTION URL&gt;

$url = &quot;https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/pay&quot;; // &lt;TESTING URL&gt;

$headers = array(
    &quot;Content-Type: application/json&quot;,
    &quot;accept: application/json&quot;,
    &quot;X-VERIFY: &quot; . $final_x_header,
);

$data = json_encode(&#x5B;'request' =&gt; $encoded]);

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

$resp = curl_exec($curl);

curl_close($curl);

$response = json_decode($resp);

header('Location:' . $response-&gt;data-&gt;instrumentResponse-&gt;redirectInfo-&gt;url);
</pre>
<h3 class="step_code">Step 2: Handle Payment Response</h3>
<p><strong>response.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

$key = '099eb0cd-02cf-4e2a-8aca-3e6c6aff0399'; // KEY
$key_index = 1; // KEY_INDEX

$response = $_POST; // FETCH DATA FROM DEFINE METHOD, IN THIS EXAMPLE I AM DEFINING POST WHILE I AM SENDING REQUEST

$final_x_header = hash(&quot;sha256&quot;, &quot;/pg/v1/status/&quot; . $response&#x5B;'merchantId'] . &quot;/&quot; . $response&#x5B;'transactionId'] . $key_index) . &quot;###&quot; . $key;

$url = &quot;https://api-preprod.phonepe.com/apis/pg-sandbox/pg/v1/status/&quot;.$response&#x5B;'merchantId'].&quot;/&quot;.$response&#x5B;'transactionId']; // &lt;TESTING URL&gt;

$headers = array(
    &quot;Content-Type: application/json&quot;,
    &quot;accept: application/json&quot;,
    &quot;X-VERIFY: &quot; . $final_x_header,
    &quot;X-MERCHANT-ID:&quot;. $response&#x5B;'merchantId']
);

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

$resp = curl_exec($curl);

curl_close($curl);

$responsePayment = json_decode($resp, true);
// HANDLE YOUR PHONEPAY RESPONSE
</pre>
<p><strong>I hope it will assist you…</strong></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/phonepe-payment-gateway-php-example/">PhonePe Payment Gateway PHP Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/phonepe-payment-gateway-php-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
