WxJava icon indicating copy to clipboard operation
WxJava copied to clipboard

Add support for WeChat merchant transfer confirmation-free receipt authorization mode

Open Copilot opened this issue 2 months ago • 0 comments

Implements WeChat's new "免确认收款授权模式" (confirmation-free receipt authorization mode) for merchant transfers, addressing the requirement in issue for enhanced user experience in high-frequency transfer scenarios.

What's Changed

Core Implementation

Added receiptAuthorizationMode field to TransferBillsRequest with two supported modes:

  • CONFIRM_RECEIPT_AUTHORIZATION (default): Traditional mode requiring user confirmation
  • NO_CONFIRM_RECEIPT_AUTHORIZATION: Streamlined mode for pre-authorized users
// Enable no-confirmation mode for better UX
TransferBillsRequest request = TransferBillsRequest.newBuilder()
    .appid("wx1234567890123456")
    .outBillNo("TRANSFER_001")
    .transferSceneId("1005")
    .openid("user_openid")
    .transferAmount(200)
    .receiptAuthorizationMode(WxPayConstants.ReceiptAuthorizationMode.NO_CONFIRM_RECEIPT_AUTHORIZATION)
    .build();

Type Safety & Constants

Added WxPayConstants.ReceiptAuthorizationMode class with compile-time constants to prevent invalid authorization mode values and improve code reliability.

Enhanced Documentation & Examples

  • Updated NewTransferApiExample.java with comprehensive usage examples
  • Added error handling patterns for authorization failures
  • Enhanced API documentation with detailed mode comparisons
  • Updated transfer API support guides with new feature information

Benefits

For High-Frequency Scenarios: Eliminates user confirmation steps in commission payments, rewards, and cashback scenarios, significantly improving conversion rates and user experience.

Backward Compatibility: Existing code continues to work unchanged - the new field is optional and defaults to the traditional confirmation mode.

Production Ready: All changes validated with successful compilation, checkstyle compliance, and comprehensive testing.

API Reference

The feature follows WeChat's official API specification documented at https://pay.weixin.qq.com/doc/v3/merchant/4014399293 and maintains full compatibility with existing transfer workflows while enabling enhanced user experiences for authorized scenarios.

Fixes binarywang/WxJava#3716


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

Copilot avatar Sep 24 '25 13:09 Copilot