GithubHelp home page GithubHelp logo

sunjim / pay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kuif/pay

0.0 0.0 0.0 100 KB

相关支付信息的获取,封装微信(h5、jsapi、小程序、app等支付预退款回调),百度(小程序支付、回调、退款),字节跳动(小程序支付、退款、分账)等

License: MIT License

PHP 100.00%

pay's Introduction

Pay

Latest Stable Version Total Downloads Latest Unstable Version License

开发了多次支付,每次都要翻文档、找之前的项目复制过来,费时费事,为了便于支付的开发,干脆自己去造轮子,整合支付(微信、百度、字节跳动)相关开发。

!!请先熟悉 相关支付 说明文档!!请具有基本的 debug 能力!!

欢迎 Star,欢迎 PR!

特点

  • 丰富的扩展,支持微信、百度、字节跳动
  • 符合 PSR 标准,方便的与你的框架集成
  • 文件结构清晰,每个类单独封装扩展,便于单独使用

运行环境

  • PHP 7.0+
  • composer

支持的支付

1、微信(Wechat)

method 描述
js JSAPI下单
app APP支付
h5 H5支付
scan Navicat支付
xcx 小程序支付
query 查询订单
close 关闭订单
refund 申请退款
notify 支付结果通知

2、百度(Baidu)

method 描述
xcx 小程序支付
refund 申请退款
notify 支付结果通知

3、字节跳动(Bytedance)

method 描述
createOrder 下单支付
queryOrder 订单查询
notifyOrder 订单回调验证
createRefund 订单退款
queryRefund 退款查询
settle 分账请求
querySettle 分账查询

安装

composer require fengkui/pay

完善相关配置

# 微信支付配置
$wechatConfig = [
    'xcxid'         => '', // 小程序 appid
    'appid'         => '', // 微信支付 appid
    'mchid'         => '', // 微信支付 mch_id 商户收款账号
    'key'           => '', // 微信支付 apiV3key(尽量包含大小写字母,否则验签不通过)
    'appsecret'     => '', // 公众帐号 secert (公众号支付获取 code 和 openid 使用)

    'notify_url'    => '', // 接收支付状态的连接  改成自己的回调地址
    'redirect_url'  => '', // 公众号支付,调起支付页面

    'serial_no'     => '', // 证书序列号
    'cert_client'   => './cert/apiclient_cert.pem', // 证书(退款,红包时使用)
    'cert_key'      => './cert/apiclient_key.pem', // 商户私钥(Api安全中下载)
    'public_key'    => './cert/public_key.pem', // 平台公钥(调动证书列表,自动生成)
];
# 百度支付配置
$baiduConfig = [
    'deal_id'       => '', // 百度收银台的财务结算凭证
    'app_key'       => '', // 表示应用身份的唯一ID
    'private_key'   => '', // 私钥原始字符串
    'public_key'    => '', // 平台公钥
    'notify_url'    => '', // 支付回调地址
];
# 字节跳动支付配置
$bytedanceConfig = [
    'app_id'        => '', // App ID
    'salt'          => '', // 支付密钥值
    'notify_url'    => '', // 支付回调地址
    'thirdparty_id' => '', // 第三方平台服务商 id,非服务商模式留空
];

使用说明

单独使用

$pay = new \fengkui\Pay\Wechat($wechatConfig); // 微信
$pay = new \fengkui\Pay\Baidu($baiduConfig); // 百度
$pay = new \fengkui\Pay\Bytedance($bytedanceConfig); // 字节跳动

公共使用

<?php
/**
 * @Author: [FENG] <[email protected]>
 * @Date:   2021-06-01T14:55:21+08:00
 * @Last Modified by:   [FENG] <[email protected]>
 * @Last Modified time: 2021-06-15 15:39:01
 */

require_once('./vendor/autoload.php');

/**
 * 通用支付
 */
class Payment
{

}

赏一杯咖啡吧

LICENSE

MIT

pay's People

Contributors

kuif avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.