Add overseas WeChat Pay support with GlobalTradeTypeEnum and new API methods #3653
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.
This PR adds comprehensive support for overseas WeChat Pay (境外微信支付) to address the limitations mentioned in the issue where new overseas merchant accounts can only use the new global API endpoints.
Problem
The existing
createOrderV3
method only supports domestic WeChat Pay endpoints and is missing required parameters for overseas payments:trade_type
parametermerchant_category_code
parameter/v3/pay/transactions/*
) instead of global endpointshttps://apihk.mch.weixin.qq.com
)Solution
Added new classes and methods specifically for overseas WeChat Pay while maintaining full backward compatibility:
New Classes
GlobalTradeTypeEnum
- Enum for overseas payment types with global endpoints:WxPayUnifiedOrderV3GlobalRequest
- Extended request class with overseas-specific fields:New API Methods
createOrderV3Global(GlobalTradeTypeEnum, WxPayUnifiedOrderV3GlobalRequest)
- High-level method for overseas ordersunifiedOrderV3Global(GlobalTradeTypeEnum, WxPayUnifiedOrderV3GlobalRequest)
- Low-level API call using overseas base URLUsage Example
Key Features
https://apihk.mch.weixin.qq.com
for overseas paymentstrade_type
andmerchant_category_code
Testing
Fixes #3618.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.