search
HomeBackend DevelopmentPHP Tutorial请教一个微信公众账号平台支付的问题

问个好先

最近接收一个微信项目,以前也没碰过,突然间支付那块儿出问题了,微信的JSAPI支付接口也就是WeixinJSBridge.invoke("getBrandWCPayRequest".....这个东西一直返回:get_brand_wcpay_request:fail,然后就没有然后了。

我去公众平台官网技术文档的JSAPI技术文档看了下,看的云里雾里,跟我项目里代码完全不一样,后来才知道我那个项目里的是微信支付V2版本,官网里的是V3,然后我又在“https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6”找到一个H5网页调用JS支付的一个文档,不幸的是,看起来跟我调用的很像,但参数还是不一样,貌似也是V3的。百度了一下这个关键词“get_brand_wcpay_request:fail”,还有说新版微信不支持这种调用了,但不确定,因为官网没说不能用。

所以现在我的处境根本就是绝境,既不知道到底我那部分代码能不能用,也找不到任何有帮助的信息,也不干升级支付,我看了升级支付还设计好多东西。现在无可奈何,寻求帮助,希望有这方面经验的前辈不吝赐教!

我真是很奇怪,从来没有见过这么混乱的技术文档,这是什么玩意儿。太恼火。

回复内容:

问个好先

最近接收一个微信项目,以前也没碰过,突然间支付那块儿出问题了,微信的JSAPI支付接口也就是WeixinJSBridge.invoke("getBrandWCPayRequest".....这个东西一直返回:get_brand_wcpay_request:fail,然后就没有然后了。

我去公众平台官网技术文档的JSAPI技术文档看了下,看的云里雾里,跟我项目里代码完全不一样,后来才知道我那个项目里的是微信支付V2版本,官网里的是V3,然后我又在“https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6”找到一个H5网页调用JS支付的一个文档,不幸的是,看起来跟我调用的很像,但参数还是不一样,貌似也是V3的。百度了一下这个关键词“get_brand_wcpay_request:fail”,还有说新版微信不支持这种调用了,但不确定,因为官网没说不能用。

所以现在我的处境根本就是绝境,既不知道到底我那部分代码能不能用,也找不到任何有帮助的信息,也不干升级支付,我看了升级支付还设计好多东西。现在无可奈何,寻求帮助,希望有这方面经验的前辈不吝赐教!

我真是很奇怪,从来没有见过这么混乱的技术文档,这是什么玩意儿。太恼火。

微信支付现在分为v2版和v3版,2014年9月10号之前申请的为v2版,之后申请的为v3版。V3版的微信支付没有paySignKey参数。
两个版本取决于申请时间,是不能转换的,代码和流程也有很大的不同。
现在调用微信的jsapi需要先通过权限验证,你这个问题的解决办法就是使用微信的jssdk进行jsapi支付,但服务端的微信支付代码还是用原来的。

微信V2升级V3不难,V3在支付参数少了财付通那边的key,然后官方有对应语言的源码提供,都是可行的。直接修改里面的参数就能运行,如果你是C#,你可以到我们群里来交流。217073730

php 和 c# 微信支付官网都有现成的DEMO,改几个参数就能用。你可以先试试官方的demo,看能不能正常运行。
https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=11_1

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Dependency Injection in PHP: Avoiding Common PitfallsDependency Injection in PHP: Avoiding Common PitfallsMay 16, 2025 am 12:17 AM

DependencyInjection(DI)inPHPenhancescodeflexibilityandtestabilitybydecouplingdependencycreationfromusage.ToimplementDIeffectively:1)UseDIcontainersjudiciouslytoavoidover-engineering.2)Avoidconstructoroverloadbylimitingdependenciestothreeorfour.3)Adhe

How to Speed Up Your PHP Website: Performance TuningHow to Speed Up Your PHP Website: Performance TuningMay 16, 2025 am 12:12 AM

ToimproveyourPHPwebsite'sperformance,usethesestrategies:1)ImplementopcodecachingwithOPcachetospeedupscriptinterpretation.2)Optimizedatabasequeriesbyselectingonlynecessaryfields.3)UsecachingsystemslikeRedisorMemcachedtoreducedatabaseload.4)Applyasynch

Sending Mass Emails with PHP: Is it Possible?Sending Mass Emails with PHP: Is it Possible?May 16, 2025 am 12:10 AM

Yes,itispossibletosendmassemailswithPHP.1)UselibrarieslikePHPMailerorSwiftMailerforefficientemailsending.2)Implementdelaysbetweenemailstoavoidspamflags.3)Personalizeemailsusingdynamiccontenttoimproveengagement.4)UsequeuesystemslikeRabbitMQorRedisforb

What is the purpose of Dependency Injection in PHP?What is the purpose of Dependency Injection in PHP?May 16, 2025 am 12:10 AM

DependencyInjection(DI)inPHPisadesignpatternthatachievesInversionofControl(IoC)byallowingdependenciestobeinjectedintoclasses,enhancingmodularity,testability,andflexibility.DIdecouplesclassesfromspecificimplementations,makingcodemoremanageableandadapt

How to send an email using PHP?How to send an email using PHP?May 16, 2025 am 12:03 AM

The best ways to send emails using PHP include: 1. Use PHP's mail() function to basic sending; 2. Use PHPMailer library to send more complex HTML mail; 3. Use transactional mail services such as SendGrid to improve reliability and analysis capabilities. With these methods, you can ensure that emails not only reach the inbox, but also attract recipients.

How to calculate the total number of elements in a PHP multidimensional array?How to calculate the total number of elements in a PHP multidimensional array?May 15, 2025 pm 09:00 PM

Calculating the total number of elements in a PHP multidimensional array can be done using recursive or iterative methods. 1. The recursive method counts by traversing the array and recursively processing nested arrays. 2. The iterative method uses the stack to simulate recursion to avoid depth problems. 3. The array_walk_recursive function can also be implemented, but it requires manual counting.

What are the characteristics of do-while loops in PHP?What are the characteristics of do-while loops in PHP?May 15, 2025 pm 08:57 PM

In PHP, the characteristic of a do-while loop is to ensure that the loop body is executed at least once, and then decide whether to continue the loop based on the conditions. 1) It executes the loop body before conditional checking, suitable for scenarios where operations need to be performed at least once, such as user input verification and menu systems. 2) However, the syntax of the do-while loop can cause confusion among newbies and may add unnecessary performance overhead.

How to hash strings in PHP?How to hash strings in PHP?May 15, 2025 pm 08:54 PM

Efficient hashing strings in PHP can use the following methods: 1. Use the md5 function for fast hashing, but is not suitable for password storage. 2. Use the sha256 function to improve security. 3. Use the password_hash function to process passwords to provide the highest security and convenience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool