WeChat Mini Program Payment

WeChat Mini Programs are mobile app-like applications built using WeChat’s own markup language and framework. Mini programs are published to and hosted on WeChat servers.
To initiate a WeChat Payment request inside WeChat Mini Programs, in the merchant’s script, an HTTP request is made to Citcon’s API via wx.request, together with an openid that the Mini Program obtained from user login, and the other payment related data. Citcon processes the API request and responds with necessary parameters for Mini Program to invoke WeChat Pay directly. The response is in JSON.

Citcon recommends that merchants invoke this API from merchant’s backend services, instead of from Mini Programs directly. Because the token and ipn_url are in the API request, initiating the call from Mini Programs adds security risk to exposure of such sensitive information. The preferred architecture is:

End Point

For more details, check out the source code on Github

  1. Mini Program uses wx.request() function to invoke merchant’s own backend service, passes in the openid (obtained from wx.login() function), and other payment related data;
  2. Merchant’s backend calls Citcon’s Mini Program Payment API and passes in the code and other parameters identified below in the specification;
  3. Citcon returns Mini Program required payment parameters, as described below, to merchant’s backend;
  4. Merchant’s backend relays and returns the same parameters returned by Citcon API to Mini Program;
  5. Mini Program invokes wx.requestPayment() function together with the parameters received from merchant’s backend
Scroll to Top