catalog
1. Submit electronic invoice claims at WeChat Service Account / Weixin Mini Program 2. Submit electronic invoice for reimbursement at WeChat / 3. Submit e-invoice reimbursement in external app 4. Scan QR codes to submit electronic invoices for reimbursement
# guide
This section of the document describes different business scenarios in which enterprises support users to submit electronic invoices to achieve paperless reimbursement. It includes a description of the scene, a basic introduction to the interactive experience, and a step-by-step development guide. The enterprise can select the corresponding business scenario according to the actual application and develop it in a step-by-step manner according to documentation. Each interface that needs to be called in the document is added to the interface documentation link, which allows enterprises and reimbursement software developers to jump to the corresponding interface documentation. Completed certification of the WeChat public platform account, WeChat open platform account, enterprise WeChat and the number, can directly call WeChat electronic invoice reimbursement interface.
For information about the interfaces involved in the steps below, you can view the list of interfaces at the end of the article.
# 1. Submit electronic invoice claims at WeChat Service Account / Weixin Mini Program
# 1.1 Scenarios Description
WeChat Submission of an electronic invoice for reimbursement usually refers to claims with Service Account orWeixin Mini Program The enterprise or expense app provider requires the enterprise employee or user to pull up the list of invoice saved in WeChat in WeChat, tick the invoice that needs to be reimbursed, and submit it to the enterprise or app. The enterprise receives the employee's submitted invoice and completes the subsequent reimbursement process.
The scenario applies to:
1 Reimbursement companies or reimbursement service providers that have a complete reimbursement system in WeChat Service Account / Weixin Mini Program, or
2 The existing reimbursement system has a separate user account system.Employees can submit invoices to the reimbursement enterprise or reimbursement service provider in WeChat after they bind their account in WeChat Service Account / Weixin Mini Program
In WeChat Service Account / Weixin Mini ProgramNo need to install additional apps, making it easy for enterprises and reimbursement application providers to quickly submit electronic invoices on mobile devices with the lowest threshold.
# 1.2 Introduction to interaction
WeChat The interactive diagram of submitting electronic invoices for reimbursement is as follows
# 1.3 Interface invocation process
WeChat The timeline for submitting electronic invoices for reimbursement is as follows
# Service Account The steps to issue an electronic invoice in the scenario are as follows:
1 Get the public platform account access_token, call method see Get access_token ;
2 Pull up the invoice list page, details can be viewed: 6.1 WeChat Service Account pull up the invoice list or 6.2 Weixin Mini Program pull up the invoice list
When the user checks the invoice in the invoice list page, the card_id and encrypt_code of the selected invoice will be returned in the form of js callback;
4 Query invoice information according to card_id and encrypt_code, the name of the interface called is: Query reimbursement invoice information
According to the enterprise's own reimbursement process, the invoice information will be converted into reimbursement forms, this step does not need to call WeChat interface;
6 Submit a reimbursement bill to update the status of the invoice to "locked" to avoid repeat reimbursement. The interface called is: update the status for reimbursement invoice;If multiple invoices are reimbursed, you can call theBatch Update Invoice Reimbursement Status
interface to update;
7 Upon completion of the reimbursement process, update the status of the invoice to "reimbursed." The interface called is called to update the status of the reimbursement invoice;If more than one invoice is reimbursed, you can call theBatch Update Reimbursement Invoice Status
interface to update
# 2. Submit electronic invoice for reimbursement at WeChat /
# 2.1 Scenarios Description
Submitting electronic invoice in the enterprise WeChat refers to the enterprise that has applied the enterprise WeChat / ID and completed the certification. You can pull up the list of invoices saved in the WeChat card package from the enterprise WeChat / enterprise number, tick the invoices that need to be reimbursed, and submit the invoices to the enterprise or the reimbursement application. After the enterprise receives the invoices submitted by the employee, it completes the subsequent reimbursement process. Applying the interface of enterprise WeChat to realize electronic invoice reimbursement can combine the approval interface capabilities of enterprise WeChat to realize an integrated reimbursement bill approval function in enterprise WeChat.
# 2.2 Introduction to interaction
The interactive diagram of submitting electronic invoices in the enterprise WeChat is as follows
# 2.3 Interface invocation process
Enterprise WeChat / No. Submit electronic invoice reimbursement time sequence is as follows
# The steps to submit an electronic invoice at WeChat are as follows:
1 Get the access_token of the enterprise's .
2 Open the invoice list page.Enterprise WeChat 2.1 has added a JS-API interface for selecting electronic invoices, and enterprises using Enterprise WeChat can quickly implement the function of selecting electronic invoice in Enterprise WeChat when they update Enterprise WeChat to a version above 2.1.Call method see enterprise WeChat pull up invoice list ;Or see: 6.3 Corporate WeChat pulls up invoice list
When the user checks the invoice in the invoice list page, the card_id and encrypt_code of the selected invoice will be returned in the form of js callback;
4 query invoice information according to card_id and encrypt_code, the name of the interface called is: query reimbursement invoice information
According to the enterprise's own reimbursement process, the invoice information will be converted into reimbursement forms, this step does not need to call WeChat interface;
6 Submit a reimbursement bill to update the status of the invoice to "locked" to avoid repeat reimbursement. The interface called is: update the status for reimbursement invoice;If multiple invoices are reimbursed, you can call theBatch Update Invoice Reimbursement Status
interface to update;
7 Upon completion of the reimbursement process, update the status of the invoice to "reimbursed." The interface called is called to update the status of the reimbursement invoice;If more than one invoice is reimbursed, you can call theBatch Update Reimbursement Invoice Status
interface to update
# 3. Submit e-invoice reimbursement in external app
# 3.1 Scenarios Description
Submitting an electronic invoice in the App means that the reimbursement enterprise or reimbursement service provider pulls up the electronic invoice stored in theWeChat List of invoices in the card packet. Check the invoices that need to be reimbursed and submit them to the enterprise or the reimbursement application. The enterprise receives the invoices submitted by the employee and completes the subsequent reimbursement process.Initiating electronic invoice reimbursement from the App can further enrich the application scenarios of enterprise mobile office App.
# 3.2 Introduction to interaction
External App submits electronic invoice reimbursement interactive diagram as follows
# 3.3 Interface invocation process
The schedule of submitting electronic invoice for reimbursement in external app is as follows
# The steps to submit e-invoice reimbursement in the external app are as follows:
1 Get the access_token of the open platform account, call method see Get the Access token ;
2 Pull up the invoice list page, details can be viewed: 6.4 External App pull up the invoice list
When the user checks the invoice in the invoice list page, the card_id and encrypt_code of the selected invoice will be returned in the form of js callback;
Query invoice information according to card_id and encrypt_code, and call interface name is: query reimbursement invoice information;
According to the enterprise's own reimbursement process, the invoice information will be converted into reimbursement forms, this step does not need to call WeChat interface;
6 Submit a reimbursement bill to update the status of the invoice to "locked" to avoid repeat reimbursement. The interface called is: update the status for reimbursement invoice;If multiple invoices are reimbursed, you can call theBatch Update Invoice Reimbursement Status
interface to update;
7 Upon completion of the reimbursement process, update the status of the invoice to "reimbursed." The interface called is called to update the status of the reimbursement invoice;If more than one invoice is reimbursed, you can call theBatch Update Reimbursement Invoice Status
interface to update
# 4. Scan QR codes to submit electronic invoices for reimbursement
# 4.1 Scenarios Description
Scanning code to submit electronic invoices refers to scanning the two-dimensional code on the PC to allow employees or users to submit invoices in theOn the H5 page in WeChat, pull up the list of invoices saved in the WeChat card package, tick the invoices that need to be reimbursed, and submit the invoices to the enterprise or the reimbursement application. The enterprise receives the invoices submitted by the employee and completes the subsequent reimbursement process.
This scenario applies to the reimbursement enterprise or reimbursement service provider whose employee reimbursement behavior is mainly invoiced from the PC side.Require reimbursement companies or reimbursement service providers to obtain the ability to pull up WeChat electronic invoices on mobile devices (within WeChat, enterprise WeChat or independent reimbursement APP)
The scenario fully takes into account that the employee's expense behavior is mostly initiated on the PC, can be seamlessly connected to the existing expense system, does not need to drastically change the employee' expense habits, and can be quickly promoted in the enterprise.
# 4.2 Introduction to interaction
The interactive diagram of scanned ticket opening is as follows
# 4.3 Interface invocation process
The time series diagram for the scanning of electronic invoice reimbursement is as follows
# The steps for issuing an electronic invoice in the scanned billing scenario are as follows:
1 Maintain the QR code, displayed on the PC side of the reimbursement system for users to use. After scanning the code, WeChat, enterprise WeChat or independent reimbursement APP, open the corresponding reimbursement page, and submit WeChat electronic invoices to the reimbursment system.After the reimbursement system obtains the invoice information, the employee continues to complete the follow-up reimbursement process on the PC side;
2 Get the access_token of the public platform account / enterprise WeChat account, call method see Get the Access token ;
3 Open the invoice list page
When the user checks the invoice in the invoice list page, the card_id and encrypt_code of the selected invoice will be returned in the form of js callback;
Query invoice information according to card_id and encrypt_code, and call interface name is: query reimbursement invoice information;
6 According to the enterprise's own reimbursement process, the invoice information will be converted into reimbursement, this step does not need to call WeChat interface;
7 Submit the reimbursement bill to update the status of the invoice to "locked" to avoid repeat reimbursement. The interface called is: update the status for reimbursement invoice;If multiple invoices are reimbursed, you can call theBatch Update Invoice Reimbursement Status
interface to update;
8 After completing the reimbursement process, update the invoice status to "reimbursed." The interface called is called to update the status of the reimbursement invoice;If more than one invoice is reimbursed, you can call theBatch Update Reimbursement Invoice Status
interface to update
# 5. List of interfaces involved
Interface Name | English name | Request Path |
---|---|---|
Check for reimbursement invoices information | invoicebxgetinvoice | /card/invoice/reimburse/getinvoiceinfo |
Update the status of reimbursement invoices | invoicebxupdatainvoicestatus | /card/invoice/reimburse/updateinvoicestatus |
Volume update of expense invoice status | invoicereimburseupdatestatusbatch | /card/invoice/reimburse/updatestatusbatch |
Bulk acquisition of reimbursement invoices information | invoicereimbursegetinvoicebatch | /card/invoice/reimburse/getinvoicebatch |
# 6. How to pull up the list of invoices
# 6.1 WeChat Service Account Pull up invoice list
Interface Dxplaination
This interface function is in WeChat Service Account pull up the invoice card voucher list, the user ticks the invoice that needs to be submitted for reimbursement, the developer gets the identification information of the selected invoice.
Calls to this interface must follow the JS-SDK call method. Please read the JS-DK interface documentation [WeChat](http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN" target="_blank) before you develop to familiarize yourself with development terminology and basic interface calls.
How to request
Call the chooseInvoice interface
Request parameters
parameter | type | Is it compulsory? | describe |
---|---|---|---|
timestamp | string(32) | yes | Time stamp, using the unix ten - digit time stamp |
nonceStr | string(32) | yes | Random character string |
Return results
When a user clicks confirm or cancel, the results are returned by pressing the format and meaning of the fields listed in the table below.
parameter | type | Is it compulsory? | describe |
---|---|---|---|
err_msg | string | yes | Ok: Select invoice successfully, fail: Select invoice failed, cancel: Select invoice to cancel |
choose_invoice_info | object | no | List of invoices selected by users |
The object for choose_invoice_info includes the following fields
parameter | type | Is it compulsory? | describe |
---|---|---|---|
card_id | string | yes | Card_id of the selected invoice voucher |
encrypt_code | string | yes | The encryption code of the selected invoice card voucher, the reimbursement party can get the information of the reimbursement invoice through card_id and encrypt_code |
app_id | string | yes | AppID |
sample code
wx.config({
beta: true,
debug: false,
appId: "wx00000000000000",
timestamp: 1489030247,
nonceStr: "(9J4YRV[#@",
signature: "f027317f8910000000000000000000",
jsApiList: ['chooseInvoice']
});
wx.ready(function () {
wx.invoke('chooseInvoice', {
'timestamp': 1489030247,
'nonceStr': "p(6N&7WOAF",
}, function(res) {
alert(JSON.stringify(res));
}
});
});
# 6.2 Weixin Mini Program Pull up invoice list
Interface Dxplaination
Support to pull up the list of electronic invoices directly in Weixin Mini Program
For detailed interface documentation, see Weixin Mini Program API invoice section
# 6.3 Enterprise WeChat Pull up invoice list
Interface Dxplaination
Enterprise WeChat 2.1 has added a js-API interface for selecting electronic invoices, and enterprises using Enterprise WeChat can quickly implement the function of selecting electronic invoice in Enterprise WeChat when they update Enterprise WeChat to a version above 2.1.
For detailed interface documentation, please refer to Enterprise WeChat API Electronic Invoicing .
# 6.4 External app pulls up invoice list
Interface Dxplaination
For enterprises that build their own mobile office applications and reimbursement service providers that provide independent reimbursement applications for enterprises, WeChat provides an interface for external applications to pull up invoice lists.Similar to WeChat's internal pull up invoice list interface, external app developers can get the identification data of invoices after the user ticks and clicks on confirmation.
The interface must follow JS-SDK invocation methods, so be sure to check that you meet the following criteria before developing:
Get a certified WeChat open platform account;
2 Create an application on the WeChat open platform and submit it for review.Developers who have not registered their apps can register on the Developer App Registration page;
How to request
IOS app
Refer to the OpenSDK1. 7. 7 file in the compression package, and call the WXChooseInvoice class when used. For the part that needs to be signed, refer to the way JS-SDK is called. sample code
—(void)getlnvoiceWithTicket: (NSString*)ticket whenComptetion: (void(^)(NSString* result, NSString*errorDesc) )comptetion{
BOOL isWXApplnstalled = [WXApi isWXApplnstalled];
if (!isWXApplnstalled) { // 用户没装微信,直接返回。
completion(nil.,@”Wechat Not installed”);
return;
}
_completion = completion;
WXChooselnvoiceReq *cardReq = [WXChooselnvoiceReq alloc]initl;
cardReq. applD = WechatlnvoiceAppld;
cardReq.timeStamp = [NSDate date]timelntervalSince1970];
NSString* timeStamp = [NSString stringWithFormat:@”%d”,cardReq.timeStamp];
cardReq. nonceStr = @“sfim_invoice”;
NSString *cardSign = [self genCardSignWithNonceStr: cardReq.nonceStr andTimeStr:
timeStamp andApiTicket:ticket];
cardReq.cardSign = cardSign;
[WXApi sendReq:cardReq];//发送
Android apps
Download and refer to the compact package , enter the jar file, call the ChooseCardFromWXCardPackage class when used, and pass in the CardType as "INVOICE."For the part that needs to be signed, refer to the way JS-SDK is called.
Return results
When a user clicks confirm or cancel, the results are returned by pressing the format and meaning of the fields listed in the table below.
parameter | type | Is it compulsory? | describe |
---|---|---|---|
err_msg | string | yes | Ok: Select invoice successfully, fail: Select invoice failed, cancel: Select invoice to cancel |
choose_invoice_info | object | no | List of invoices selected by users |
The object for choose_invoice_info includes the following fields
parameter | type | Is it compulsory? | describe |
---|---|---|---|
card_id | string | yes | Card_id of the selected invoice voucher |
encrypt_code | string | yes | The encryption code of the selected invoice card voucher, the reimbursement party can get the information of the reimbursement invoice through card_id and encrypt_code |
app_id | string | yes | AppID |
# 7 List of invoice reimbursement status
state | describe |
---|---|
INVOICE_REIMBURSE_INIT | Initial status of invoice, not locked |
INVOICE_REIMBURSE_LOCK | The invoice has been locked up |
INVOICE_REIMBURSE_CLOSURE | The invoice has been cancelled |
INVOICE_REIMBURSE_CANCEL | The invoice was turned red |
# 8 Error Code
Error code | Error message | Remarks |
---|---|---|
0 | OK | success |
72015 | unauthorized create invoice | You do not have permission to operate an invoice, check if the corresponding permission is turned on. |
72017 | invalid invoice title | Invoices are rising inconsistently |
72023 | invoice has been lock | Invoice has been locked by other Service Account.Generally, the invoice has entered the follow-up reimbursement process, and the reimbursement service number / number / App locks the invoice. |
72024 | invoice status error | Invoices are incorrectly registered |
72025 | invoice token error | Invalid wx_invoice_token |
72028 | invoice never set pay mch info | WeChat Payment Merchant Information Not Set |
72029 | invoice never set auth field | No authorization field was set |
72030 | invalid mchid | Invalid mchid |
72031 | invalid params | The parameter is wrong. It may include invalid parameter names in the request or include parameter values that are not validated in the background |
72035 | biz reject insert | The invoice has been refused. If the order_id is used as a parameter to call the reject invoicing interface, then the card machine will report this error using this order_id |
72036 | invoice is busy | The invoice is being changed in status. Please try again later |
72038 | invoice order never auth | The order is not authorized, may be invoicing platform AppID, merchant appid, order_id does not match |
72039 | invoice must be lock first | The order was not locked |
72040 | invoice pdf error | PDF is invalid, please provide a true and valid pdf |
72042 | billing_code and billing_no repeated | Repeated invoice number and invoice code |
72043 | billing_code or billing_no size error | Error in invoice number and invoice code |
72044 | scan text out of time | Invoice headers QR code timeout |
40078 | invalid card status | Card_id is not authorized.If the developer uses a sandbox environment to report this error, it is mainly because WeChat of the calling interface has not been added to the test list;If the developer uses a formal environment to report this error, the main reason may be that the calling interface Service Account does not open card voucher permissions, or the creation of card_id and the card insertion time is too short. |