Wechat applet series - template message error prompt: errcode: 41028, errmsg: "invalid form id hint: how to solve

I have been engaged in java development of Internet projects for five years, and I am proficient in java, python, nodejs, front-end, crawler and other technologies. I am also working hard to implement a set of WeChat's third open platform ( JWechat ), which will be open sourced at that time.
QQ technical exchange group: 131831533 This article comes from a personal site: Haohan Feilong

Sending a Mini Program template message requires the following conditions:

1) *Payment
When the user has completed the payment behavior in the Mini Program, the developer can be allowed to push a limited number of template messages to the user within 7 days (3 messages can be sent for one payment, and the number of messages for multiple payments is independent. do not affect each other)


2) *Submit form
When the user has submitted the form in the applet and the form is declared to send template messages, and the developer needs to provide services to the user, the developer can be allowed to push a limited number of messages to the user within 7 days. Template message (one form can be issued for one submission, and the number of dispatched messages for multiple submissions is independent and does not affect each other)

You can see the above points are the restraint of WeChat. You can only send template message reminders three times if the payment is successful. If you just submit the form, you can only send template message reminders once.

According to the above requirements, there are solutions as follows:

Step 1: Do you really get the formId through these two methods?

(1) Through the <form/> component of the page, when the attribute report-submit is true, it can be declared that a template message needs to be sent. At this time, click the button to submit the form to obtain the formId, which is used to send the template message.

(2) When the user completes the payment behavior, the prepay_id can be obtained to send the template message.

Step 2: If the above steps are correct, it is wrong to not pass parameters

Standard writing: form_id: "wx2017xxxxxx"

instead of these:

(1)form_id:"wx2017xxxxxx"
          (2)form_id=”prepay_id:wx2017xxxxxx”
          (3) prepay_id:”wx2017xxxxxx”
          (4) prepay_id:”prepay_id:wx2017xxxxxx”

Step 3: Make sure you are not developing debugging tools, because sending template messages is not supported

Verify as follows:

1) The form submission method formId is not available as shown below:

2) The payment method steps are as follows:

When using WeChat Pay to finally submit the template message, an error will be reported: errcode=41028, errmsg=invalid form id hint: [xIS1FA0785ge29](null)

To sum up, it is impossible to debug the WeChat applet on the development and debugging tools to make template messages.

Step 4: Send template messages through remote debugging, and verify that all passed the test

To connect remote debugging, click here:

Verify as follows:

1) The form submission method formId can be obtained, as shown in the figure

Send template message by calling api, the success message is as follows

2) Payment method verification is also possible.

So it's not scary to make mistakes, what's scary is that you don't find the right location.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324987301&siteId=291194637