six-shop/wechatpay

微信支付

Maintainers

Details

gitee.com/sixdec-1/wechatpay.git

Installs: 74

Dependents: 0

Suggesters: 0

Security: 0

Type:sixshop-extension

pkg:composer/six-shop/wechatpay

v1.0.2 2025-12-19 17:36 UTC

README

微信支付扩展包,为 SixShop 商城系统提供微信支付功能支持。

功能特性

  • 微信支付订单创建
  • 支付结果异步通知处理
  • 支付订单查询
  • 退款申请与查询
  • 发货信息上传
  • 运单信息跟踪

安装

composer require six-shop/wechatpay

配置说明

在后台管理系统中配置以下参数:

参数说明是否必填
mchid商户号
appid开发者ID
apiclient_cert商户API证书
apiclient_key商户API私钥
serial_no商户API证书序列号
public_key微信支付公钥
public_key_id微信支付公钥ID
api_v3_keyAPIv3密钥
platform_no平台证书序列号
platform_cert平台证书
sandbox是否启用沙箱环境
notify_url支付回调地址
refund_notify_url退款回调地址

使用方法

创建支付订单

$provider = app(\SixShop\WechatPay\PaymentProvider::class);
$response = $provider->create($orderData, PaymentBizEnum::ORDER);

处理支付回调

// 在控制器中处理微信支付回调
public function notify(PaymentManager $paymentManager): Response
{
    $requestData = [
        'headers' => getallheaders(),
        'inBody' => file_get_contents('php://input'),
    ];
    
    $result = $paymentManager->getPaymentProvider('wechatpay')->notify($requestData);
    return success_response(msg: '回调成功');
}

查询支付状态

$provider = app(\SixShop\WechatPay\PaymentProvider::class);
$result = $provider->query($recordID);

申请退款

$provider = app(\SixShop\WechatPay\PaymentProvider::class);
$refundRequest = new PaymentRefundRequest($amount, $reason);
$result = $provider->refund($recordID, $refundRequest);

查询退款状态

$provider = app(\SixShop\WechatPay\PaymentProvider::class);
$result = $provider->refundQuery($refundID);

技术支持

如有问题请联系:

  • 邮箱: runphp@qq.com
  • 作者: hui he