Payments & Platform Access · Practical News

WeChat Pay JSAPI: Why Payment Will Not Launch Inside the Official Account

Source: Paddy Dance teamKeywords: WeChat Pay JSAPI configuration

Directory and appid must line up

The JSAPI payment directory configured in the merchant platform must cover the actual page path that initiates payment. One level more or less fails, and the trailing slash matters. Changes take time to propagate, so do not retry immediately.

The appid used for the order must match the appid that issued the openid. An openid from account A with an order under appid B returns an openid/appid mismatch.

Why signatures keep failing

The front end needs a paySign computed over appId, timeStamp, nonceStr, package and signType, signed with the merchant API key, or with the merchant private key under APIv3. It is not the official account appSecret.

The most common mistake is passing the order response sign straight to the front end. That sign covers a different field set and is not interchangeable.

Debug order

Confirm the server-side order succeeded and returned a prepay_id, then check that front-end parameters are complete, then read the exact WeChat error code. The code already distinguishes signature, directory and openid problems.

For payment issues we ask for full request and response logs. Reading the error code beats repeatedly editing configuration.

FAQ

Can H5 payment be used inside the WeChat app?

No. In-app payment must use JSAPI. H5 payment is for mobile browsers outside WeChat.

Can the authorisation directory be a domain?

It must include a path. Entering https://yourdomain/pay/ authorises that directory and its subpaths.

openid or unionid for the order?

Use the openid issued under the current appid. unionid identifies the user across apps and cannot be used to place an order.

Related questions

payment fails inside official accountJSAPI payment directory settinghow to get openid for paymentJSAPI signature error

Further reading

Sources & References

The following are public sources. Always check the latest requirements on the official authority or platform page.

Explain your case first, then confirm the scope

Tell us your entity, business model and current progress. We will confirm what we can assist with and what you need to do before discussing fees.