Skip to content
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

关于微信支付版本疑问 #143

Closed
cexll opened this issue Aug 5, 2022 · 5 comments
Closed

关于微信支付版本疑问 #143

cexll opened this issue Aug 5, 2022 · 5 comments

Comments

@cexll
Copy link

cexll commented Aug 5, 2022

我看文档指向路径好像并不是v3
powerWechat是做的老版微信支付接口吗
考虑v3吗 ?
最近微信支付又有了一些改动, 例 企业付款到零钱关闭新商户开通了

@Matrix-X
Copy link
Contributor

Matrix-X commented Aug 5, 2022

你好,谢谢你的问题

我们在做支付模块的时候,大部分还是支持V3的

比如:

// JSAPI pay transaction. 小程序支付
// https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_1.shtml
func (comp *Client) JSAPITransaction(params *request.RequestJSAPIPrepay) (*response.ResponseUnitfy, error) {

	result := &response.ResponseUnitfy{}

	endpoint := "/v3/pay/transactions/jsapi"
	_, err := comp.PayTransaction(endpoint, params, result)
	return result, err
}

而红包和零钱,我们在做的时候,微信还支持了v2版本,我们也就做到v2版本
包括你说的零钱关闭了新商户,我们其实也碰到这个问题。

你可以看看源码中提供的地址,因为payment接口也不少,所以你可以按照子模块的方式,查看你需要的接口,如果针对你要的功能,看到有接口存在微信推出了v3,而我们还是提供v2的接口,欢迎指出,我们可以依次迭代修改,谢谢!

@Matrix-X
Copy link
Contributor

Matrix-X commented Aug 5, 2022

有需要更细的需求,请加我们企业微信咨询,谢谢!

image info

@Matrix-X
Copy link
Contributor

Matrix-X commented Aug 5, 2022

另外,批量零钱现在是v3(现在powerwechat也是v3)

func NewBatchClient(app *payment.ApplicationPaymentInterface) (*BatchClient, error) {
	baseClient, err := payment.NewBaseClient(app)
	if err != nil {
		return nil, err
	}
	return &BatchClient{
		BaseClient: baseClient,
		Version:    "v3",
	}, nil
}

// 发起商家转账API
// https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter4_3_1.shtml
func (comp *BatchClient) Batch(param *request.RequestTransferBatch) (*response.ResponseTrasferBatch, error) {

	result := &response.ResponseTrasferBatch{}

	options, err := object.StructToHashMap(param)
	if err != nil {
		return nil, err
	}

	endpoint := fmt.Sprintf("/%s/transfer/batches", comp.Version)
	_, err = comp.Request(comp.Wrap(endpoint), nil, "POST", options, false, nil, result)
	return result, err
}


但是1对1的零钱接口,好像在官网上已经找不到了,营销里的红包接口,还是v2

https://pay.weixin.qq.com/wiki/doc/apiv3/index.shtml

@cexll
Copy link
Author

cexll commented Aug 5, 2022

感谢回答, 我在阅读源码时也发现了, 感谢powerWechat的贡献

@cexll cexll closed this as completed Aug 5, 2022
@Matrix-X
Copy link
Contributor

Matrix-X commented Aug 5, 2022

no problem

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

No branches or pull requests

2 participants