Payments & Platform Access · Practical News

Rotating WeChat Pay APIv3 Keys and Certificates Without Breaking Payments

Source: Paddy Dance teamKeywords: WeChat Pay APIv3 certificate rotation

What each item does

The merchant certificate proves requests come from you and its private key must stay on the server. The APIv3 key decrypts callbacks and sensitive fields. The platform certificate verifies WeChat Pay signatures and is normally fetched through an API and refreshed periodically.

Certificate expiry and wrong key are often confused. Error messages usually distinguish them: signature failures point to certificate or private key problems, decryption failures to a wrong APIv3 key.

A safe rotation order

Request and download the new certificate without deleting the old one. Deploy the new certificate and private key, pointing configuration at the new files. Restart the service and verify with a small real transaction. Only then revoke the old certificate on the platform side.

Reverse the order and you create a window where the new certificate is not yet live and the old one is already revoked. Every payment request fails during that window.

Two things easily missed

Environment parity: test, staging and production each need their own certificates. It is common for production to be updated while staging still uses the old one. Calendar reminders also matter: set one a month before expiry instead of discovering it through errors.

And never log private keys or secrets. Pasting a full request into a ticket or a group chat exposes your credentials.

FAQ

Do platform certificates need manual download?

They are normally fetched and refreshed automatically through the API. Ensure the service can pull them at startup, otherwise the first request after boot may fail.

Does rotation require downtime?

No, but sequence it properly: deploy and verify the new certificate, then revoke the old one. Do it off-peak with a rollback plan ready.

Does an expired certificate immediately break all payments?

Yes. Signature verification fails and requests are rejected. Rotate before the expiry date rather than on the last day.

Related questions

WeChat Pay certificate expiredWhere to set APIv3 keyPayment errors after certificate changePlatform certificate auto update

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.