-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Fix WeChat Pay V3 public key transfer signature verification failure #3731
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
Draft
+9
−1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When using public key mode for transfer APIs, WeChat Pay may return a response with a platform certificate serial number in the Wechatpay-Serial header, but the signature is actually signed with the public key. The previous logic would fail to verify this. Changes: - Modified PublicCertificateVerifier.verify() to fallback to public key verification when certificate verification fails - This ensures both platform certificate and public key signatures can be verified - Fixes the issue where funds are locked but verification fails for transfer APIs Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
@Copilot
Copilot
AI
changed the title
(削除) [WIP] 4.7.6.B 微信v3支付公钥转账出现应答的微信支付签名验证失败,实际已经锁定了资金 (削除ここまで)
(追記) Fix WeChat Pay V3 public key transfer signature verification failure (追記ここまで)
Oct 3, 2025
Copilot finished work on behalf of
binarywang
October 3, 2025 17:46
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Issue
When using WeChat Pay V3 public key mode for transfer APIs (商户转账 - merchant transfer to user's balance), signature verification would fail with error "应答的微信支付签名验证失败" (WeChat Pay response signature verification failed) even though the transfer operation was successful and funds were locked in the merchant account.
This issue specifically affects the new transfer API endpoint
/v3/fund-app/mch-transfer/transfer-bills
when using public key authentication mode.Root Cause
The
PublicCertificateVerifier.verify()
method had a logic flaw when handling WeChat Pay responses:Wechatpay-Serial
header (not containing "PUB_KEY_ID")Solution
Modified
PublicCertificateVerifier.verify()
to implement a fallback mechanism:Key improvements:
Impact
✅ Fixes: Public key transfer signature verification failures
✅ Maintains: Full backward compatibility with platform certificate mode
✅ Supports: Both full public key mode and hybrid mode configurations
✅ User Impact: No changes required in user code - fix is transparent
Testing
Related Documentation
This fix supports the new transfer API documented in:
Fixes #[issue number]
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a 200ドル gift card! Click here to start the survey.