PHPackages                             code-lives/kuaishou - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. code-lives/kuaishou

ActiveLibrary[Payment Processing](/categories/payments)

code-lives/kuaishou
===================

快手小程序（支付、手机号解密、获取Token、模版消息、支付异步通知、退款、订单查询）

1.0.2(1y ago)1563—0%1MITPHP

Since Jul 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/code-lives/kuaishou)[ Packagist](https://packagist.org/packages/code-lives/kuaishou)[ RSS](/packages/code-lives-kuaishou/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (1)

[![GitHub forks](https://camo.githubusercontent.com/683f51e4634cc735d2759a4d0939d8fe52f6761d842796b4123b260554a587d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64652d6c697665732f6b75616973686f753f696e636c7564655f70726572656c6561736573)](https://packagist.org/packages/code-lives/kuaishou)[![GitHub forks](https://camo.githubusercontent.com/de612d5544cf7bb8581c428e486253f8a19db13aa8585a0e8af7512531d32ea1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f636f64652d6c697665732f6b75616973686f753f7374796c653d736f6369616c)](https://packagist.org/packages/code-lives/kuaishou)[![GitHub forks](https://camo.githubusercontent.com/4af75b9b7600a8c927b0c1af2413903df2f9d8df7e026c9137a73432c15bfd2d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f636f64652d6c697665732f6b75616973686f753f7374796c653d736f6369616c)](https://github.com/code-lives/kuaishou/fork)

第三方tokenopenid支付回调退款订单查询解密手机号分账模版消息[快手小程序](https://mp.kuaishou.com/docs/develop/server/epay/interfaceDefinition.html)✓✓✓✓✓✓✓✓✓安装
--

[](#安装)

```
composer require code-lives/kuaishou 1.0.0
```

### ⚠️ 注意

[](#️-注意)

> 金额单位分 100=1 元

> 返回结果 array 由开发者自行判断

预下单
===

[](#预下单)

```
//引入命名空间
use Applet\Assemble\Kuaishou;

// 小程序下单
$pay= Kuaishou::init($config)->set("订单号","金额","描述",'openid', 'access_token')->getParam();
```

### Token

[](#token)

```
$code="";
$data= Kuaishou::init($config)->getToken();
```

### Config

[](#config)

参数名字类型必须说明app\_idint是小程序 appidapp\_secretint是小程序 secretnotify\_urlstring是回调地址settle\_urlstring是结算回调地址，没有就默认 notify\_urltypeint是类目### Openid

[](#openid)

```
$code="";
$data= Kuaishou::init($config)->getOpenid($code);
```

返回参数类型必须说明session\_keystring是session\_keyopenidstring是用户 open\_idresultstring是状态 1 是成功### 解密手机号

[](#解密手机号)

```
$data= Kuaishou::init($config)->decryptPhone($session_key, $iv, $encryptedData);
echo $phone['phoneNumber'];
```

### 订单查询

[](#订单查询)

```
$data = Kuaishou::init($config)->findOrder("订单号",$access_token);
```

### 退款

[](#退款)

参数名字类型必须说明out\_trade\_nostring是平台订单号out\_refund\_nostrging是自定义订单号refund\_amountint是退款金额reasonstring是退款原因access\_tokenstring是access\_tokenattachstring否自定义```
$orders = [
        'out_order_no' => $order['out_order_no'],
        'out_refund_no' => $order['out_refund_no'],
        'reason' => $order['reason'],
        'attach' => $order['attach'],
    ];
$data= Kuaishou::init($config)->applyOrderRefund($order);
```

### 结算

[](#结算)

参数名字类型必须说明out\_order\_nostring是平台订单号out\_settle\_nostring是自定义订单号reasonstring是退款原因access\_tokenstring是access\_tokenattachstring否自定义```
//注意 需要设置回调 notify_url  在config 设置 settle_url 如果没有 默认为 notify_url
$orders = [
        'out_order_no' => $order['out_order_no'],
        'out_settle_no' => $order['out_settle_no'],
        'reason' => $order['reason'],
        'attach' => $order['attach'],
    ];
$data= Kuaishou::init($config)->settle($order,$access_token);
```

### 订单信息同步

[](#订单信息同步)

参数名字类型必须说明out\_biz\_order\_nostring是展示在用户端的唯一订单号out\_order\_nostring是小程序预下单支付订单号open\_idstring是订单对应的用户 open idorder\_create\_timestring是订单创建时间order\_statusstring否订单状态order\_pathstring是小程序路径product\_cover\_img\_idstring是图片 id```
$order = [
        'out_biz_order_no' => '',
        'out_order_no' => '',
        'open_id' => '',
        'order_create_time' => time(),
        'order_status' => 6,
        'order_path' => '',
        'product_cover_img_id' =>'',
    ];
$data = Kuaishou::init($config)->synchronousOrder($order, $token);
```

### 图片上传(订单信息同步)

[](#图片上传订单信息同步)

```
$data = Kuaishou::init($config)->imgUpload('图片路径', $token);
```

### 模版消息

[](#模版消息)

```
$data = [
    "open_id" => "",
    "tpl_id" => "",
    "page" => "pages/index/index",
    "data" => [
        'key1' =>  "第一个",
        'key2' =>  "第二个",
        'key3' =>  "第三个",
    ]
];
$data= Kuaishou::init($config)->sendMsg($data,$token);
$data=[
    "err_no" => 1001,
    "err_tips" => "该用户未订阅"
]
```

### 支付回调

[](#支付回调)

```
$pay = Kuaishou::init($config);
$status = $pay->notifyCheck(); //验证
if ($status) {
    $order = $pay->getNotifyOrder(); //订单数据
    //$order['data']['out_order_no']//平台订单号
    echo json_encode(['result' => 1, 'message_id' => $order['message_id']]);exit;
}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~172 days

Total

3

Last Release

682d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66c8ab94602f8fde6cbb339ec8b9b0dbd178b1aeab8973d957e3903d14e2b7be?d=identicon)[code-lives](/maintainers/code-lives)

---

Top Contributors

[![code-lives](https://avatars.githubusercontent.com/u/79346591?v=4)](https://github.com/code-lives "code-lives (7 commits)")[![LeeCodeLives](https://avatars.githubusercontent.com/u/28551829?v=4)](https://github.com/LeeCodeLives "LeeCodeLives (4 commits)")

### Embed Badge

![Health badge](/badges/code-lives-kuaishou/health.svg)

```
[![Health](https://phpackages.com/badges/code-lives-kuaishou/health.svg)](https://phpackages.com/packages/code-lives-kuaishou)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
