Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program user registration contract (optional)


May 18, 2021 WeChat Mini Program Development Document


Table of contents


User registration/contracting (optional)

WeChat background to the owner to initiate user registration.

1, request parameters

The name of the argument Type Required Note
appid string Y Small program
appidmch_id string Y Pay the merchant number
nonce_str string Y Random string
encrypted_data string Y Use AESCBCPKCS7PADDING
string Y Iv for decryption
sign string Y Signature of 1 to 5 fields

encrypted_data decrypted data

The name of the argument Type Required Note
Openid string Y The user id

2, return parameters

The name of the argument Type Required Note
errcode Int Y 0 is a success
errmsg string N The error message
nonce_str string Y Bring it back as is
encrypted_data string Y Use AESCBCPKCS7PADDING
string Y Iv for decryption

encrypted_data decrypted data

The name of the argument Type Required Note
cardid string Y The user card ID

3, sample code

Request:

{"appid":"test","mch_id":"123456","nonce_str":"abcdefg","encrypted_data":"jfiwajeofjiefef","iv":"afweifwefe"}

encrypted_data is decrypted:

{“openid”:”1234”}

Return:

{"errcode":0,"nonce_str":"abcdefg","encrypted_data":"jfiwajeofjiefef","iv":"afweifwefe"}

encrypted_data decrypted data:

{“card_id”:”xxafdafd”}