dwivedianuj9118/phonepe-payment-gateway

处理 PhonePe 付款的 PhonePe 付款集成类

dev-main 2024-09-01 23:05 UTC

This package is auto-updated.

Last update: 2024-09-01 23:05:33 UTC


README

这是 PhonePe API 的 PhonePe 付款网关 SDK。

UI 流程

Standard Checkout Standard Checkout Standard Checkout Standard Checkout Standard Checkout Standard Checkout

关于 PhonePe

PhonePe 是印度最值得信赖的数字支付合作伙伴。为了帮助您开展业务,我们推出了 PhonePe 付款网关。这可以帮助您无缝处理来自客户的100%在线付款,并且绝对安全。我们还配备了处理大规模交易的最佳成功率。

PhonePe 提供什么?

灵活集成:我们预先构建的结账集成可以轻松适应任何业务需求。用户友好的 SDK 和插件:轻松集成到任何网络平台和移动应用程序中。广泛的支付方式:通过借记卡/信用卡、UPI 和网上银行接受付款。用户友好的仪表板:有效地管理和跟踪您的交易、结算、退款和客户问题。

贡献

欢迎提交拉取请求。我已经用干净的代码编写,并针对开发者和初学者用户友好,易于使用和实施。我还多次测试了我们的代码,它更适合使用。

如果您使用其他任何支付方式,请提交带有您解决方案的拉取请求,我将合并它。

安装

composer require dwivedianuj9118/phonepe-payment-gateway dev-main

使用

PhonePe PAY API

  • 创建 index.php
<?php
use Dwivedianuj9118\PhonePePaymentGateway\PhonePe;

require __DIR__ . '/vendor/autoload.php';

$config = new PhonePe('PHONEPE_MERCHANTID','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

PhonePe 状态检查 API

<?php
use Dwivedianuj9118\PhonePePaymentGateway\PhonePe;

require __DIR__ . '/vendor/autoload.php';

$config = new PhonePe('PHONEPE_MERCHANTID','PHONEPE_SALTKEY',PHONEPE_SALTINDEX);

$check=$config->PaymentStatus('PHONEPE_MERCHANTID',$merchantTransactionId,$mode);
  if($check['status']=='SUCCESS' && $check['responseCode']==200) {
  return 'Payment Success';
}else{
return 'Payment Failed';
}

PhonePe 退款 API

<?php
use Dwivedianuj9118\PhonePePaymentGateway\PhonePe;

require './vendor/autoload.php';

$config = new PhonePe('PHONEPE_MERCHANTID','PHONEPE_SALTKEY',PHONEPE_SALTINDEX);
$refundid='REFUND'.rand(1000,9999);
$callbackUrl='';//callback url to get response use webhook site https://webhook.site

$refund=$config->PaymentRefund('PHONEPE_MERCHANTID',$refundid, merchantTransactionId,$callbackUrl,$amount, $mode);
print_r($refund);