PHPackages                             ashin33/qn-api - 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. ashin33/qn-api

ActiveLibrary

ashin33/qn-api
==============

qn-api SDK

1.4.1(2y ago)213MITPHP

Since Mar 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/alon-1993/qn-api)[ Packagist](https://packagist.org/packages/ashin33/qn-api)[ RSS](/packages/ashin33-qn-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (12)Used By (0)

 qn-api SDK
===========

[](#-qn-api-sdk)

 清宁云服api接口SDK

- [安装](#%E5%AE%89%E8%A3%85)
- [请求可用方法](#%E8%AF%B7%E6%B1%82%E5%8F%AF%E7%94%A8%E6%96%B9%E6%B3%95)
- [响应可用方法](#%E5%93%8D%E5%BA%94%E5%8F%AF%E7%94%A8%E6%96%B9%E6%B3%95)
- [用法示例](#%E7%94%A8%E6%B3%95%E7%A4%BA%E4%BE%8B)
- [在laravel中使用](#%E5%9C%A8laravel%E4%B8%AD%E4%BD%BF%E7%94%A8)
    - [发布配置文件](#%E5%8F%91%E5%B8%83%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6)
    - [使用](#%E4%BD%BF%E7%94%A8)
- [更新扩展包](#%E6%9B%B4%E6%96%B0%E6%89%A9%E5%B1%95%E5%8C%85)

安装
--

[](#安装)

```
$ composer require ashin33/qn-api -vvv
```

请求可用方法
------

[](#请求可用方法)

方法名称中文名称说明request发送请求加密请求参数并请求清宁云服,并解密返回参数decrypt解密返回解密清宁云服返回参数,同样适用于异步回调的解密register⾃由职业者注册单人注册batchRegister⾃由职业者批量注册多人批量注册注册batchRegisterQuery⾃由职业者批量注册查询多人批量注册查询idCardUpload个⼈身份证上传url格式上传身份证附件idCardFileUpload个⼈身份证上传&lt;表单文件&gt;表单格式上传身份证附件createTask新建任务需求新建任务需求taskList任务需求查询查询已建立的任务需求invoiceCategoryList发票类目查询税源地可用开票类目查询taxSourceList税源地查询可用税源地及打款信息查询settlement上传结算单批量结算settlementQuery结算查询按批次查询接口结果settlementSingleQuery结算单笔查询按商户流水号查询单笔结算balanceQuery余额查询商户余额查询rechargeList充值流水查询商户充值流水查询settlementList结算流水查询历史结算明细查询invoiceApply开票申请开票申请invoiceQuery开票申请查询开票申请结果查询merchantApply商户进件使用当前商户,推荐其他商户进件merchantQuery商户进件查询查询进件结果merchantSign发送企业签约短信发送当前企业与税源地的签约短信,部分税源地不支持merchantSignQuery签约查询企业与税源地的签约查询响应可用方法
------

[](#响应可用方法)

方法名称中文名称说明isSuccess判断响应是否成功接收响应后,根据响应码判断接口请求是否成功isFail判断响应是否失败接收响应后,根据响应码判断接口请求是否失败getReason获取接口响应失败原因响应失败后,使用该方法获取失败原因toJsonString响应格式化为json接收响应后,可将响应报文转化为json格式的字符串用法示例
----

[](#用法示例)

> 具体使用请参考 [调用示例](https://github.com/ashin33/qn-api/blob/master/src/tests/QnApiTest.php)，支持使用request方法发起SDK中未定义的接口请求

```
$host = '清宁云服分配的实际请求域名';
$qnPublicKey = '***.key';//清波公钥(文件路径或行内秘钥字符串)
$merchantPrivateKey = '***.key';//商户私钥(文件路径或行内秘钥字符串)
$instId = '********';//清波分配的商户id
$secret = '*************************';//清波分配的秘钥
$api = new Ashin33\QnApi\QnApi(
    $instId,
    $secret,
    $qnPublicKey,
    $merchantPrivateKey,
    $host
);

$data = [
    "customer_name" => "安*",
    "cert_no" => "1301****7389",
    "customer_mobile" => "156****6907",
    "bank_card_no" => "6215****4390",
    "bank_phone" => "156****6907"
];
$res = $api->register($data);
var_dump($res->isSuccess());//判断接口请求是否成功
```

在laravel中使用
-----------

[](#在laravel中使用)

### 发布配置文件

[](#发布配置文件)

执行 `php artisan vendor:publish --tag=qn-api` 命令,在configs目录下生成qn-api.php文件,按需修改参数

### 使用

[](#使用)

```
use Ashin33\QnApi\Facades\QnApi;

$data = [
    "customer_name" => "安*",
    "cert_no" => "1301****7389",
    "customer_mobile" => "156****6907",
    "bank_card_no" => "6215****4390",
    "bank_phone" => "156****6907"
];
$res = QnApi::register($data);
var_dump($res->isSuccess());
```

更新扩展包
-----

[](#更新扩展包)

```
$ composer update ashin33/qn-api
```

贡献
--

[](#贡献)

您可以通过以下三种方式之一做出贡献:

1. 使用 [issue tracker](https://github.com/ashin33/qn-api/issues) 上报bug.
2. 在 [issue tracker](https://github.com/ashin33/qn-api/issues) 中回复问题或bug.
3. 贡献新功能或更新 wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

证书
--

[](#证书)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~74 days

Recently: every ~56 days

Total

10

Last Release

843d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2aa81c91f53381022efe3e1aca25f2ddd8c6e1e546b7c3e649e3a6afed8247b1?d=identicon)[alon-1993](/maintainers/alon-1993)

---

Top Contributors

[![AAAAAAlon](https://avatars.githubusercontent.com/u/47770256?v=4)](https://github.com/AAAAAAlon "AAAAAAlon (25 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ashin33-qn-api/health.svg)

```
[![Health](https://phpackages.com/badges/ashin33-qn-api/health.svg)](https://phpackages.com/packages/ashin33-qn-api)
```

PHPackages © 2026

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