Skip to content

WeChat Pay ​

The WeChat Pay connection enables domestic WeChat Mini Program checkout (for example, buy-now in a mall). DevDeck calls WeChat Pay APIv3 with your own ordinary merchant credentials. DevDeck does not apply for a merchant account for you, and it does not write merchant secrets into project source code.

After you complete WeChat Open Platform scan authorization, the Mini Program AppID is filled in automatically. You do not enter AppID or AppSecret in this connection. The payment notify URL is generated and synced by DevDeck.

Ordinary merchants only

Use an ordinary merchant that you own. Service-provider sub-merchant IDs are not supported.

Before you begin ​

You need:

  • WeChat Mini Program scan authorization completed in DevDeck (the same authorization relationship used for WeChat Login).
  • An ordinary merchant account on the WeChat Pay merchant platform with JSAPI Pay enabled (Mini Program pay shares JSAPI permissions).
  • That merchant ID bound to the current Mini Program AppID.
  • Super-admin or technical-contact access so you can download the API certificate and set the APIv3 key.

If you do not have a merchant ID yet, apply as an ordinary merchant on the WeChat Pay merchant platform and enable the Mini Program business scene.

Step 1: Confirm the merchant is bound to the Mini Program AppID ​

WeChat Pay requires a binding between the merchant ID and the Mini Program AppID before you can collect payments.

  1. Sign in to the WeChat Pay merchant platform.
  2. Open Product Center → AppID account management → Linked AppID accounts and confirm your Mini Program is listed.
  3. If it is not bound yet, start a linking request under Product Center → APPID authorization, then confirm it in the Mini Program on the WeChat Official Accounts Platform under WeChat Pay → Merchant ID management.

See WeChat’s guide: Manage AppID accounts bound to a merchant ID.

Step 2: Get the merchant ID (mch_id) ​

  1. Sign in to the WeChat Pay merchant platform.
  2. Open Account Center → Merchant information.
  3. Copy the Merchant ID.

Step 3: Get the merchant API certificate serial and private key ​

The merchant API certificate signs WeChat Pay APIv3 requests. From the certificate package you need:

  • The certificate serial number
  • The merchant private key PEM (usually apiclient_key.pem)

Steps:

  1. On the merchant platform, open Account Center → API Security → Merchant API certificate.
  2. If you have not applied yet, follow the on-screen flow to apply and download the certificate (downloads are often one-time; keep a safe backup).
  3. Copy the certificate serial number from the certificate management page.
  4. Open apiclient_key.pem from the download package and paste the full PEM text (including -----BEGIN PRIVATE KEY----- / -----END PRIVATE KEY-----) into DevDeck.

Official overview: Certificates and keys.

Keep the merchant private key safe

The private key can authorize payment-related API calls for the merchant. DevDeck encrypts and syncs it to the runtime, but you should still back up the original file securely and never share it in chat or public links. If it is lost or leaked, re-apply for a certificate on the merchant platform and update the connection in DevDeck.

Step 4: Get the APIv3 key ​

  1. On the merchant platform, open Account Center → API Security → APIv3 key.
  2. Set a 32-character key (the platform will not show the plaintext again; store it yourself).
  3. Enter the key in DevDeck’s APIv3 Key field.

The APIv3 key decrypts sensitive callback payloads. Official reference: Required parameters.

Step 5: Connect in DevDeck ​

  1. Open the project and select Configure → Connections.
  2. Find WeChat Pay and select Connect.
  3. Confirm the Authorized Mini Program AppID matches the Mini Program you want to charge with.
  4. Enter:
    • Merchant ID (mch_id)
    • Merchant certificate serial
    • APIv3 Key
    • Merchant private key PEM
  5. Check the confirmation that the merchant is bound to that Mini Program.
  6. Select Save.

After a successful connection, DevDeck encrypts the credentials and attempts to sync them to the domestic runtime. The notify URL is configured automatically — do not enter it manually.

Testing tips ​

  • Test checkout on a real WeChat device; H5 or web preview cannot fully verify WeChat Pay.
  • Confirm JSAPI Pay is enabled and the AppID binding is valid.
  • If credentials are saved but runtime sync is still pending, retry later or check publish / runtime status.

Change or disconnect ​

Open Configure → Connections → WeChat Pay to update merchant credentials or disconnect. After changing a merchant ID or keys, re-test payment on a real device. Be careful when rotating credentials while unpaid notify callbacks may still arrive.

Keep project credentials private

Never paste APIv3 keys or merchant private keys into public docs, screenshots, or chat. Enter only the fields DevDeck asks for in the connection dialog.

Build and ship apps with DevDeck.