Small program self-built platform to invoice and save to WeChat card package

This is the first time I have come into contact with the business of invoicing from a WeChat applet and then saving it to the WeChat card package. Let me share the business process and the interface that needs to be called.

First of all, I would like to make a statement, because I use a self-built platform for invoicing, so it is relatively cumbersome. If I use WeChat to invoice, it may be a little easier, but because I have not encountered this business requirement, I don’t know much about it. Now let me say Take a look at the business process of self-built platform!

1. Introduction to self-built platform preparations:
while the merchant is responsible for obtaining the user's invoicing authorization, the merchant issues an electronic invoice and adds it to the user's WeChat card package. In this mode, since the electronic invoice PDF is directly generated on the merchant's self-built invoicing platform, it is more efficient for the merchant to complete the entire process.
1. Go to the WeChat official account to apply for the appid and appsecret of the WeChat official account, which are used to call the interface.
2. Obtain access_token. For details, you can go to the WeChat development document to view the main process behind the interface for obtaining access_token. I will also talk about it.
3. Obtain the ticket. For details, see Obtaining the ticket interface.
4. Configure official account callback, see Configuring Official Account Callback for details.

2. Card pack insertion process

insert image description here

3. Insert the interface required by the card pack

  1. Obtain the billing platform ID s_pappid, because the same billing platform can be obtained only once, and the ID obtained by obtaining the same billing platform again is the same. Different access modes have slightly different ways to obtain the representation. I am a self-built mode, and I can obtain the billing platform ID s_pappid by calling to obtain my own billing platform identification code .
  2. Merchant obtains access_token, calling method see Obtaining access_token
  3. Set up the merchant’s contact information. For the calling method, see Setting up the merchant’s contact information . Note: the setting of the merchant’s contact information must not be missing, otherwise an error will be reported when obtaining the authorization page.
  4. Obtain the authorization page ticket, the calling method can be seen to obtain the authorization page ticket
  5. The merchant obtains the authorization page url, and the authorization page ticket obtained in the previous step will be passed in as a parameter. In addition, the order_id passed in as a parameter in this link should be reserved and passed to the invoicing platform as the basis for providing electronic invoices to users. For the calling method, see Obtaining the authorization page url
  6. Deploy the logic of jumping to the authorization page of the applet on the click event of the applet billing button. The auth_url and billing applet appid obtained in the previous step should be passed in as parameters. For the calling method, see the applet to open the authorization page
  7. The merchant is waiting in the background to receive the user's authorization completion event. For the method of obtaining the authorization event, see Receiving the authorization completion event push . Here, you need to configure the callback callback address mentioned above to see if the personal business needs to record authorization information.
  8. Create invoice coupon templates. The invoice card template should form a one-to-one correspondence with the billing subject behind it, so that it can be easily modified later if the billing subject changes. For the calling method, see Creating an Invoice Card Roll Template
  9. Issue electronic invoices on the self-built invoice platform;
  10. Upload the invoice PDF file. The s_media_id obtained in this step plays the role of associating the PDF with the invoice coupon, and will be passed in as a parameter in the card insertion interface in the next step. For calling methods, see Upload Invoice PDF
  11. Add electronic invoices to the user's WeChat card package. For the calling method, see Adding an Electronic Invoice to a User's WeChat Card Package

Even if the business is over at this point, the specific business depends on what you need, and the code will not be pasted out. Templates are provided in the document.

おすすめ

転載: blog.csdn.net/qq_45699784/article/details/121975396