Skip to content

Add comprehensive documentation and examples for WeChat Pay new merchant transfer APIs #3647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 24, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 24, 2025

This PR addresses the confusion around WeChat Pay's new merchant transfer APIs that became mandatory for newly opened merchant accounts starting January 15, 2025.

Issue Summary

Users were unclear whether WxJava supports the "new version" of merchant transfer APIs that new merchants are required to use, as referenced in the official WeChat Pay documentation.

Key Findings

After thorough investigation, WxJava already fully supports the new merchant transfer APIs! The confusion arose because there are multiple transfer services:

Service API Endpoints Use Case
MerchantTransferService /v3/transfer/batches Traditional batch transfers
TransferService /v3/fund-app/mch-transfer/transfer-bills New single transfer APIs (2025.1.15+)

What's Included in This PR

📚 Documentation

  • NEW_TRANSFER_API_SUPPORT.md - Quick reference guide answering the user's question
  • NEW_TRANSFER_API_USAGE.md - Comprehensive usage guide with examples

💻 Code Examples

  • NewTransferApiExample.java - Complete working example demonstrating:
    • Single transfer creation (transferBills)
    • Transfer status queries (getBillsByOutBillNo, getBillsByTransferBillNo)
    • Transfer cancellation (transformBillsCancel)
    • Callback notification handling (parseTransferBillsNotifyResult)

For New Merchants

If you're a newly opened merchant account, use:

// Get the NEW transfer service (not MerchantTransferService)
TransferService transferService = wxPayService.getTransferService();

// Create transfer using new API
TransferBillsRequest request = TransferBillsRequest.newBuilder()
    .appid("your_appid")
    .outBillNo("T" + System.currentTimeMillis())
    .transferSceneId("1005")  // Required: Transfer scene ID
    .openid("user_openid")
    .transferAmount(100)      // Amount in cents
    .transferRemark("Commission payment")
    .build();

TransferBillsResult result = transferService.transferBills(request);

New API Advantages

  • ✅ Single transfer support (vs batch-only in old API)
  • ✅ Transfer cancellation capability
  • ✅ Rich transfer scenarios (commission, rewards, etc.)
  • ✅ Enhanced callback notifications
  • ✅ Automatic RSA encryption for user names

All existing functionality remains unchanged - this PR only adds documentation and examples to clarify the already-existing support.

Fixes #3641.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…fer APIs

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 商户转账 Add comprehensive documentation and examples for WeChat Pay new merchant transfer APIs Jul 24, 2025
@Copilot Copilot AI requested a review from binarywang July 24, 2025 08:01
Copilot finished work on behalf of binarywang July 24, 2025 08:01
@binarywang binarywang marked this pull request as ready for review July 24, 2025 08:40
@binarywang binarywang merged commit 262a02b into develop Jul 24, 2025
1 check failed
@binarywang binarywang deleted the copilot/fix-3641 branch July 24, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

商户转账
2 participants