WP Manifestindependent plugin directory
manifest / ecommerce / mbdpay-wordpress

面包多Pay 支付

面包多Pay (MianBaoDuo Pay) WordPress 支付插件 — 微信支付、支付宝支付、退款、订单管理、Webhook 回调

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/ymstar/mbdpay-wordpress/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

面包多Pay WordPress 支付插件

面向个人的支付集成平台 面包多Pay 的 WordPress 插件。

无需企业资质即可接入微信支付和支付宝支付。

功能

  • ✅ 微信 JSAPI 支付(微信内网页支付)
  • ✅ 微信 H5 支付(微信外部浏览器)
  • ✅ 支付宝支付
  • ✅ 订单管理(创建、查询、退款)
  • ✅ Webhook 异步通知(自动更新订单状态)
  • ✅ 短代码支付按钮

安装

  1. 在 面包多Pay 注册并获取 App ID 和 App Key
  2. 将 wordpress/ 目录上传到 /wp-content/plugins/mbdpay/
  3. 在 WordPress 后台启用插件
  4. 进入「面包多Pay」设置页面,填入 App ID 和 App Key
  5. 在面包多Pay 后台设置 Webhook 回调地址

使用

短代码

在文章或页面中插入支付按钮:

[mbdpay amount="1.00" description="测试商品" channel="alipay"]
参数 说明 默认值
amount 金额(元) 必填
description 商品描述 必填
channel alipay / wxh5 / wxjsapi alipay
button_text 按钮文字 立即支付
out_trade_no 自定义订单号 自动生成

Webhook 回调

回调地址:https://你的域名/wp-json/mbdpay/v1/webhook

在面包多Pay 后台的回调设置中填入此地址,插件会自动接收支付通知并更新订单状态。

退款

在 WordPress 后台「面包多Pay → 订单管理」页面操作。

开发者钩子

插件在 Webhook 处理时触发以下 Action,可供主题/其他插件扩展:

// 支付成功
add_action('mbdpay_charge_succeeded', function($order, $data) {
    // $order: 本地订单对象
    // $data: 面包多Pay 回调数据
    // 例如:发送邮件、开通会员等
}, 10, 2);

// 收到投诉
add_action('mbdpay_complaint', function($out_trade_no, $data) {
    // 处理投诉逻辑
}, 10, 2);

文件结构

wordpress/
├── mbdpay.php                          # 主插件文件
├── uninstall.php                       # 卸载清理
├── readme.txt                          # WordPress.org readme
├── includes/
│   ├── class-mbdpay-client.php         # API 客户端(签名 + HTTP)
│   ├── class-mbdpay-admin.php          # 后台管理(设置 + 订单列表)
│   ├── class-mbdpay-order.php          # 订单管理(数据库 CRUD)
│   ├── class-mbdpay-webhook.php        # Webhook 回调处理
│   └── class-mbdpay-shortcode.php      # 短代码支付按钮
├── assets/
│   ├── css/mbdpay.css                  # 前端样式
│   └── js/
│       ├── mbdpay.js                   # 前端支付脚本
│       └── mbdpay-admin.js             # 后台管理脚本
└── languages/                          # 国际化

License

MIT