After the last essay, after improving and reconstructing the entire WeChat framework, WeChat payment, corporate payment, cash red envelopes, vouchers and various card coupons have been packaged, and WeChat payment has been included and the shake red envelope part are common parts of official accounts and enterprise accounts. These payment-related interfaces can be called in official accounts and enterprise accounts. After a series of optimization and sorting, these contents will be added one by one. Introducing, hope everyone likes and supports.
1) Usage scenarios
WeChat Pay cash red envelopes are developed for WeChat Pay merchants. The specific capabilities are as follows:
◆ When merchants call the interface, they issue red envelopes by specifying the sending object and the sending amount. This method allows merchants to flexibly apply it to a variety of rich activity scenarios
◆ Receive After receiving the red envelope, the user's funds are directly transferred to WeChat change, avoiding the complicated award process and giving users the smooth experience of WeChat payment.
2) WeChat red envelope sending rules
Sending frequency rules
◆ The number of red envelopes sent per minute shall not exceed 1,800;
◆ The same merchant number, the maximum number of red envelopes sent per minute The same user sends a red envelope;
Red envelope rules
◆ The amount of a single red envelope is between [1.00 yuan, 200.00 yuan];
◆ The same red envelope can only be sent to one user; (If the above rules do not meet your needs, please send an email to wxhongbao@tencent.com for upgrade instructions)
◆ If the red envelope is not claimed 72 hours after it is issued, it will be processed Refund
3) WeChat red envelope interface calling process
◆Backend API call: communicate with the development team in detail when entering the joint debugging process;
◆ Notify the server: Inform the server of the openID of the user who received the WeChat red envelope, and inform the server of the amount received by the user;
◆ Deduct money from the business account: After the server obtains the information, it will deduct the money from the corresponding business account Get the corresponding amount;
◆ Call failure: The call fails due to non-compliance with the sending rules, insufficient balance of the business account, etc., and feedback to the caller;
◆ Successful sending: public with WeChat red envelope The account sends the corresponding red envelope to the corresponding user;
is used by enterprises to send red envelopes to individual WeChat users. It currently supports issuing red envelopes of specified amounts to the openid of designated WeChat users.
Although cash red envelopes can be issued through the merchant backend of WeChat, we can also use the interface API provided by WeChat to send cash red envelopes.
Request Url | https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack |
---|---|
Is it required? The certificate | is (see the merchant certificate for certificate and usage instructions) |
Request method | POST |
Field | Required | Example value | Type | Description | |
---|---|---|---|---|---|
nonce_str | is | 5K8264ILTKCH16CQ2502SI8ZNMTM67VS | String(32) | Random string, no longer than 32 characters | |
sign | is | C380BEC2BFD727A4B6845133519F3AD6 | String(32) | See signature generation algorithm for details | |
mch_billno | is | 10000098201411111234567890 | String(28) | Merchant order number (each order number must be unique) |
Composition: mch_id+yyyymmdd+10 digits cannot be repeated within one day number. The interface supports re-entry based on the merchant's order number. If a timeout occurs, it can be called again. |
mch_id | is | 10000098 | String(32) | The merchant number assigned by WeChat payment | |
wxappid | is | wx8888888888888888 | String(32) | The public account ID assigned by WeChat (corporate number corpid is this appId). All appids passed in through the interface should be the appid of the public account (applied at mp.weixin.qq.com), not the appid of the APP (applied at open.weixin.qq.com). | |
send_name | is | Tianhong Department Store | String(32) | Red envelope sender name | |
re_openid | is | oxTWIuGaIt6gTKsQRLau2M0yL16E | String(32 ) | Users who accept red envelopes |
The user’s openid under wxappid |
total_amount | is | 1000 | int | Payment amount, unit points | |
total_num | is | 1 | int | The total number of people given red envelopes |
total_num=1 |
wishing | Yes | Thank you for participating in the lantern riddle guessing activity, and I wish you a happy Lantern Festival! | String(128) | Red envelope blessings | |
client_ip | is | 192.168.0.1 | String(15) | Machine IP address calling the interface | |
act_name | is | Guessing lantern riddles and grabbing red envelope activities | String(32) | Activity name | |
remark | Yes | The more you guess, the more you get, come and grab it! | String(256) | Remarks |