Giter VIP home page Giter VIP logo

chenpay's Introduction

Composer 免签约支付宝与微信 带监听

  • 免签约支付宝
  • 免签约微信支付
  • 实时到帐个人账户
  • PHP程序自监听

讨论群

https://t.me/chenAirport

DEMO测试

https://pay.n2.nu

composer安装:

composer require chen-see/chen-pay

使用教程:

include __DIR__ . '/../vendor/autoload.php';
$aliCookie = '';
$wxCookie = '';

$GLOBALS['aliSum'] = 1;
ChenPay\Pay::Listen(10, function () use ($aliCookie) {
    // time 现在时间此为订单生成时间 默认3分钟有效时间
    $data = [['fee' => 0.01, 'time' => time() + 3 * 60]];
    try {
        $run = (new ChenPay\AliPay($aliCookie))->getData()->DataHandle();
        foreach ($data as $item) {
            $remarks = '123456'; //如果需要判断备注
            $order = $run->DataContrast($item['fee'], $item['time'], 5, $remarks);
            if ($order) echo "{$order}订单有效!备注:{$remarks}\n";
            unset($order, $item);// 摧毁变量防止内存溢出
        }
        echo $GLOBALS['aliSum'] . "次运行\n";
        $GLOBALS['aliSum']++;
    } catch (\ChenPay\PayException\PayException $e) {
        echo $e->getMessage() . "\n";
        unset($e);// 摧毁变量防止内存溢出
    }
    unset($run, $data);// 摧毁变量防止内存溢出
});

$GLOBALS['wxSum'] = 1;
$GLOBALS['syncKey'] = false;
ChenPay\Pay::Listen(10, function () use ($wxCookie) {
    // time 现在时间此为订单生成时间 默认3分钟有效时间
    $data = [['fee' => 0.01, 'time' => time() + 3 * 60]];
    try {
        $run = (new ChenPay\WxPay($wxCookie))->getData('wx.qq.com', $GLOBALS['syncKey'])->DataHandle();
        $GLOBALS['syncKey'] = $run->syncKey;
        foreach ($data as $item) {
            $remarks = '123456'; //如果需要判断备注
            $order = $run->DataContrast($item['fee'], $item['time'], 3, $remarks);
            if ($order) echo "{$order}订单有效!备注:{$remarks}\n";
            unset($order, $item);// 摧毁变量防止内存溢出
        }
        echo $GLOBALS['wxSum'] . "次运行\n";
        $GLOBALS['wxSum']++;
    } catch (\ChenPay\PayException\PayException $e) {
        echo $e->getMessage() . "\n";
        unset($e);// 摧毁变量防止内存溢出
    }
    unset($run, $data);// 摧毁变量防止内存溢出
});

获取支付宝COOKIE

获取微信COOKIE

运行:

# 前台运行
php test/test.php
# 后台运行
nohup php test/test.php &

注意:

  • 支付宝需开通商家服务 (手机支付宝搜索商家服务即可开通)
  • 根据备注可判断相同价格多人支付(出现相同价格的多并发支付时可要求用户输入随机数字备注解决该问题)
  • 两个支付必须分开运行,demo只是作为演示
  • 服务器时间必须是国内的时间,不然对不上支付宝微信时间
  • 如果使用框架运行可能存在内存溢出问题,可以使用Crontab,请自行去除ChenPay\Pay::Listen函数,变量需要另外选择存储方式mysql\redis等

更新日志:

V1.5

  • 新稳定支付宝接口无风控

V1.4

  • 修复支付宝风控规则更改

V1.3

  • 修复部分用户无法使用问题

V1.2

  • 增加判断备注&设置时区

V1.1.1

  • 应对11月支付宝升级导致账号失效问题

V1.0.9

  • 支付宝商户订单号改成支付宝交易号

V1.0.7

  • 10秒超时时间

V1.0.6

  • 增加支付宝频繁错误码446

V1.0.5

  • 更新支付宝双接口轮流切换API达到支付宝防止频繁访问阻止机制
  • 如果单一接口出现阻止则会持续使用另外接口

chenpay's People

Contributors

adming-zz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chenpay's Issues

遇到了比较尴尬的事情 超时了

服务器没有被墙,在国内,推出支付宝后cook失效了
cURL error 28: Resolving timed out after 10001 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
[root@cmmdwl test]# php test.php
cURL error 28: Resolving timed out after 10000 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
1次运行
2次运行
3次运行
4次运行
5次运行
6次运行
7次运行
8次运行
cURL error 28: Resolving timed out after 10001 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
9次运行
cookie失效

emm看不懂教程

看起来php只要执行wwwroot/default/vendor/chen-see/chen-pay/test/test.php
这个文件就可以了,
可是当我将支付宝的饼干导入进去时候并执行这个文件时候发现了他报错了?

[root@cmmdwl test]# php test.php
PHP Warning:  include(/www/wwwroot/default/vendor/chen-see/chen-pay/test/../vendor/autoload.php): failed to open stream: No such file or directory in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php on line 9

Warning: include(/www/wwwroot/default/vendor/chen-see/chen-pay/test/../vendor/autoload.php): failed to open stream: No such file or directory in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php on line 9
PHP Warning:  include(): Failed opening '/www/wwwroot/default/vendor/chen-see/chen-pay/test/../vendor/autoload.php' for inclusion (include_path='.:/www/server/php/71/lib/php') in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php on line 9

Warning: include(): Failed opening '/www/wwwroot/default/vendor/chen-see/chen-pay/test/../vendor/autoload.php' for inclusion (include_path='.:/www/server/php/71/lib/php') in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php on line 9
PHP Fatal error:  Uncaught Error: Class 'ChenPay\Pay' not found in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php:16
Stack trace:
#0 {main}
  thrown in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php on line 16

Fatal error: Uncaught Error: Class 'ChenPay\Pay' not found in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php:16
Stack trace:
#0 {main}
  thrown in /www/wwwroot/default/vendor/chen-see/chen-pay/test/test.php on line 16

研究了半天觉得是没有autoload.php文件
但是在/www/wwwroot/default/vendor
确实有一个autoload.php
本人新手,实在是看不出来问题了
并且搜索不到方法

QQ群

这么有意思的项目,为啥没人评论? 那个QQ群链接失效了,能否发下QQ群

how can i install it?

composer require chen-see/chen-pay

Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/bin/composer self-update" to get the latest version.
Using version ^1.2 for chen-see/chen-pay
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.

getData一直获取不到新的消息

我用python调用API,getData一直获取不到新消息,但是我请求的参数都是和PHP代码里面的一样的,作者能够给我一些帮助吗

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.