First, configuration parameters
Define (' Weixin_appid ', ' wxzzzzzzzz ');
Define (' Weixin_appsecret ', ' Ouewjdsaudsamkh ');
Define (' Weixin_token ', ' 9973833232232 ');
Define (' Weixin_notify_url ', ' http://xx.com/xx/xx ');
Define (' Weixin_mchid ', ' 322221121 ');
Define (' Weixin_key ', ' xddsdswewew ');
1) Development of micro-credit ID
weixin_appid: Application ID
Weixin_appsecret: Applying a key
into the Public Platform home page, click the Developer center, impressively can see, the configuration page, these two defaults are there.
2) Server Configuration
Weixin_token, that is, the TOKEN token, custom, must be English or numeric, length 3-32 characters.
URL server address, also say the micro-trust the entry address of the public number. In this page, I will do signature verification or receive event messages, click to view the micro-letter related documents.
1, Signature verification: When modifying the configuration, it is necessary to do signature verification through this address
2, receive the event message: refers to when the attention of the push to send some messages over, and can do some specific logical operation
3) Micro-credit Payment configuration
Click on the Micro-credit Payment Menu
Weixin_mchid: Merchant number, can be found in merchant information
weixin_notify_url: Micro-credit payment asynchronous callback API, you can do update order status, send a push and other logic
Weixin_key: Set up this payment key to login to the micro-mail payment merchant platform, login and click into the API security, and then download the certificate and set up their own keys, OK.
Second, request and debugging
PHP has a very convenient curl, here to mention the Curlopt_ssl_verifypeer. At first, this attribute was not added, and the data returned at the time of request to the micro-trust server was false. After using Firefox httprequester simulation request, you can return to the data, find the data found to set this property.
Curlopt_ssl_verifypeer: Whether to detect whether the server's certificate is issued by a licensed CA certified by a regular browser
/**
* Original post
* @param URL address of the $url request
* @param $raw raw data, can be a string or an array
* @return Mixed return request value
*/
Public Function Rawpost ($url, $raw)
{
$resource = Curl_init ();
curl_setopt ($resource, Curlopt_post, true);
curl_setopt ($resource, Curlopt_url, $url);
curl_setopt ($resource, Curlopt_postfields, $raw);
curl_setopt ($resource, Curlopt_returntransfer, true);
curl_setopt ($resource, Curlopt_ssl_verifyhost, false);
curl_setopt ($resource, Curlopt_ssl_verifypeer, false);
curl_setopt ($resource, Curlopt_httpheader, Array (' Expect: '));
$data = curl_exec ($resource);
Curl_close ($resource);
return $data;
}
It is recommended that the next httprequester, this plug-in, can simulate post, get and other submissions, content type can also be selected.
Micro-credit development also provides a place for online test interfaces. Click to view the micro-trust public platform Interface debugging tool.
When debugging is requested, the micro-letter returns a variety of return codes. Click to view the global return code description.