定制 shibanashiqc/phone-pay-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shibanashiqc/phone-pay-php

最新稳定版本:v1.0.7

Composer 安装命令:

composer require shibanashiqc/phone-pay-php

包简介

PhonePay PHP Library by Shiban Ashiq

README 文档

README

Laravel Sample Repo: Click Here

Unofficial PHP library for PhonePe.

Read up here for getting started and understanding the payment flow with PhonePe: https://developer.phonepe.com/v1/docs/api-integration

Prerequisites

  • A minimum of PHP 8.1 is required.

Installation

  • If your project using composer, run the below command
composer require shibanashiqc/phone-pay-php
  • If you are not using composer, download the latest release from the releases section. You should download the phone-pay-php.zip file. After that, include Phonepay.php in your application and you can use the API as usual.

##Note: This PHP library follows the following practices:

  • Namespaced under Shibanashiqc\PhonePayPhp\
  • API throws exceptions instead of returning errors
  • Options are passed as an array instead of multiple arguments wherever possible
  • All requests and responses are communicated over JSON

Documentation

Documentation of PhonePe's API and their usage is available at https://developer.phonepe.com/v1/docs/api-integration

Basic Usage

Merchant credentials can be obtained from the PhonePay Developer Dashboard. You can use the following credentials for testing:

Required parameters for the constructor are: Merchant ID, Merchant Salt Key, Environment

use Shibanashiqc\PhonePayPhp\PhonePay;

$phone_pay = new PhonePay('MERCHAN', 'saltKey-0000', 1);
// $phone_pay->client->setAsDefaultBaseUrl(); // if you got production keys the enable this
$phone_pay->client->setCallbackUrl('https://site/phonepay/callback');
$phone_pay->client->setRedirectUrl('https://site/phonepay/callback');

Create a Payment

getPaymentRequest() on this function first parameter is amount, second parameter is merchant transaction id, third parameter is user unique id, fourth parameter is user mobile number only required parameter is amount other parameter is optional

$request = $phone_pay->getPaymentRequest(1, '1234567890', '1234567890', '9999999999');
$redirect_url = $phone_pay->getPaymentRedirectUrl($request);
echo $redirect_url; 

redirect url to redirect your user to phonepay payment page complete the payment after payment complete phonepay will redirect to your callback url with payment details

License

The PhonePay PHP SDK is released under the MIT License. See LICENSE file for more details.

统计信息

  • 总下载量: 113
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-23