# Query and set up authorization pages and merchant information

Debugging Tools

Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide

Interface name: invoicebizsetattr

This interface provides a series of functions for managing authorization pages and merchant information:

Authorized page field management:

  • Set_auth_field: Used to set the information that the user needs to fill in on the type = 1 type authorization page, set to a one-time unless the field needs to be adjusted.
  • Get_auth_field: Used to query the field settings of the authorization page.

Merchant-ticketing platform related management:

  • Set_pay_mch: Used to associate the merchant number with the billing platform's identification number, set to be one-time, unless the identification number changes or the billing platform changes.
  • Get_pay_mch: Used to check the binding of merchants and billing platforms. Merchant contact information management:
  • Set_contact: Used to set the connection method of the merchant before obtaining the authorized link.
  • Get_contact: Used to get the connection method of the merchant.

These interfaces use the get parameter to determine the specific usage, suitable for different scenarios and requirements, the specific parameters and applicable scenarios are as follows

Action describe Remarks
set_auth_field Set up the information that the user needs to fill in on the authorization page.Only for license pages of type = 1 (you do not need to call this interface if you use license pages of type = 0 or type = 2).This is set once, unless you need to adjust the page field. When using type = 1 type authorization page, the fields set to display status are required fields, if you do not fill in will not be able to enter the subsequent process.
get_auth_field Query the field settings of the authorization page. Merchants need to know how the fields are set up on the current authorization page.
set_pay_mch Merchants who use post-payment invoicing need to first associate their merchant number with the invoicing platform's identification number, which is generated by the invoicing app according to the WeChat rule and informed by the invoking platform.This interface is a one-time setup, and subsequently it is usually required to call this interface to reset the correspondence when the billing platform identification number changes, or when the merchant changes the billing system. If the merchant has implemented the WeChat card package delivery solution of electronic invoice, before calling this interface, it is recommended to confirm that the Official Account binding merchant number and the Official Account message template are the same in the Weixin Pay merchant platform.If it is not the same, you still need to re-use the Official Account message template.
get_pay_mch Check whether the merchant is connected to the ticketing platform. Merchants need to know how they are currently bound to the billing platform when using it.
set_contact Set up a merchant's contact information. Merchants need to set up contact details before obtaining an authorization link.
get_contact Get the contact details of the merchant. Merchants need to know their currently set contact details when using them.

# 1. How to call

# HTTPS calls

POST https://api.weixin.qq.com/card/invoice/setbizattr?access_token=ACCESS_TOKEN&action=ACTION

# Cloud Calls

  • This interface does not support cloud calls

# Third party invocation

  • This interface supports Third Party Platform generation business call.

  • The permission set to which this interface belongs is: 26

  • When a service provider is authorized by one of the permissions set, it can call on behalf of the merchant by using authorizer_access_token , which can be viewed in the third-party call documentation.

# 2. Request parameters

# Query parametersQuery String parameters

Parameter NametypeRequired to fill inExampleIntroductions
access_tokenstringyesACCESS_TOKENInterface invocation credentials, using access_token , authorizer_access_token
actionstringyesset_auth_fieldInterface function type, need to fill in the allowed action, when for get_auth_field, get_pay_mch, the request body is empty (JSON format {})

# Request BodyRequest Payload

Parameter NametypeRequired to fill inIntroductions
auth_fieldobjectyesAuthorization page field (used by set_auth_field)
paymch_infoobjectyesWeChat Merchant Number and Billing Platform Relationship Information (set_pay_mch used)
contactobjectyesContact information (set_contact)

# Body.auth_fieldObject Payload

Authorization page field (used by set_auth_field)

Parameter NametypeRequired to fill inIntroductions
user_fieldobjectyesPersonal Invoices Field on the Authorization Page
biz_fieldobjectyesAuthorization page unit invoice field

# Body.paymch_infoObject Payload

WeChat Merchant Number and Billing Platform Relationship Information (set_pay_mch used)

Parameter NametypeRequired to fill inIntroductions
mchidstringyesWeChat Payment Merchant Number
s_pappidstringyesAn invoicing platform id providing invoicing services for the merchant, which is provided by the invoicing platform to the merchant

# Body.contactObject Payload

Contact information (set_contact)

Parameter NametypeRequired to fill inIntroductions
time_outnumberyesTicketing Overtime
phonestringyesContact telephone

# Body.auth_field.user_fieldObject Payload

Personal Invoices Field on the Authorization Page

Parameter NametypeRequired to fill inIntroductions
show_titlenumbernoDo you fill in a head up, 0 is no and 1 is yes?
show_phonenumbernoDo you fill in the phone number, 0 is not, 1 is yes?
show_emailnumbernoWould you like to fill in the mailbox? 0 is not, 1 is yes
require_phonenumbernoIs the phone number required? 0 is not, 1 is yes
require_emailnumbernoIs the mailbox required? 0 digits are not, 1 is Yes
custom_fieldobjarraynoCustom fields

# Body.auth_field.user_field.custom_field(Array)Object Payload

Custom fields

Parameter NametypeRequired to fill inIntroductions
keystringyesField Name
is_requirenumberno0: No, 1: Yes, default 0
noticestringnoTips on copywriting

# Body.auth_field.biz_fieldObject Payload

Authorization page unit invoice field

Parameter NametypeRequired to fill inIntroductions
show_titlenumbernoDo you fill in a head up, 0 is no and 1 is yes?
show_tax_nonumbernoDo you fill in the tax number, 0 is no, 1 is yes?
show_addrnumbernoWould you like to fill in the unit address, 0 is not, 1 is yes
show_phonenumbernoDo you fill in the phone number, 0 is not, 1 is yes?
show_bank_typenumbernoDo you fill in the bank to open your account? 0 is no, 1 is yes
show_bank_no numbernoDo you fill in your bank account number, 0 is no, 1 is yes?
require_tax_nonumbernoIs the tax number required? 0 is not, 1 is
require_addrnumbernoWhether the unit address is required, 0 is not, 1 is Yes
require_phonenumbernoIs the phone number required? 0 is not, 1 is yes
require_bank_typenumbernoIs the bank account required? 0 is not, 1 is Yes
require_bank_nonumbernoIs the bank account required? 0 is not, 1 is
require_tax_nonumbernoIs the tax number required? 0 is not, 1 is
custom_fieldobjarraynoCustom fields

# Body.auth_field.biz_field.custom_field(Array)Object Payload

Custom fields

Parameter NametypeRequired to fill inIntroductions
keystringyesField Name
is_requirenumberno0: No, 1: Yes, default 0
noticestringnoTips on copywriting

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError Description
auth_fieldobjectAuthorization page field (set_auth_field, get_auth_field returns)
paymch_infoobjectWeChat Merchant number and billing platform relationship information (get_pay_mch returns)
contactobjectContact information (get_contact returns)

# Res.auth_fieldObject Payload

Authorization page field (set_auth_field, get_auth_field returns)

Parameter NametypeIntroductions
user_fieldobjectPersonal Invoices Field on the Authorization Page
biz_fieldobjectAuthorization page unit invoice field

# Res.paymch_infoObject Payload

WeChat Merchant number and billing platform relationship information (get_pay_mch returns)

Parameter NametypeIntroductions
mchidstringWeChat Payment Merchant Number
s_pappidstringAn invoicing platform id providing invoicing services for the merchant, which is provided by the invoicing platform to the merchant

# Res.contactObject Payload

Contact information (get_contact returns)

Parameter NametypeIntroductions
time_outnumberTicketing Overtime
phonestringContact telephone

# Res.auth_field.user_fieldObject Payload

Personal Invoices Field on the Authorization Page

Parameter NametypeIntroductions
show_titlenumberDo you fill in a head up, 0 is no and 1 is yes?
show_phonenumberDo you fill in the phone number, 0 is not, 1 is yes?
show_emailnumberWould you like to fill in the mailbox? 0 is not, 1 is yes
require_phonenumberTelephone number is required, 0 is no, 1 is yes (only get_auth_field returns)
require_emailnumberEmail is required, 0 No, 1 Yes (only get_auth_field returns)
custom_fieldobjarrayCustom fields

# Res.auth_field.user_field.custom_field(Array)Object Payload

Custom fields

Parameter NametypeIntroductions
keystringField Name
is_requirenumber0: No, 1: Yes, default 0
noticestringTips on copywriting

# Res.auth_field.biz_fieldObject Payload

Authorization page unit invoice field

Parameter NametypeIntroductions
show_titlenumberDo you fill in a head up, 0 is no and 1 is yes?
show_tax_nonumberDo you fill in the tax number, 0 is no, 1 is yes?
show_addrnumberWould you like to fill in the unit address, 0 is not, 1 is yes
show_phonenumberDo you fill in the phone number, 0 is not, 1 is yes?
show_bank_typenumberDo you fill in the bank to open your account? 0 is no, 1 is yes
show_bank_no numberDo you fill in your bank account number, 0 is no, 1 is yes?
require_tax_nonumberTax number is required, 0 is no, 1 is yes (only get_auth_field returns)
require_addrnumberUnit address is required, 0 is no, 1 is yes (only get_auth_field returns)
require_phonenumberTelephone number is required, 0 is no, 1 is yes (only get_auth_field returns)
require_bank_typenumberIs an open account required, 0 is no, 1 is yes (only get_auth_field returns)
require_bank_nonumberIs the Silver Bank account required, 0 is no, 1 is yes (only get_auth_field returns)
require_tax_nonumberTax number is required, 0 is no, 1 is yes (only get_auth_field returns)
custom_fieldobjarrayCustom fields

# Res.auth_field.biz_field.custom_field(Array)Object Payload

Custom fields

Parameter NametypeIntroductions
keystringField Name
is_requirenumber0: No, 1: Yes, default 0
noticestringTips on copywriting

# 4. Note

There are no special considerations for this interface

# 5. Code examples

# 5.1 Set authorization page field information

Example Requests

https://api.weixin.qq.com/card/invoice/setbizattr?action=set_pay_mch&access_token={access_token}
{
    "auth_field" : {
        "user_field" : {
            "require_phone" : 1,
            "custom_field" : [
                {
                    "is_require" : 1,
                    "key" : "field1"
                }
            ],
            "show_email" : 1,
            "show_title" : 1,
            "show_phone" : 1,
            "require_email" : 1
        },
        "biz_field" : {
            "require_phone" : 0,
            "custom_field" : [
                {
                    "is_require" : 0,
                    "key" : "field2"
                }
            ],
            "require_bank_type" : 0,
            "require_tax_no" : 0,
            "show_addr" : 1,
            "require_addr" : 0,
            "show_title" : 1,
            "show_tax_no" : 1,
            "show_phone" : 1,
            "show_bank_type" : 1,
            "show_bank_no" : 1,
            "require_bank_no" : 0
        }
    }
}

Return an example

{
    "errcode": 0,
    "errmsg": "ok"
}

# 5.2 Query the authorization page field information

Example Requests

https://api.weixin.qq.com/card/invoice/setbizattr?action=get_pay_mch&access_token={access_token}
{}

Return an example

{
    "errcode": 0,
    "errmsg": "ok",
    "auth_field": {
        "user_field": {
            "show_title": 1,
            "show_phone": 1,
            "show_email": 1,
            "custom_field": [{"key": "field1"}]
        },
        "biz_field": {
            "show_title": 1,
            "show_tax_no": 1,
            "show_addr": 1,
            "show_phone": 1,
            "show_bank_type": 1,
            "show_bank_no": 1,
            "custom_field": [{"key": "field2"}]
        }
    }
}

# 5.3 Affiliated merchant numbers and billing platforms

Example Requests

https://api.weixin.qq.com/card/invoice/setbizattr?action=set_pay_mch&access_token={access_token}
{
  "paymch_info": {
    "mchid": "1234",
    "s_pappid": "wxabcd"
  }
}

Return an example

{
  "errcode": 0,
  "errmsg": "ok"
}

# 5.4 Find out how the merchant number is linked to the billing platform

Example Requests

https://api.weixin.qq.com/card/invoice/setbizattr?action=get_pay_mch&access_token={access_token}
{}

Return an example

{
  "errcode": 0,
  "errmsg": "ok",
  "paymch_info":
  {
    "mchid": "1234",
    "s_pappid": "wxabcd"
  }
}

# 5.5 Set up a merchant contact details

Example Requests

https://api.weixin.qq.com/card/invoice/setbizattr?action=set_contact&access_token={access_token}
{
  "contact" :
  {
    "phone" : "88888888",
    "time_out" : 12345
  }
}

Return an example

{
  "errcode": 0,
  "errmsg": "ok"
}

# 5.6 Find out merchant contact details

Example Requests

https://api.weixin.qq.com/card/invoice/setbizattr?action=get_contact&access_token={access_token}
{}

Return an example

{
  "contact" : {
    "phone" : "88888888",
    "time_out" : 12345
  },
  "errcode" : 0,
  "errmsg" : "ok"
}

# 6. Error code

The following is a list of error codes for this interface, other error codes can refer to General error codes

Error codeError DescriptionSolutions
40078invalid 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 Official Account does not open card voucher permissions, or the creation of card_id and the card insertion time is too short.
40097invalid argsType parameter values are not expected
72015unauthorized create invoiceYou do not have permission to operate, check if you have the appropriate permission turned on.
72017invalid invoice titleInvoices are rising inconsistently
72023invoice has been lock by others Invoice has been locked by other Official Account.Generally, the invoice has entered the follow-up reimbursement process, and the Official Account message template / Enterprise Account / App has locked the invoice.
72024invoice status error Invoices are incorrectly registered
72025invoice token errorInvalid wx_invoice_token
72028invoice never set pay mch infoWeChat Payment Merchant Information Not Set
72029invoice never set auth field No authorization field was set
72030invalid mchid Invalid mchid
72031invalid 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
72035biz reject insert Fiscal electronic notes have been denied access. If the order_id is used as a parameter to call the refuse collection interface, then the card machine will report this error using this order_id
72036invoice is busyThe financial electronic note is being changed in status. Please try again later
72038invoice order never authThe order is not authorized, it may be the s_p AppID of the Finance and Politics Bureau, the receiving unit appid, and the order order_id do not match
72039invoice must be lock firstThe order was not locked
72040invoice pdf errorPDF is invalid, please provide a true and valid pdf
72042billing_code and billing_no repeatedRepeated ticket number and ticket code
72043billing_code or billing_no size errorError in ticket number and ticket code
72044scan text out of timeInvoice headers QR code timeout
72063biz contact is emptyThe merchant contact details are not empty. Please call the interface first to set the merchant contact information
73000sys error make out invoice failedA logical error in the billing platform
73001wxopenid errorOpenId error
73002ddh orderid emptyOrder number is empty
73003fpqqlsh emptyThe invoice flow number is empty
73004kplx emptyThe invoice flow number is empty
73007nsrmc emptyThe taxpayer name is empty
73008nsrdz emptyTaxpayer addresses are empty
73009nsrdh emptyTaxpayer phones are empty
73010ghfmc emptyThe purchaser's name is empty
73011kpr emptyThe teller was empty.
73012jshj emptyThe combined tax bill was empty
73013hjje emptyThe total amount is empty
73014hjse emptyTotal taxes are empty
73015hylx emptyIndustry type is empty
73016nsrsbh emptyThe taxpayer identification number is empty
73100ka plat errorError on the ticketing platform
73101nsrsbh not cmpTaxpayer identification number does not match, and the taxpayer identifier in the request is not consistent with the taxpayers identification filled out in the creation form
73102sys errorWeChat Billing platform system error
73105Kp plat make invoice timeout, please try again with the same fpqqlshIn billing platform, use the same invoice request flow number to retry billing
73106Fpqqlsh exist with different ddhThe invoice request flow number already exists and is occupied by other order numbers
73107Fpqqlsh is processing, please wait and query laterThe invoice request flow is being processed. Please obtain the results via the query interface
73108This ddh with other fpqqlsh already existThe order has been processed by flow of other invoice requests
73110fpqqlsh first 6 byte not cmpThe first six digits of the invoices requested are incorrect

# 7. Scope of application

How this interface can be invoked under different account types:
Official Account Service Account
  • ✔: The account can call this interface
  • Other account types that are not expressly stated may not be called on this interface without special instructions;