Card and coupon event push
Card and coupon event push
1.Update log
2. Card and coupon event push
#Card and coupon pass the review, the card and coupon are collected by the user, the card and coupon are deleted by the user, and the card and coupon are canceled by the merchant , entering the official account from the card coupon, etc. will trigger event push, and the event will be sent to the URL filled in by the developer (log in to the official platform and enter [Developer Center Settings]) . Developers can complete data statistics, user identification and other operations through event push.
If the WeChat server does not receive a response within five seconds, it will disconnect the connection and reinitiate the request, retrying three times in total. Regarding retrying message duplication, it is recommended to use FromUserName CreateTime to deduplicate messages. If the server cannot guarantee to process and reply within five seconds, you can directly reply with an empty string. The WeChat server will not do anything with this and will not initiate a retry.
2.1 Review event push
#When the generated coupon passes the review, WeChat will push this event to the developer's filled-in URL.
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[FromUser]]></FromUserName> <CreateTime>123456789</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[card_pass_check]]></Event> //不通过为card_not_pass_check <CardId><![CDATA[cardid]]></CardId> <RefuseReason><![CDATA[非法代制]]></RefuseReason> </xml>
Parameter description:
Version number | Update content | Update Time |
---|---|---|
V1.0 | Write-off event adds a new write-off store, if it is a mobile assistant write-off The underwriter openid can be pushed. | 2015-8-31 |
##V1.1 | New fields related to purchase orders, merchant order number and WeChat payment transaction order number are added to the write-off event. | 2015-9-8 |
##V1.2 | Added a new inventory alarm event. When the user receives the best card and coupon, the inventory alarm event will be pushed | 2015-9-8 |
V1.3 | Add a new library membership card content update event to inform developers of changes in points and balances through events | 2015-10-28 |
V1.4 | New interface for transferring membership cards | 2016-9-19 |
Parameters | Description |
---|---|
##ToUserName | Developer WeChat ID |
FromUserName | Sender account (one OpenID) |
CreateTime | Message creation time (integer) |
MsgType | Message type, event |
CardId | Card ID |
RefuseReason | Reasons for failed review |
Use web debugging tools to debug this interface
2.2 Receive event push
When users receive cards and coupons, WeChat will Push this event to the URL filled in by the developer. Push XML data package example:
<xml> <ToUserName> <![CDATA[gh_fc0a06a20993]]> </ToUserName> <FromUserName> <![CDATA[oZI8Fj040-be6rlDohc6gkoPOQTQ]]> </FromUserName> <CreateTime>1472551036</CreateTime> <MsgType> <![CDATA[event]]> </MsgType> <Event> <![CDATA[user_get_card]]> </Event> <CardId> <![CDATA[pZI8Fjwsy5fVPRBeD78J4RmqVvBc]]> </CardId> <IsGiveByFriend>0</IsGiveByFriend> <UserCardCode> <![CDATA[226009850808]]> </UserCardCode> <FriendUserName> <![CDATA[]]> </FriendUserName> <OuterId>0</OuterId> <OldUserCardCode> <![CDATA[]]> </OldUserCardCode> <OuterStr> <![CDATA[12b]]> </OuterStr> <IsRestoreMemberCard>0</IsRestoreMemberCard> <IsRecommendByFriend>0</IsRecommendByFriend> </xml>
Parameter description:
Parameters | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | The coupon account number (an OpenID). |
CreateTime | Message creation time (integer). |
MsgType | Message type, event |
Event | #Event type, user_get_card (user receives card and coupon). |
CardId | Card ID. |
IsGiveByFriend | Whether it is a transfer to receive, 1 means yes, 0 means no. |
FriendUserName | The field filled in when IsGiveByFriend is 1, indicating the openid of the user who initiated the transfer |
UserCardCode | code serial number. |
OldUserCardCode | To ensure safety, WeChat will change the code number of the card after the transfer occurs. The field indicates the code before transfer. |
OuterStr | Receive scene value, which is used to receive channel data statistics. The string value of this field can be customized in the QR code generation interface and Addcard interface. |
IsRestoreMemberCard | After the user deletes the membership card, it can be retrieved again. When the user's current operation is to retrieve it , the value is 1, otherwise it is 0 |
Use web debugging tools to debug this interface
##2.3 Transfer event push
#When a user transfers a gift card or coupon, WeChat will push this event to the URL filled in by the developer. Push XML packet example:
<xml> <ToUserName><![CDATA[gh_3fcea188bf78]]></ToUserName> <FromUserName><![CDATA[obLatjjwDolFjRRd3doGIdwNqRXw]]></FromUserName> <CreateTime>1474181868</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[user_gifting_card]]></Event> <CardId><![CDATA[pbLatjhU-3pik3d4PsbVzvBxZvJc]]></CardId> <UserCardCode><![CDATA[297466945104]]></UserCardCode> <IsReturnBack>0</IsReturnBack> <FriendUserName><![CDATA[obLatjlNerkb62HtSdQUx66C4NTU]]></FriendUserName> <IsChatRoom>0</IsChatRoom> </xml>
Parameter description:
Use web debugging tools to debug this interface
2.4 Delete event push
When a user deletes a card or coupon, WeChat will Push this event to the URL filled in by the developer. Push XML data package example:
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[FromUser]]></FromUserName> <CreateTime>123456789</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[user_del_card]]></Event> <CardId><![CDATA[cardid]]></CardId> <UserCardCode><![CDATA[12312312]]></UserCardCode> </xml>
Parameter description:
Parameters | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | The coupon account number (an OpenID). |
CreateTime | Message creation time (integer). |
MsgType | Message type, event |
Event | Event type, user_gifting_card (user transfers gift card coupon). |
CardId | Card ID. |
FriendUserName | The openid of the user who receives the coupon |
UserCardCode | code serial number. |
IsReturnBack | ##Whether to return as a gift, 0 means no , 1 represents yes. |
IsChatRoom | Is it a group transfer |
Parameters | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | Sender account (an OpenID) |
CreateTime | Message creation time (integer). |
MsgType | Message type, event |
Event | Event type, user_del_card (user deletes card) |
CardId | Card coupon ID. |
UserCardCode | code serial number. Event push is supported after cards and coupons with custom codes and non-custom codes are collected. |
Use web debugging tools to debug this interface
2.5 Write-off event push
When the card and coupon are written off, WeChat This event will be pushed to the URL filled in by the developer. Push XML packet example:
<xml> <ToUserName> <![CDATA[gh_fc0a06a20993]]> </ToUserName> <FromUserName> <![CDATA[oZI8Fj040-be6rlDohc6gkoPOQTQ]]> </FromUserName> <CreateTime>1472549042</CreateTime> <MsgType> <![CDATA[event]]> </MsgType> <Event> <![CDATA[user_consume_card]]> </Event> <CardId> <![CDATA[pZI8Fj8y-E8hpvho2d1ZvpGwQBvA]]> </CardId> <UserCardCode> <![CDATA[452998530302]]> </UserCardCode> <ConsumeSource> <![CDATA[FROM_API]]> </ConsumeSource> <LocationName> <![CDATA[]]> </LocationName> <StaffOpenId> <![CDATA[oZ********nJ3bPJu_Rtjkw4c]]> </StaffOpenId> <VerifyCode> <![CDATA[]]> </VerifyCode> <RemarkAmount> <![CDATA[]]> </RemarkAmount> <OuterStr> <![CDATA[xxxxx]]> </OuterStr> </xml>
Use the web debugging tool to debug this interface
2.6 Push the purchase event
When the WeChat purchase is completed, WeChat will send this The event is pushed to the URL filled in by the developer. Push XML packet example:
<xml> <ToUserName><![CDATA[gh_e2243xxxxxxx]]></ToUserName> <FromUserName><![CDATA[oo2VNuOUuZGMxxxxxxxx]]></FromUserName> <CreateTime>1442390947</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[user_pay_from_pay_cell]]></Event> <CardId><![CDATA[po2VNuCuRo-8sxxxxxxxxxxx]]></CardId> <UserCardCode><![CDATA[38050000000]]></UserCardCode> <TransId><![CDATA[10022403432015000000000]]></TransId> <LocationId>291710000</LocationId> <Fee><![CDATA[10000]]></Fee> <OriginalFee><![CDATA[10000]]> </OriginalFee> </xml>
Parameter | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | Sender account (an OpenID). |
CreateTime | Message creation time (integer). |
MsgType | Message type, event. |
Event | Event type, user_consume_card (write-off event) |
CardId | Card ID. |
UserCardCode | Card code. |
ConsumeSource | Confirmation source. Supports developer statistics API write-off (FROM_API), public platform write-off (FROM_MP), card and coupon merchant assistant write-off (FROM_MOBILE_HELPER) (verifier WeChat ID) |
LocationName | Store name, the name of the store where the current card and coupon are being verified (this field will only appear through self-service verification and purchase order verification) |
StaffOpenId | The openid of the person who verifies the card and coupon (will only appear when verification is done through the card and coupon merchant assistant) |
VerifyCode | The verification code entered by the user during self-service verification |
##RemarkAmount | The remark amount entered by the user during self-service write-off |
OuterStr | Initiated by the developer Custom parameters passed in during write-off, used for write-off channel statistics |
Use web debugging tools to debug this interface
2.7 Enter membership card event push
When the user enters the membership card, WeChat will push this event to the URL filled in by the developer.
Developers are required to fill in the need_push_on_view field and set it to true when creating a membership card. Developers must consider the number of cardholders and server pressure to decide whether to accept this event.
Push XML packet example:
<xml> <ToUserName> <![CDATA[gh_fcxxxx6a20993]]> </ToUserName> <FromUserName> <![CDATA[oZI8Fj040-xxxxx6gkoPOQTQ]]> </FromUserName> <CreateTime>1467811138</CreateTime> <MsgType> <![CDATA[event]]> </MsgType> <Event> <![CDATA[user_view_card]]> </Event> <CardId> <![CDATA[pZI8Fj2ezBbxxxxxT2UbiiWLb7Bg]]> </CardId> <UserCardCode> <![CDATA[4xxxxxxxx8558]]> </UserCardCode> <OuterStr> <![CDATA[12b]]> </OuterStr> </xml>
Parameter description:
Parameter | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | Sender account (an OpenID). |
CreateTime | Message creation time (integer). |
MsgType | Message type, event. |
##Event | Event type, User_pay_from_pay_cell (WeChat pay event) |
CardId | Card ID. |
UserCardCode | Card code. |
TransId | WeChat payment transaction order number (only cards and coupons that are verified using the purchase function will appear) |
LocationId | Store ID, the store ID of the current card and coupon verification (only through the card and coupon merchant assistant and It will only appear when the purchase order is written off) |
Fee | Amount actually paid, in cents |
OriginalFee | Amount payable in cents |
Parameters | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | Sender account (an OpenID). |
CreateTime | Message creation time (integer). |
MsgType | Message type, event. |
Event | Event type, user_view_card (user clicks on membership card) |
CardId | Card ID. |
UserCardCode | Merchant customized code value. The non-customized code is pushed as an empty string. |
OuterStr | Merchant-defined QR code channel parameters are used to identify this scan code to open the membership card The source comes from the QR code of a certain channel value |
Use web debugging tools to debug this interface
##2.8 Enter the official account session event push from the card coupon
The user clicks on the card coupon to view the official account to enter the session (the user needs to have followed the official account), WeChat will push this event to the URL filled in by the developer. Developers can identify users who enter the official account from cards and coupons. Push XML data package example:
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[FromUser]]></FromUserName> <CreateTime>123456789</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[user_enter_session_from_card]]></Event> <CardId><![CDATA[cardid]]></CardId> <UserCardCode><![CDATA[12312312]]></UserCardCode> </xml>
Parameter description:
Parameters | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | Sender account (an OpenID) |
CreateTime | Message creation time (integer). |
MsgType | Message type, event |
Event | Event type, user_enter_session_from_card (the user enters the official account session from the card coupon) |
CardId | Card ID. |
UserCardCode | Code code. |
Use web debugging tools to debug this interface
##2.9 Membership card content update event
When the user’s membership card points balance changes, WeChat will push the event Notify developers. Push XML packet example:
<xml> <ToUserName><![CDATA[gh_9e1765b5568e]]></ToUserName> <FromUserName><![CDATA[ojZ8YtyVyr30HheH3CM73y7h4jJE]]></FromUserName> <CreateTime>1445507140</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[update_member_card]]></Event> <CardId><![CDATA[pjZ8Ytx-nwvpCRyQneH3Ncmh6N94]]></CardId> <UserCardCode><![CDATA[485027611252]]></UserCardCode> <ModifyBonus>3</ModifyBonus> <ModifyBalance>0</ModifyBalance> </xml>
Parameter description:
Parameters | Description |
---|---|
ToUserName | Developer WeChat ID. |
FromUserName | Sender account (an OpenID) |
CreateTime | Message creation time (integer). |
MsgType | Message type, event |
Event | Event type, update_member_card (membership card content update) |
CardId | Card coupon ID. |
UserCardCode | Code code. |
ModifyBonus | Changed points value. |
ModifyBalance | The changed balance value. |
Use web debugging tools to debug this interface
##2.10 Inventory Alarm Event
#When the initial inventory of a card_id is greater than 200 and the current inventory is less than or equal to 100, the user attempts to receive the coupon will trigger a sending event To merchants, events are sent every 12 hours.
<xml> <ToUserName><![CDATA[gh_2d62d*****0]]></ToUserName> <FromUserName><![CDATA[oa3LFuBvWb7*********]]></FromUserName> <CreateTime>1443838506</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[card_sku_remind]]></Event> <CardId><![CDATA[pa3LFuAh2P65**********]]></CardId> <Detail><![CDATA[the card's quantity is equal to 0]]></Detail> </xml>
Parameter description:
Parameters | Description |
---|---|
ToUserName | Developer WeChat ID |
##FromUserName | Sender, WeChat |
CreateTime | Message creation time (integer) |
MsgType | Message type, event |
Event | Event type, card_sku_remind inventory alarm |
CardId | Card Coupon ID |
Detail | Alarm details |
Use web debugging tools to debug this interface
##2.11 Coupon point transaction details event
#When a merchant’s friend’s coupon points change, the WeChat server will push a message to the merchant server.
<xml> <ToUserName><![CDATA[gh_7223c83d4be5]]></ToUserName> <FromUserName><![CDATA[ob5E7s-HoN9tslQY3-0I4qmgluHk]]></FromUserName> <CreateTime>1453295737</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[card_pay_order]]></Event> <OrderId><![CDATA[404091456]]></OrderId> <Status><![CDATA[ORDER_STATUS_FINANCE_SUCC]]></Status> <CreateOrderTime>1453295737</CreateOrderTime> <PayFinishTime>0</PayFinishTime> <Desc><![CDATA[]]></Desc> <FreeCoinCount><![CDATA[200]]></FreeCoinCount> <PayCoinCount><![CDATA[0]]></PayCoinCount> <RefundFreeCoinCount><![CDATA[0]]></RefundFreeCoinCount> <RefundPayCoinCount><![CDATA[0]]></RefundPayCoinCount> <OrderType><![CDATA[ORDER_TYPE_SYS_ADD]]></OrderType> <Memo><![CDATA[开通账户奖励]]></Memo> <ReceiptInfo><![CDATA[]]></ReceiptInfo> </xml>
Parameter description:
##FromUserNameSender, WeChatCreateTimeMessage creation time (integer)MsgTypeMessage type, eventEventEvent type, card_pay_order coupon point transaction details eventOrderIdUse web debugging tools to debug this interface
2.12 Membership card activation event push
When the user submits information through one-click activation and clicks to activate, the merchant will receive an event push activated by the user
<xml> <ToUserName> <![CDATA[gh_3fcea188bf78]]></ToUserName> <FromUserName><![CDATA[obLatjlaNQKb8FqOvt1M1x1lIBFE]]></FromUserName> <CreateTime>1432668700</CreateTime> <MsgType><![CDATA[event]]></MsgType> <Event><![CDATA[submit_membercard_user_info]]></Event> <CardId><![CDATA[pbLatjtZ7v1BG_ZnTjbW85GYc_E8]]></CardId> <UserCardCode><![CDATA[018255396048]]></UserCardCode> </xml>
Parameter Description
Parameters | Description |
---|---|
##ToUserName | Developer WeChat ID |
The order number corresponding to this push | |
Status | This order The status of the number, ORDER_STATUS_WAITING Waiting for payment ORDER_STATUS_SUCC Payment successful ORDER_STATUS_FINANCE_SUCC Adding tokens successfully ORDER_STATUS_QUANTITY_SUCC Adding inventory successfully ORDER_STATUS_HAS_REFUND Refunded coins ORDER_STATUS_REFUND_WAITING Waiting for coin refund confirmation ORDER_STATUS_ROLLBACK Refunded, system failure ORDER_STATUS_HAS_RECEIPT Invoice issued |
CreateOrderTime | When purchasing coupon points, the payment QR code generation time |
##PayFinishTime | When purchasing coupon points, the actual time when payment is successful |
Desc | Payment method, usually WeChat Pay recharge |
FreeCoinCount | Number of remaining free coupon points |
PayCoinCount | Number of remaining paid coupon points |
RefundFreeCoinCount | The number of free coupon points for this change |
RefundPayCoinCount | This time Changed number of paid coupon points |
##OrderType | Order type to be pulled ORDER_TYPE_SYS_ADD Platform gift coupon points ORDER_TYPE_WXPAY Recharge coupon points ORDER_TYPE_REFUND Inventory unused refund coupon points ORDER_TYPE_REDUCE Coupon points exchange for inventory ORDER_TYPE_SYS_REDUCE Platform deduction |
Memo | System notes explain the reasons for this change, such as account opening rewards, store rewards, write-off rewards, and recharges and deductions. |
ReceiptInfo | Details of the invoice issued |
## parameter | |
---|---|
##CardId | Card Coupon Code |
Use the web debugging tool to debug the interface |