PHPackages                             achais/lianlianpay - 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. achais/lianlianpay

ActiveLibrary[Payment Processing](/categories/payments)

achais/lianlianpay
==================

连连支付 SDK for PHP.

3872[1 issues](https://github.com/achais/lianlianpay/issues)PHP

Since May 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/achais/lianlianpay)[ Packagist](https://packagist.org/packages/achais/lianlianpay)[ RSS](/packages/achais-lianlianpay/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

 LianLianPay
=============

[](#-lianlianpay-)

 连连支付 SDK for PHP..

 让你忽略第三方的 Http 请求规则、加密方式和加密实现, 只需关注自己的业务代码

安装
--

[](#安装)

```
$ composer require achais/lianlianpay:dev-master -vvv
```

使用
--

[](#使用)

配置信息和实例化

```
use Achais\LianLianPay\LianLianPay;

$config = [
    'debug' => true, // 开启调试

    // 实时付款参数
    'instant_pay' => [
        'oid_partner' => env('LLP_IP_OID_PARTNER'), // 商户号
        'private_key' => env('LLP_IP_PRIVATE_KEY'), // 商户私钥
        'public_key' => env('LLP_IP_PUBLIC_KEY'), // 商户公钥
        'll_public_key' => env('LLP_IP_LL_PUBLIC_KEY'), // 连连支付公钥
        'production' => env('LLP_IP_PRODUCTION', false), // 是否生产环境
        'notify_url' => 'http://localhost/', // 付款结果异步回调地址
    ],

    // 日志
    'log' => [
        'level' => 'debug',
        'permission' => 0777,
        'file' => '/tmp/logs/lianlianpay-' . date('Y-m-d') . '.log', // 日志文件, 你可以自定义
    ],
];

$llp = new LianLianPay($config);
```

> 不管使用什么功能, 配置信息和实例化 LianLianPay 是必须的

### 实时付款

[](#实时付款)

实时付款功能服务提供者`\Achais\LianLianPay\InstantPay\InstantPay`所有方法和参数可看源码.

#### 付款申请

[](#付款申请)

```
use Achais\LianLianPay\LianLianPay;

$config = []; // 配置信息如上
$llp = new LianLianPay($config);

$moneyOrder = '0.02'; // 付款金额
$cardNo ='6212261203****'; // 收款卡号
$acctName = '起风'; // 收款人姓名
$infoOrder = '代付'; // 订单描述。说明付款用途，5W以上必传。
$memo = '余额提现'; // 收款备注。 传递至银行， 一般作为订单摘要展示。

$ret = $llp->instantPay->payment($moneyOrder, $cardNo, $acctName, $infoOrder, $memo); // 付款申请

结果:
Collection {#287 ▼
  #items: array:7 [▼
    "confirm_code" => "836765"
    "no_order" => "202004021****"
    "oid_partner" => "20190902****"
    "ret_code" => "4002"
    "ret_msg" => "疑似重复提交订单"
    "sign" => "W4Y4R6rjyWJYupN508Q5E1****"
    "sign_type" => "RSA"
  ]
}
```

> 只要不是报 HttpException 都是请求成功, 返回码 0000 一次性提交成功, 返回码 4002, 4003, 4004 是疑似重复提交订单需要二次确认付款, 见下一个接口

#### 确认付款

[](#确认付款)

```
use Achais\LianLianPay\LianLianPay;

$config = []; // 配置信息
$llp = new LianLianPay($config);

$noOrder = '202004021****'; // 付款申请接口返回的 商户订单号
$confirmCode = '836765'; // 付款申请接口返回的 确认码
$ret = $llp->instantPay->confirmPayment($noOrder, $confirmCode); // 确认付款

结果:
Collection {#288 ▼
  #items: array:7 [▼
    "no_order" => "2020040210****"
    "oid_partner" => "201909021****"
    "oid_paybill" => "20200402****"
    "ret_code" => "0000"
    "ret_msg" => "交易成功"
    "sign" => "dU0gfuAoevbuMcWb5k9HnoE****"
    "sign_type" => "RSA"
  ]
}
```

> 疑似重复提交订单经过确认付款才是真的提交成功, 但是.. 不代表付款成功, 付款结果需要你主动拿商户订单号去查询, 或者等待连连支付异步回调

### 付款结果查询

[](#付款结果查询)

付款结果查询接口适用于异常情况或者订单处于半小时还没通知的情况, 正常情况由连连异步通知修改订单状态

付款结果查询接口返回`ret_code=0000`时根据订单状态处理，返回`ret_code=8901`没有记录。

```
use Achais\LianLianPay\LianLianPay;

$config = []; // 配置信息
$llp = new LianLianPay($config);

$noOrder = '2020040210****'; // 商户订单号
$ret = $llp->instantPay->queryPayment($noOrder); // 付款结果查询

结果:
Collection {#289 ▼
  #items: array:12 [▼
    "dt_order" => "2020040210****"
    "info_order" => "代付"
    "money_order" => "0.02"
    "no_order" => "202004021****"
    "oid_partner" => "201909021****"
    "oid_paybill" => "20200402****"
    "result_pay" => "SUCCESS"
    "ret_code" => "0000"
    "ret_msg" => "交易成功"
    "settle_date" => "20200402"
    "sign" => "bvKk+mfPwuwXRwNwZEi****"
    "sign_type" => "RSA"
  ]
}
```

> 查询时间距离付款请求时间半个小时返回`ret_code=8901`无记录才能置为失败。
> 付款结果， 结果以 result\_pay 字段为准， 详情可参考付款类订单状态说明。

文档
--

[](#文档)

更多功能介绍请看源码或 Wiki.

贡献
--

[](#贡献)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/achais/lianlianpay/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/achais/lianlianpay/issues).
3. Contribute new features or update the 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.*

License
-------

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7384071?v=4)[起风](/maintainers/achais)[@achais](https://github.com/achais)

### Embed Badge

![Health badge](/badges/achais-lianlianpay/health.svg)

```
[![Health](https://phpackages.com/badges/achais-lianlianpay/health.svg)](https://phpackages.com/packages/achais-lianlianpay)
```

###  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)
