Springboot Payment Module Skill logo

Springboot Payment Module Skill

Community
jiushiwon
springboot-payment-module-skill

Spring Boot 支付模块技能。面向已有 Spring Boot 项目的开发者,提供微信支付、支付宝支付、退款、回调通知、对账等能力的快速集成。触发词:"微信支付"、"支付宝支付"、"支付模块"、"退款"、"回调通知"、"对账"、"payment module"、"wechat pay"、"alipay"、"refund"。

Overview

Publisherjiushiwon
Repositorywg-skills
Skill namespringboot-payment-module-skill
Stars
123
Forks
38
Bundled files
1
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by jiushiwon on GitHub. Read the source before you install it.

Installation

Install the Springboot Payment Module Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/java/springboot-module/springboot-payment-module-skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jiushiwon/wg-skills.git /tmp/wg-skills
mkdir -p .claude/skills
cp -r /tmp/wg-skills/vibeCoding/backend/java/springboot-module/springboot-payment-module-skill .claude/skills/springboot-payment-module-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Springboot Payment Module Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Springboot Payment Module Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Springboot Payment Module Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Spring Payment Module Skill

面向已有 Spring Boot 项目的开发者,快速集成支付能力。

能力清单

能力说明
微信支付JSAPI/小程序/H5/App 支付
支付宝支付wap/PC/App 支付
退款退款申请/查询/回调
回调通知异步通知验签
对账账单下载/核对

触发场景

用户说"帮我加支付"或"集成微信/支付宝"时触发。

核心实现

依赖配置

xml
<!-- 微信支付 -->
<dependency>
    <groupId>com.github.wxpay</groupId>
    <artifactId>wxpay-sdk</artifactId>
    <version>3.0.10</version>
</dependency>

<!-- 支付宝 -->
<dependency>
    <groupId>com.alipay.sdk</groupId>
    <artifactId>alipay-sdk-java</artifactId>
    <version>4.35.2.ALL</version>
</dependency>

配置

yaml
# 微信支付
wechat:
  pay:
    app-id: ${WECHAT_APP_ID:}
    mch-id: ${WECHAT_MCH_ID:}
    api-key: ${WECHAT_API_KEY:}
    cert-path: ${WECHAT_CERT_PATH:}
    notify-url: ${WECHAT_NOTIFY_URL:}

# 支付宝
alipay:
  app-id: ${ALIPAY_APP_ID:}
  private-key: ${ALIPAY_PRIVATE_KEY:}
  alipay-public-key: ${ALIPAY_PUBLIC_KEY:}
  notify-url: ${ALIPAY_NOTIFY_URL:}
  return-url: ${ALIPAY_RETURN_URL:}

实体类

java
// 支付订单
@Entity
@Table(name = "wg_pay_order")
public class PayOrder {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    private String orderNo;
    
    private String payOrderNo;
    
    @Enumerated(EnumType.STRING)
    private PayType payType;
    
    @Enumerated(EnumType.STRING)
    private PayStatus status;
    
    private BigDecimal amount;
    
    private String subject;
    
    private String body;
    
    private String notifyUrl;
    
    private String returnUrl;
    
    private String userId;
    
    private String openid;
    
    private LocalDateTime paidAt;
    
    private LocalDateTime createdAt;
    
    private LocalDateTime updatedAt;
}

public enum PayType { WECHAT, ALIPAY }
public enum PayStatus { PENDING, PAID, REFUNDED, CLOSED }

// 退款订单
@Entity
@Table(name = "wg_refund_order")
public class RefundOrder {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    private String refundNo;
    
    private String payOrderNo;
    
    private String refundId;
    
    private BigDecimal refundAmount;
    
    private BigDecimal totalAmount;
    
    @Enumerated(EnumType.STRING)
    private RefundStatus status;
    
    private String reason;
    
    private LocalDateTime refundedAt;
    
    private LocalDateTime createdAt;
}

public enum RefundStatus { PENDING, SUCCESS, FAILED }

服务层

java
@Service
public class WechatPayService {
    
    @Value("${wechat.pay.app-id}")
    private String appId;
    
    @Value("${wechat.pay.mch-id}")
    private String mchId;
    
    @Value("${wechat.pay.api-key}")
    private String apiKey;
    
    // 统一下单
    public String createOrder(PayOrder order) throws Exception {
        Map<String, String> params = new HashMap<>();
        params.put("appid", appId);
        params.put("mch_id", mchId);
        params.put("nonce_str", WxPayUtil.generateNonceStr());
        params.put("body", order.getSubject());
        params.put("out_trade_no", order.getOrderNo());
        params.put("total_fee", order.getAmount().multiply(new BigDecimal("100")).intValue() + "");
        params.put("spbill_create_ip", "127.0.0.1");
        params.put("notify_url", order.getNotifyUrl());
        params.put("trade_type", "JSAPI");
        params.put("openid", order.getOpenid());
        
        String sign = WxPayUtil.generateSignature(params, apiKey);
        params.put("sign", sign);
        
        String xml = WxPayUtil.mapToXml(params);
        String result = HttpUtil.post("https://api.mch.weixin.qq.com/pay/unifiedorder", xml);
        
        Map<String, String> resultMap = WxPayUtil.xmlToMap(result);
        return resultMap.get("prepay_id");
    }
    
    // 回调验签
    public boolean verifyNotify(Map<String, String> notifyData) {
        String sign = notifyData.get("sign");
        notifyData.remove("sign");
        String calculatedSign = WxPayUtil.generateSignature(notifyData, apiKey);
        return sign.equals(calculatedSign);
    }
}

@Service
public class AlipayService {
    
    @Value("${alipay.app-id}")
    private String appId;
    
    @Value("${alipay.private-key}")
    private String privateKey;
    
    // 统一下单
    public String createOrder(PayOrder order) throws AlipayApiException {
        AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
        request.setReturnUrl(order.getReturnUrl());
        request.setNotifyUrl(order.getNotifyUrl());
        
        AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
        model.setOutTradeNo(order.getOrderNo());
        model.setSubject(order.getSubject());
        model.setTotalAmount(order.getAmount().toString());
        model.setProductCode("QUICK_WAP_WAY");
        
        request.setBizModel(model);
        
        AlipayClient client = new DefaultAlipayClient(
            "https://openapi.alipay.com/gateway.do",
            appId,
            privateKey,
            "json",
            "UTF-8",
            AlipayConfig.alipayPublicKey,
            "RSA2"
        );
        
        return client.pageExecute(request).getBody();
    }
    
    // 验签
    public boolean verifyNotify(Map<String, String> params) {
        // 使用 AlipaySignature.rsaCheckV1 验签
    }
}

Controller

java
@RestController
@RequestMapping("/api/pay")
public class PayController {
    
    @Autowired
    private WechatPayService wechatPayService;
    
    @Autowired
    private AlipayService alipayService;
    
    // 微信支付
    @PostMapping("/wechat/create")
    public ApiResponse<String> createWechatOrder(@RequestBody PayOrder order) {
        try {
            String prepayId = wechatPayService.createOrder(order);
            return ApiResponse.ok(prepayId);
        } catch (Exception e) {
            return ApiResponse.fail(-1, e.getMessage());
        }
    }
    
    // 支付宝支付
    @PostMapping("/alipay/create")
    public ApiResponse<String> createAlipayOrder(@RequestBody PayOrder order) {
        try {
            String form = alipayService.createOrder(order);
            return ApiResponse.ok(form);
        } catch (AlipayApiException e) {
            return ApiResponse.fail(-1, e.getMessage());
        }
    }
    
    // 微信回调
    @PostMapping("/wechat/notify")
    public String wechatNotify(@RequestBody String xmlData) {
        try {
            Map<String, String> data = WxPayUtil.xmlToMap(xmlData);
            if (wechatPayService.verifyNotify(data)) {
                // 更新订单状态
                return "<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>";
            }
        } catch (Exception e) {
            log.error("微信回调处理失败", e);
        }
        return "<xml><return_code><![CDATA[FAIL]]></return_code></xml>";
    }
    
    // 支付宝回调
    @PostMapping("/alipay/notify")
    public String alipayNotify(@RequestParam Map<String, String> params) {
        if (alipayService.verifyNotify(params)) {
            // 更新订单状态
            return "success";
        }
        return "fail";
    }
}

不做

  • 不负责商户号配置
  • 不处理复杂的退款流程
  • 不提供 UI 相关代码

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Springboot Payment Module Skill AI skill do?

Spring Boot 支付模块技能。面向已有 Spring Boot 项目的开发者,提供微信支付、支付宝支付、退款、回调通知、对账等能力的快速集成。触发词:"微信支付"、"支付宝支付"、"支付模块"、"退款"、"回调通知"、"对账"、"payment module"、"wechat pay"、"alipay"、"refund"。

Why use Springboot Payment Module Skill on TypingMind?

Because you install it once and use it with any model. Springboot Payment Module Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Springboot Payment Module Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/java/springboot-module/springboot-payment-module-skill. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Springboot Payment Module Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Springboot Payment Module Skill?

As many as you like. As long as a model supports skills, you can use Springboot Payment Module Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Springboot Payment Module Skill AI skill free?

Yes. It is published on GitHub by jiushiwon under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇