1. Go to this page and download the library: Download wmsn-web/sdk-for-phonepe library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wmsn-web / sdk-for-phonepe example snippets
use WsmnWeb\SdkForPhonepe\PhonePe;
D','PHONEPE_SALTKEY',PHONEPE_SALTINDEX);//merchantId,SaltKey,SaltIndex after onboarding PhonePe Payment gateway you will got this.
$merchantTransactionId='MUID' . substr(uniqid(), -6);// Uqique Randoe transcation Id
$merchantOrderId='Order'.mt_rand(1000,99999);// orderId
$amount=100;// Amount in Paisa or amount*100
$redirectUrl="/success.php";// Redirect Url after Payment success or fail
$mode="PRODUCTION"; // MODE or PAYMENT UAT(test) or PRODUCTION(production)
$callbackUrl="/success.php";//Callback Url after Payment success or fail get response
$mobileNumber=9876543210;//Mobile No
$data=$config->PaymentCall("$merchantTransactionId","$merchantOrderId","$amount","$redirectUrl","$callbackUrl","$mobileNumber","$mode");// call function to get response form phonepe like url,msg,status
//header('Location:'. $data['url']);//use when you directly want to redirect to phonepe gateway
echo $data['url']; // here you get url after initiated PhonePe gateway