yansongda/pay
A popular PHP payment library for Laravel and other frameworks, integrating Alipay and WeChat Pay with a clean API. Supports common payment flows, refunds, queries, callbacks/notifications, and flexible configuration for multi-app and sandbox use.
Apple(苹果支付)Provider 全新接入(#597):
Pay::apple() 快捷入口:payToken(支付令牌本地验签解密:PKCS#7 证书链 + ECDH + AES-256-GCM,零新增依赖)、merchantSession(Apple Pay 网页商户验证代理,TLS 双向认证经 _http 透传)、query(_action:transaction/history/subscriptions)、refund(退款历史查询——Apple 无服务端主动退款)、callback(App Store Server Notifications V2 JWS x5c 验签 + 内嵌交易 JWS 二级解码);cancel/close 无对等接口,调用时抛出异常issuer_id/bundle_id/api_key_id/api_private_key)src/Certificate/AppleRootCA-G3.pem、AppleAAICAG3.pem),未配置时默认生效,支持 apple_root_ca/apple_intermediate_ca 覆盖merchantSession 的 initiative_context 必填校验;订阅查询 _status 白名单(SubscriptionStatus 枚举或 1-5 的整数,src/Enum/Apple/)PARAMS_APPLE_URL_MISSING(9234)、PARAMS_APPLE_TOKEN_INVALID(9235)、CONFIG_APPLE_INVALID(9413)、DECRYPT_APPLE_FAILED(9612)web/docs/v3/apple/ 提供支付/查询/退款/回调/应答/插件页面,侧边栏已挂载AppleTrait 仅保留门面(URL/ES256 JWT/密码学入口),实现下沉至 src/Crypto/Apple/(Cryptor 通用工具 / TokenVerifier 令牌验签解密 / JwsVerifier JWS 验签),对外调用方式不变枚举化(src/Enum/,沿用 Apple SubscriptionStatus 风格;全部为新增能力,默认行为与报文逐字节不变):
PayMode(配置项 mode):'mode' => PayMode::SANDBOX,同时兼容历史 int 写法(0/1/2);$config->getMode() 返回 PayMode,插件内 Pay::MODE_* === $config->getMode() 统一收口为 $config->getMode()->isService()/isNormal()/isSandbox();toArray()['mode'] 同步为枚举(toJson()/json_encode() 仍输出 0/1/2)AppType(_type:mp/mini/app)、PapayScene(委托代扣 _type 场景:mp/mini/app/scan/h5)、ReceiverType(分账接收方 type:MERCHANT_ID/PERSONAL_OPENID/PERSONAL_SUB_OPENID)、VirtualPayEnv(虚拟支付 env:0/1);_type 未知值仍按 MP 处理、分账未知 type 仍透传、env 未知值仍按正式环境处理(均为历史行为)ProductCode(biz_content.product_code)与 BizCode(数字身份/人脸 biz_content.biz_code),插件内字面量统一改为枚举取值web/docs/v3/wechat/pay.md、web/docs/v3/wechat/virtual.md、web/docs/v3/quick-start/init.md 补充枚举用法ProviderConfigInterface::getMode() 返回类型由 int 变更为 PayMode 枚举,AbstractConfig 统一实现 $mode / setMode() / getMode()(各 Provider Config 不再重复声明),AbstractConfig::getModeEnum() 移除;对外 $config->getMode() === 1 这类与 int 的比较恒为 false,请改用 $config->getMode()->isSandbox() / isService()(#1221)Pay::MODE_NORMAL / Pay::MODE_SANDBOX / Pay::MODE_SERVICE 常量,请改用 PayMode::NORMAL / PayMode::SANDBOX / PayMode::SERVICE(use Yansongda\Pay\Enum\PayMode;);配置项 mode 仍兼容历史 int 写法(#1221)virtual_pay.app_secret 启用,stable_token 接口)(#1186、#1179)signData JSON 字符串(#1181)AbstractConfig::validateNotEmpty() 公共方法,必填项仅需声明属性名列表(snake_case 键名由 Str::snake() 推导),除 Airwallex 外所有异常消息保持不变配置错误: Airwallex 配置缺少 [client_id] -> 配置异常: 缺少 Airwallex 配置 -- [client_id]Pay::config() 推迟到实际使用该 Provider 时;客户端签名返回字段顺序变为字典序(已按返回字段顺序集成的前端零改动)Pay::config() 抛出配置异常的问题(#1186)WechatConfig::validateForV2()/validateForMp()/validateForMini() 方法(仅存在于 v3.8.0-beta 版本,SDK 内部无调用)/ 导致微信验签失败的问题(#1182)WechatConfigVirtualPay 配置类(appKey、sandboxAppKey、offerId、encodingAesKey、callbackToken)VirtualShortcut 用于客户端签名场景WechatTrait::getWechatVirtualPaySignature() 和 getWechatVirtualSessionSignature() 方法Wechat::success() 支持 ['_action' => 'virtual'] 参数返回虚拟支付成功响应Wechat::URL_VIRTUAL 常量(https://api.weixin.qq.com)mergeCommonPlugins 方法 (#1173)VirtualShortcut 插件数组包含非 PluginInterface 实现的问题access_token 参数的问题[@internal](https://github.com/internal) 和 [@coversNothing](https://github.com/coversNothing) 注解Yansongda\Pay\Service\AbstractServiceProvider 基类 (#1142)Yansongda\Pay\CertManager 类用于证书缓存管理 (#1142)AlipayTrait - 支付宝相关方法WechatTrait - 微信相关方法UnipayTrait - 银联相关方法DouyinTrait - 抖音相关方法PaypalTrait - PayPal 相关方法JsbTrait - 江苏银行相关方法StripeTrait - Stripe 相关方法ProviderConfigTrait - Provider 配置方法SupportServiceProviderTrait - ServiceProvider 支持方法AirwallexConfig 类型化配置 (#1140, #1155)Yansongda\Pay\Plugin\Wechat\V3\Marketing\MchTransfer\* 重命名为 Yansongda\Pay\Plugin\Wechat\V3\Marketing\Transfer\* (#1139)AbstractServiceProvider 基类 (#1145)CertManager (#1163)CertManager 方法命名和错误码 (#1160)dev-guide Skill (#1164)Config.php 错误码误用 & Pay::config() 去重 (#1162)pr-review-provider skill 用于 Provider PR 代码审查 (#1149)src/Functions.php,所有辅助函数已迁移到对应的 Trait (#1142, #1143, #1144, #1145)tests/FunctionTest.php,测试已迁移到 Trait 测试 (#1142, #1143, #1144, #1145)src/Plugin/Wechat/StartPlugin.php,请使用 Yansongda\Artful\Plugin\StartPlugin 代替 (#1139)src/Plugin/Wechat/V3/Marketing/Transfer/ 目录(因微信支付 API 变更)(#1139)get_alipay_config()、get_wechat_config()、get_unipay_config() 函数,请使用 get_provider_config() 代替 (#1139)WechatConfig 中未使用的证书相关方法 (#1159)Full Changelog: https://github.com/yansongda/pay/compare/v3.7.19...v3.7.20
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.18...v3.7.19
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.17...v3.7.18
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.16...v3.7.17
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.15...v3.7.16
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.14...v3.7.15
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.12...v3.7.13
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.11...v3.7.12
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.9...v3.7.10
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.8...v3.7.9
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.7...v3.7.8
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.6...v3.7.7
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.5...v3.7.6
ResponsePlugin 插件去除不必要的返回参数(#996)StartPlugin 改为使用 yansongda/artful 中的插件(#993)get_wechat_config, get_alipay_config, get_unipay_config 方法已废弃,使用 get_provider_config 方法代替(#994)Full Changelog: https://github.com/yansongda/pay/compare/v3.7.4...v3.7.5
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.3...v3.7.4
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.2...v3.7.3
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.1...v3.7.2
Full Changelog: https://github.com/yansongda/pay/compare/v3.7.0...v3.7.1
Full Changelog: https://github.com/yansongda/pay/compare/v3.6.5...v3.7.0
Full Changelog: https://github.com/yansongda/pay/compare/v3.6.4...v3.6.5
Full Changelog: https://github.com/yansongda/pay/compare/v3.6.3...v3.6.4
Full Changelog: https://github.com/yansongda/pay/compare/v3.6.2...v3.6.3
Full Changelog: https://github.com/yansongda/pay/compare/v3.6.1...v3.6.2
yansongda/artful 到 v1.0.9 修复 JsonPacker 为空时 packer 错误的问题(#937)Full Changelog: https://github.com/yansongda/pay/compare/v3.6.0...v3.6.1
InvalidSignException(#903)DecryptException(#906)decrypt_wechat_contents 解密微信加密内容(#912)\Yansongda\Pay\Plugin\Wechat\Extend\Complaints\QueryDetailPlugin 自动解密用户手机号(#912)HttpClientFactoryInterface 方法用于工厂模式创建 http client(#921)条码支付综合前置平台-被扫支付 刷卡支付插件(#922)find 改为 query,同时参数只支持 array(#897)combine_app_id,combine_mch_id 配置,复用其它配置(#909)Pay 类对外方法由所改变,如果您有自行扩展相关插件,请检查(#926)parse 改为 guide(#896)ProviderInterface 的返回参数,增加了 Rocket 返回(#909)call() 方法重命名为 shortcut()(#914)mergeCommonPlugins 不再作为 AbstractProvider 的方法(#918)AbstractProvider 默认使用 HttpClientFactoryInterface 创建 http client(#921)artful API 请求框架(#926)Full Changelog: https://github.com/yansongda/pay/compare/v3.5.3...v3.6.0
InvalidSignException(#903)DecryptException(#906)decrypt_wechat_contents 解密微信加密内容(#912)\Yansongda\Pay\Plugin\Wechat\Extend\Complaints\QueryDetailPlugin 自动解密用户手机号(#912)HttpClientFactoryInterface 方法用于工厂模式创建 http client(#921)条码支付综合前置平台-被扫支付 刷卡支付插件(#922)find 改为 query,同时参数只支持 array(#897)combine_app_id,combine_mch_id 配置,复用其它配置(#909)Pay 类对外方法由所改变,如果您有自行扩展相关插件,请检查(#926)parse 改为 guide(#896)ProviderInterface 的返回参数,增加了 Rocket 返回(#909)call() 方法重命名为 shortcut()(#914)mergeCommonPlugins 不再作为 AbstractProvider 的方法(#918)AbstractProvider 默认使用 HttpClientFactoryInterface 创建 http client(#921)artful API 请求框架(#926)Full Changelog: https://github.com/yansongda/pay/compare/v3.6.0-beta.0...v3.6.0-beta.1
InvalidSignException(#903)DecryptException(#906)decrypt_wechat_contents 解密微信加密内容(#912)\Yansongda\Pay\Plugin\Wechat\Extend\Complaints\QueryDetailPlugin 自动解密用户手机号(#912)HttpClientFactoryInterface 方法用于工厂模式创建 http client(#921)条码支付综合前置平台-被扫支付 刷卡支付插件(#922)find 改为 query,同时参数只支持 array(#897)combine_app_id,combine_mch_id 配置,复用其它配置(#909)Pay 类对外方法由所改变,如果您有自行扩展相关插件,请检查(#926)parse 改为 guide(#896)ProviderInterface 的返回参数,增加了 Rocket 返回(#909)call() 方法重命名为 shortcut()(#914)mergeCommonPlugins 不再作为 AbstractProvider 的方法(#918)AbstractProvider 默认使用 HttpClientFactoryInterface 创建 http client(#921)artful API 请求框架(#926)Full Changelog: https://github.com/yansongda/pay/compare/v3.5.3...v3.6.0-beta.0
How can I help you explore Laravel packages today?