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

WeChat small program underpayment payment


May 18, 2021 WeChat Mini Program Development Document


Table of contents


Underpayment

WeChat background informs the owner that the payment was successful (no notification if the payment failed).

1, request parameters

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

encrypted_data decrypted data

The name of the argument Type Required Note
out_user_id string Y Owner background to the user's identity, set up when the registration callback interface exists
Openid string Y User openid
bank_type string Y Payment type, with a string type of bank identity
total_fee Int Y Pay the fee
transaction_id string Y WeChat payment slip number
time_end string Y The format is yyyyyMddHmmss, e.g. 9:10:10 on December 25, 2009 expressed as 20091225091010
repay_no string Y The number of the bill owed
order_no array Y The ride code number associated with this owe single number (there is a case of paying multiple rides), each of the content is String
order array Y Detailed information about the passenger code number associated with this owe single number

Each of the ORDER is as follows:

parameter name type required Remark
order_no string Y Taxation code number
attach string Y Additional information from high-densive deduction
base64_qrcode string Y Base64 passenger code information
out_order_no string Y External password number

2, return parameters

parameter name type required Remark
errcode int Y 0 is successful
errmsg string N Error message
nonce_str string Y Bring back

3, example

ask:

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

Encrypted_data decryption is:

{
    "out_user_id":"xxx",
    "openid":"1234",
    "bank_type":"LQT",
    "total_fee":123,
    "transaction_id":"12312312",
    "time_end":"2020030319551111",
    "repay_no":"2020202202020",
    "order_no":[
        "123",
        "456"]
}

Return:

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