Contents
1. Invoicing with Official Accounts
2. Invoicing by Scanning QR Code
3. Invoicing with Apps
4. Invoicing with Mini Programs
5. Post-Payment Invoicing

# Introduction

This document describes how merchants that activate the E-Invoicing feature via the Official Accounts issue e-invoices to users in different scenarios, including the scenario description, interaction process on user side and API workflow. You can proceed with the development by following the steps described for your scenario, and access the API document in each step via the provided link.

# 1. Invoicing with Official Accounts

# 1.1 Scenario Description

Invoicing with Official Accounts refers to a scenario where an invoice is issued after a purchase is initiated in an Official Account and the payment is made on an H5 page in Weixin. The Invoicing button is provided on the merchant's H5 page. After tapping this button, the user goes to the Weixin invoicing authorization page to complete the authorization, and then returns to the original page or is redirected to the merchant's another page (such as the order page). The issued invoice is synced to the user's Weixin Cards & Offers. The overall process is asynchronous, without users having to stay on the page to wait for the invoice.

# 1.2 Interaction Process on User Side

The interactions for invoicing with Official Accounts are shown below:
Invoicing with Official Accounts

# 1.3 API Workflow

The workflow of invoicing with Official Accounts is shown below:
Invoicing with Official Accounts The steps of invoicing with Official Accounts are as follows:

  1. Obtain the invoicing platform s_pappid. An invoice platform has only one s_pappid, so you only need to obtain it once. The method for obtaining s_pappid varies with different business modes:
If you activate the E-Invoice feature using the Official Accounts Platform account, the s_pappid can be found on the details pages of orders with a "Completed" status, as shown below.

Check s_pappid 2. Obtain the access_token by calling the API. For more information, see Obtaining access_token.
3. Obtain the authorization page ticket. For more information, see the API List for Merchants.
4. Obtain the authorization page URL. The authorization page ticket obtained in the previous step is used as an input parameter. In addition, please keep the input parameter order_id in this step properly, which will be used by the invoicing platform to issue the e-invoice. For more information, see the API List for Merchants.
5. Add the authorization page URL to the Invoicing button, so that the user can be redirected to the page after tapping the button.
6. Receive the user authorization completion event at backend. For more information, see the API List for Merchants.
7. Check the merchant ID, which will be a part of the invoice request no. (fpqqlsh). The merchant ID can be found on the details pages of orders with a "Completed" status, as shown below. Check merchant ID 8. Initiate the invoicing request. The order_id from Step 4 should be provided as an input parameter. For more information, see the API List for Merchants.
The merchant ID obtained in the previous step occupies the first six digits of the invoice request no. (fpqqlsh) when the relevant API is called (For more information, see the API List for Merchants). If an incorrect value is entered, an error will occur.
9. The invoicing platform issues the e-invoice and adds it to the user's Cards & Offers. (This step is completed by the invoicing platform and no development by merchant is required).
10. If invoicing takes a long time and the invoicing platform is unable to return the invoicing result within the specified time limit, a status of "Invoicing" (error code: 73105) is returned. After the invoicing result is got, it is notified to the merchant through the async callback mechanism. For more information, see the API List for Merchants.
11. If an invoicing failure (an error code other than 0, 73105, and 73107) is returned, edit the invoicing information based on the error description and then request invoicing again using a new invoice request no..
12. If no response is returned for a long time, call the "Query Invoices" API to query the invoicing status and obtain the invoice information or invoicing error information based on the returned result. For more information, see the API List for Merchants.

#2. Invoicing by Scanning QR Code

# 2.1 Scenario Description

The "Invoicing by Scanning Code" scenario is common in the offline industries where receipts need to be provided to users, such as retailers, restaurants, convenience stores, and gas stations. A merchant converts the order information into an invoicing QR code, which is printed on the receipt provided to the user. After scanning the QR code, the user goes to the Weixin authorization page and quickly inputs the required information using the invoice title information saved in Weixin. After tapping the Invoicing button, the user closes the current page or is redirected to another page of the merchant (such as the order page). The issued invoice is synced to the user's Weixin Cards & Offers, so that the user can collect the invoice themselves, without having to involving additional personnel. This greatly improves the working efficiency of checkout counters. The overall process is asynchronous, without users having to stay on the page to wait for the invoice.

# 2.2 Interaction Process on User Side

The interactions for invoicing by scanning QR code are shown below:
Invoicing by scanning QR code

# 2.3 API Workflow

The workflow of invoicing by scanning QR code is shown below:
Invoicing by scanning QR code The steps of invoicing by scanning code are as follows:

  1. Obtain the invoicing platform s_pappid. An invoice platform has only one s_pappid, so you only need to obtain it once. The method for obtaining s_pappid varies with different business modes:
If you activate the E-Invoice feature using the Official Accounts Platform account, the s_pappid can be found on the details pages of orders with a "Completed" status, as shown below.

Check s_pappid 2. Generate the QR code based on your own business logic and print it on the receipt for the user to scan. This step does not involve calling a Weixin API. 3. Obtain the access_token by calling the API. For more information, see Obtaining access_token. 4. Obtain the authorization page ticket. For more information, see the API List for Merchants. 5. Obtain the authorization page URL. The authorization page ticket obtained in the previous step is used as an input parameter. In addition, please keep the input parameter order_id in this step properly, which will be used by the invoicing platform to issue the e-invoice. For more information, see the API List for Merchants. 6. Receive the user authorization completion event at backend. For more information, see the API List for Merchants. 7. Check the merchant ID, which will be a part of the invoice request no. (fpqqlsh). The merchant ID can be found on the details pages of orders with a "Completed" status, as shown below. Check merchant ID 8. Initiate the invoicing request. The order_id from Step 4 should be provided as an input parameter. For more information, see the API List for Merchants.
The merchant ID obtained in the previous step occupies the first six digits of the invoice request no. (fpqqlsh) when the relevant API is called (For more information, see the API List for Merchants). If an incorrect value is entered, an error will occur.
9. The invoicing platform issues the e-invoice and adds it to the user's Cards & Offers. (This step is completed by the invoicing platform and no development by merchant is required).
10. If invoicing takes a long time and the invoicing platform is unable to return the invoicing result within the specified time limit, a status of "Invoicing" (error code: 73105) is returned. After the invoicing result is got, it is notified to the merchant through the async callback mechanism. For more information, see the API List for Merchants.
11. If an invoicing failure (an error code other than 0, 73105, and 73107) is returned, edit the invoicing information based on the error description and then request invoicing again using a new invoice request no..
12. If no response is returned for a long time, call the "Query Invoices" API to query the invoicing status and obtain the invoice information or invoicing error information based on the returned result. For more information, see the API List for Merchants.

3. Invoicing with Apps

# 3.1 Scenario Description

The "Invoicing with Apps" scenario is mainly used for the merchants that conduct business through an App, such as e-commerce merchants and online service platforms. The Invoicing button is provided on a merchant's App interface. After tapping the button, the user goes to the authorization page in Weixin. After the authorization is completed, the user returns to the original App. The issued invoice is synced to the user's Weixin Cards & Offers. The overall process is asynchronous, without users having to stay in Weixin to wait for the invoice. This ensures a consistent and smooth user experience in the App.

# 3.2 Interaction Process on User Side

The interactions for invoicing with Apps are shown below: Invoicing with Apps

# 3.3 API Workflow

The workflow of invoicing with Apps is shown below:  Invoicing with Apps The steps of invoicing with Apps are as follows:

  1. Ensure that the latest version of Weixin SDK is installed in the App.
  2. Obtain the invoicing platform s_pappid. An invoice platform has only one s_pappid, so you only need to obtain it once. The method for obtaining s_pappid varies with different business modes:
If you activate the E-Invoice feature using the Official Accounts Platform account, the s_pappid can be found on the details pages of orders with a "Completed" status, as shown below.

Check s_pappid 3. Obtain the access_token using the appid of the Open Platform. For more information, see Obtaining access_token.
4. Obtain the authorization page ticket. For more information, see the API List for Merchants.
5. Obtain the authorization page URL. The authorization page ticket obtained in the previous step is used as an input parameter. In addition, please keep the input parameter order_id in this step properly, which will be used by the invoicing platform to issue the e-invoice. For more information, see the API List for Merchants.
6. Use the authorization page URL (auth_url) obtained in Step 5 as an input parameter to open the authorization page in Weixin. For more information on the process on iOS devices, see Opening Authorization Page on iOS devices; for Android devices, see Opening Authorization Page on Android devices.
7. Receive the user authorization completion event at backend. Please note that the event is received using the Official Account appid, instead of the Open Platform account appid. For more information, see the API List for Merchants.
8. Check the merchant ID, which will be a part of the invoice request no. (fpqqlsh). The merchant ID can be found on the details pages of orders with a "Completed" status, as shown below. Check merchant ID
9. Initiate the invoicing request. The order_id from Step 4 must be provided as an input parameter. For more information, see the API List for Merchants.
The merchant ID obtained in the previous step occupies the first six digits of the invoice request no. (fpqqlsh) when the relevant API is called (For more information, see the API List for Merchants). If an incorrect value is entered, an error will occur.
10. The invoicing platform issues the e-invoice and adds it to the user's Cards & Offers. (This step is completed by the invoicing platform and no development by merchant is required).
11. If invoicing takes a long time and the invoicing platform is unable to return the invoicing result within the specified time limit, a status of "Invoicing" (error code: 73105) is returned. After the invoicing result is got, it is notified to the merchant through the async callback mechanism. For more information, see the API List for Merchants.
12. If an invoicing failure (an error code other than 0, 73105, and 73107) is returned, edit the invoicing information based on the error description and then request invoicing again using a new invoice request no..
13. If no response is returned for a long time, call the "Query Invoices" API to query the invoicing status and obtain the invoice information or invoicing error information based on the returned result. For more information, see the API List for Merchants.

# 4. Invoicing with Mini Programs

# 4.1 Scenario Description

Invoicing with Mini Programs refers to a scenario where an invoice is issued after a purchase is initiated in a Mini Program. The Invoicing button is provided on the merchant's Mini Program page. After tapping this button, the user goes to the Mini Program invoicing authorization page to complete the authorization, and then returns to the original page or is redirected to the merchant's another page (such as the order page). The issued invoice is synced to the user's Weixin Cards & Offers. The overall process is asynchronous, without users having to stay on the page to wait for the invoice.

# 4.2 Interaction Process on User Side

The interactions for invoicing with Mini Programs are shown below: 小程序开票

# 4.3 API Workflow

The workflow of invoicing with Mini Programs is shown below: Invoicing with Mini Programs

The steps of invoicing with Mini Programs are as follows:

  1. Obtain the invoicing platform s_pappid. An invoice platform has only one s_pappid, so you only need to obtain it once. The method for obtaining s_pappid varies with different business modes:
If you activate the E-Invoice feature using the Official Accounts Platform account, the s_pappid can be found on the details pages of orders with a "Completed" status, as shown below.

Check s_pappid 2. Obtain the access_token by calling the API. For more information, see Obtaining access_token. 3. Obtain the authorization page ticket. For more information, see the API List for Merchants.
4. Obtain the authorization page URL. The authorization page ticket obtained in the previous step is used as an input parameter. In addition, please keep the input parameter order_id in this step properly, which will be used by the invoicing platform to issue the e-invoice. For more information, see the API List for Merchants.
5. Deploy the logic to redirect to the Mini Program authorization page on the Tap event of the Mini Program's Invoicing button. The auth_url and the invoicing Mini Program appid obtained in the previous step are passed as input parameters. For more information, see the API List for Merchants.
6. Receive the user authorization completion event at backend. For more information, see the API List for Merchants.
7. Check the merchant ID, which will be a part of the invoice request no. (fpqqlsh). The merchant ID can be found on the details pages of orders with a "Completed" status, as shown below. Check merchant ID
8. Initiate the invoicing request. The order_id from Step 4 must be provided as an input parameter. For more information, see the API List for Merchants.
The merchant ID obtained in the previous step occupies the first six digits of the invoice request no. (fpqqlsh) when the relevant API is called (For more information, see the API List for Merchants). If an incorrect value is entered, an error will occur.
9. The invoicing platform issues the e-invoice and adds it to the user's Cards & Offers. (This step is completed by the invoicing platform and no development by merchant is required).
10. If invoicing takes a long time and the invoicing platform is unable to return the invoicing result within the specified time limit, a status of "Invoicing" (error code: 73105) is returned. After the invoicing result is got, it is notified to the merchant through the async callback mechanism. For more information, see the API List for Merchants.
11. If an invoicing failure (an error code other than 0, 73105, and 73107) is returned, edit the invoicing information based on the error description and then request invoicing again using a new invoice request no..
12. If no response is returned for a long time, call the "Query Invoices" API to query the invoicing status and obtain the invoice information or invoicing error information based on the returned result. For more information, see the API List for Merchants.

# 5. Post-Payment Invoicing

# 5.1 Scenario Description

Post-payment invoicing provides a new approach to invoicing by leveraging WeChat Pay. Users can find the entry to the Invoicing feature in WeChat Pay Receipts. For some offline scenarios where it is inconvenient for the merchants to printing receipts (such as parking lot gates), this method is recommended. For the scenarios where printed receipts are prone to be lost or damaged, this method can be used as an alternative. After a user makes a payment with WeChat Pay, the entry button to the Invoicing feature appears on the payment receipt. After tapping the button, the user submits the invoice title information and authorizes the invoicing. The issued invoice is synced to the user's Weixin Cards & Offers, without users having to stay on the page to wait for the invoice.

# 5.2 Interaction Process on User Side

The interactions for post-payment invoicing are shown below: Post-Payment Invoicing

# 5.3 API Workflow

The workflow of post-payment invoicing is shown below: Workflow of post-payment invoicing The steps of post-payment invoicing is shown below:

  1. Obtain the invoicing platform s_pappid. An invoice platform has only one s_pappid, so you only need to obtain it once. The method for obtaining s_pappid varies with different business modes:
If you activate the E-Invoice feature using the Official Accounts Platform account, the s_pappid can be found on the details pages of orders with a "Completed" status, as shown below.

Check s_pappid 2. Obtain the access_token by calling the API. For more information, see Obtaining access_token.
3. Link the merchant ID to the invoicing platform. This operation only needs to be performed once. Only when the invoicing platform ID is changed, or you change the invoicing platform, you need to call this API to reset the linkage relationship. For more information, see the API List for Merchants.
4. Query the linkage status to verify that the merchant ID has been linked to the invoicing platform successfully. For more information, see the API List for Merchants.
5. Specify post-payment invoicing for the transaction when the user initiates a payment request for the transaction. Linking the merchant ID to the invoicing platform in Step 3 does not mean the Invoicing entry button appears for each payment. You must call this API to specify that the Invoicing button entry is displayed on the payment receipt. For more information, see the API List for Merchants.
6. Receive the user authorization completion event at backend. The appid used to receive the event is the appid linked with the merchant ID. For more information on how to receive the authorization event, see the API List for Merchants.
7. Check the merchant ID, which will be a part of the invoice request no. (fpqqlsh). The merchant ID can be found on the details pages of orders with a "Completed" status, as shown below. Check merchant ID 8. Initiate the invoicing request. The order_id from Step 4 must be provided as an input parameter. For more information, see the API List for Merchants.
The merchant ID obtained in the previous step occupies the first six digits of the invoice request no. (fpqqlsh) when the relevant API is called (For more information, see the API List for Merchants). If an incorrect value is entered, an error will occur.
9. The invoicing platform issues the e-invoice and adds it to the user's Cards & Offers. (This step is completed by the invoicing platform and no development by merchant is required).
10. If invoicing takes a long time and the invoicing platform is unable to return the invoicing result within the specified time limit, a status of "Invoicing" (error code: 73105) is returned. After the invoicing result is got, it is notified to the merchant through the async callback mechanism. For more information, see the API List for Merchants.
11. If an invoicing failure (an error code other than 0, 73105, and 73107) is returned, edit the invoicing information based on the error description and then request invoicing again using a new invoice request no..
12. If no response is returned for a long time, call the "Query Invoices" API to query the invoicing status and obtain the invoice information or invoicing error information based on the returned result. For more information, see the API List for Merchants.