PHPackages                             jitepay/jitepay-sdk-php - 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. jitepay/jitepay-sdk-php

ActiveProject[Payment Processing](/categories/payments)

jitepay/jitepay-sdk-php
=======================

v1.0.1(3y ago)05MITPHP

Since Jan 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ply1222/jitepay-sdk-php)[ Packagist](https://packagist.org/packages/jitepay/jitepay-sdk-php)[ RSS](/packages/jitepay-jitepay-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

jitepay-sdk-php项目
-----------------

[](#jitepay-sdk-php项目)

### 概览

[](#概览)

#### 功能介绍

[](#功能介绍)

1. 实现吉特支付jsapi下单功能
2. 实现吉特支付退款功能
3. 敏感信息加解密
4. 回调通知的验签和解密
5. 付款到银行卡功能

#### 安装

[](#安装)

推荐使用PHP包管理工具Composer安装SDK:

#### 开始

[](#开始)

私钥:$private\_key 公钥:$public\_key 商户API证书序列号:$serial\_no AES key:$aes\_key

### 文档

[](#文档)

#### Jsapi下单

[](#jsapi下单)

```
public function jsapi()
{
    $aop = $this->aop;
    $aop->method = 'POST';
    $aop->gatewayUrl = $this->host . '/v1/pay/transactions/jsapi';
    $request = new PrepayRequest();
    $request->setBizContent(json_encode([
        "amount" => [
            "total" => 0.01,// 订单总金额
            "currency" => "CNY",
        ],
        "channel" => "wx_pub",
        "appid" => "2",
        "mchid" => "2",
        "description" => "test",
        "notify_url" => $aop->notify_url,
        "out_trade_no" => date('YmdHis'),
        "payer" => [
            "openid" => ""
        ],
        "scene_info" => [
            "payer_client_ip" => "127.0.0.1"
        ],
        "settle_info" => [
            "profit_sharing" => ""
        ]
    ]));
    $aop->pay($request);
}
```

#### 订单查询

[](#订单查询)

```
public function queryOrder()
{
    $aop = $this->aop;
    $aop->method = 'GET';
    $mchid = "2";
    $aop->gatewayUrl = $this->host . '/v1/pay/transactions/out-trade-no/202212150958497173?mchid=' . $mchid;
    $aop->execute('');
}
```

#### 退款订单

[](#退款订单)

```
public function refund()
{
    $aop = $this->aop;
    $aop->method = 'POST';
    $aop->gatewayUrl = $this->host . '/v1/refund/domestic/refunds';
    $request = new RefundRequset();
    $request->setBizContent(json_encode([
        "amount" => [
            "refund" => 0.1,//退款金额
            "total" => 0.1,// 订单总金额
            "currency" => "CNY",//退款币种
        ],
        "reason" => "test",//退款原因
        "funds_account" => "AVAILABLE",
        "notify_url" => $aop->notify_url,
        "out_refund_no" => "",
        "out_trade_no" => "",
        "goods_detail" => [
            "merchant_goods_id" => "111",
            "wechatpay_goods_id" => "",
            "goods_name" => "",
            "unit_price" => "",
            "refund_amount" => 0.1,
            "refund_quanity" => 1,
        ]
    ]));
    $aop->refundOrder($request);
}
```

#### 退款订单查询

[](#退款订单查询)

```
public function queryRefund()
{
    $aop = $this->aop;
    $aop->method = 'GET';
    $mchid = "2";
    $aop->gatewayUrl = $this->host . '/v1/refund/domestic/refunds/15452665465296598998?mchid=' . $mchid;
    $aop->execute('');
}
```

#### 转账

[](#转账)

```
public function payBank()
{
    $aop = $this->aop;
    $aop->method = 'POST';
    $aop->gatewayUrl = $this->host . '/v1/pay/pay_bank';
    $request = new PayBankRequest();
    $request->setBizContent(json_encode([
        "mchid" => "2",
        "appid" => "2",
        "out_trade_no" => "46226621656665566595",
        "description" => "test",
        "bank_no" => "6236691370002321599",
        "true_name" => "彭玲艳",
        "bank_code" => "CCB",
        "bank_name" => "中国建设银行",
        "bank_province" => "江苏省",
        "bank_city" => "南京",
        "bank_branch_name" => "建行",
        "amount" => "0.1",
        "notify_url" => $aop->notify_url,
    ]));
    $aop->withdraw($request);
}
```

#### 转账查询

[](#转账查询)

```
public function queryPayBank()
{
    $aop = $this->aop;
    $aop->method = 'GET';
    $mchid = "2";
    $aop->gatewayUrl = $this->host . '/v1/pay/query_bank/46226621656665566595?mchid=' . $mchid;
    $aop->execute();
}
```

#### 敏感信息加/解密

[](#敏感信息加解密)

为了保证通信过程中的敏感信息字段(如用户的真实姓名,银行卡号)

下面以提现到银行卡为例,演示如何进行敏感信息加解密:

```
use Jitepay\JitepaySdkPhp\Util\RSAUtil;

$array = json_decode($request->getBizContent(),true);
$body = [
    "mchid" => $array['mchid'],
    "appid" => $array['appid'],
    "out_trade_no" => $array['out_trade_no'],
    "description" => $array['description'],
    "bank_no" => $this->getEncrypt($array['bank_no']),
    "true_name" => $this->getEncrypt($array['true_name']),
    "bank_code" => $array['bank_code'],
    "bank_name" => $array['bank_name'],
    "bank_province" => $array['bank_province'],
    "bank_city" => $array['bank_city'],
    "bank_branch_name" => $array['bank_branch_name'],
    "amount" => $array['amount'],
    "notify_url" => $array['notify_url'],
];
$this->execute($body);
```

#### 签名

[](#签名)

你可以使用AopClient::getSign()调起支付是所需的参数签名

```
use Jitepay\JitepaySdkPhp\AopClient;

$mch_private_key = $this->private_key;
$mch_private_key = chunk_split($mch_private_key, 64, "\n");
$mch_private_key = "-----BEGIN RSA PRIVATE KEY-----\n" . $mch_private_key . "-----END RSA PRIVATE KEY-----\n";
$pi_key = openssl_pkey_get_private($mch_private_key);
if (!$pi_key) die('$pi_key 格式不正确');
//$mch_private_key = file_get_contents($this->private_key);
$message = $this->appid . "\n" .
    $data['timestamp'] . "\n" .
    $data['noncestr'] . "\n" .
    $data['prepayid'] . "\n";
openssl_sign($message, $raw_sign, $mch_private_key, 'sha256WithRSAEncryption');
return base64_encode($raw_sign);
```

#### 回调通知验证及解密

[](#回调通知验证及解密)

回调通知受限于开发者/商户数所使用的WebServer有很大差异,这里只给开发指导步骤,以供开发实现.

1. 从请求头部Header,拿到Pay-Signature、Pay-Nonce、Pay-Timestamp、Pay-Serial，商户侧Web解决方案可能有差异，请求头可能大小写不敏感，请根据自身应用来决定；
2. 获取请求body体的JSON纯文本；
3. 验证Pay-signature签名是否正确；需要用到验签密钥$public\_key;
4. 消息体$body解密,需要用到aesKey($api\_key); 样例代码如下:

```
require_once(dirname(__FILE__).'/../src/AopClient.php');

// 检查平台证书序列号
$post = $this->aop->verifyNotify($post);
$body = json_decode($post['body'], true);
if ($body['event_type'] == 'TRANSACTION.SUCCESS') {
    $resource = $this->aop->decryptToString($body['resource']['associated_data'], $body['resource']['nonce'], $body['resource']['ciphertext']);
    $resource = json_decode($resource, true);
    // 通知类型:支付通知,退款通知
    if ($resource['trade_state'] == 'SUCCESS' || $resource['trade_state'] == 'REFUND.SUCCESS') {
        return $resource;
        // 用户微信绑定openid
        //$openid = $resource['payer']['openid'];
    }
}
return $body;
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Unknown

Total

1

Last Release

1219d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f225e45d6866abab20d31cb74108d34d07f11aa6336d836567650d503262d372?d=identicon)[ply1222](/maintainers/ply1222)

---

Top Contributors

[![ply1222](https://avatars.githubusercontent.com/u/121596105?v=4)](https://github.com/ply1222 "ply1222 (13 commits)")

### Embed Badge

![Health badge](/badges/jitepay-jitepay-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/jitepay-jitepay-sdk-php/health.svg)](https://phpackages.com/packages/jitepay-jitepay-sdk-php)
```

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