# Get a link to the authorisation page

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: invoicebizgetauthurl

This interface is for merchant calls. Through this interface, merchants enter parameters such as order number, billing platform identification and other parameters to obtain a link to the authorization page.The authorization page is presented to the user in WeChat. When the user clicks the "Claim Invoice" / "Request Invoice" button on the authorization page,It is completed that the order number is bound with the user's authorization relationship, and the subsequent billing platform can initiate the request to insert the invoice voucher into the user''s card package based on this order number, and WeChat will also verify whether the card insert request is approved according to this authorization relation.

Authorization pages include three styles that merchants can call by passing in values of different types. The style authorization pages are shown in the following figure:

Different authorization pages work as follows:

Type = 0 (apply for invoice type): used for merchants have obtained the user's head from other channels, pull up the authorization page to initiate invoice, and save it to the user's card package after successful invoice;

Type = 1: When this type is called, the page displays the user's common header stored by WeChat.It is used by merchants who do not collect user heads and want to reduce the number of fill-in steps for users.It should be noted that only type = 1 can be called when invoicing after payment is used.

Type = 2 (receipt of invoice type): For merchants invoice has been issued successfully, pull up the authorization page and let the user save the invoice to the card package.

# 1. How to call

# HTTPS calls

POST https://api.weixin.qq.com/card/invoice/getauthurl?access_token=ACCESS_TOKEN

# 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

# Request BodyRequest Payload

Parameter NametypeRequired to fill inExampleIntroductions
s_pappidstringyeswxabcdInvoice platform in WeChat identification number, merchants need to find invoice platform to provide
order_idstringyes1234Order id, the unique identification number of a single invoice request within the merchant,
moneynumberyes11Order Amount, divided into units
timestampnumberyes1474875876timestamp
sourcestringyeswebInvoicing source, app: app invoicing, web: WeChat h5 invoicing, wxa: Weixin Mini Program invoicing, wap: ordinary web invoicing
redirect_urlstringnohttps://mp.weixin.qq.comJump to the page when the authorization is successful.This field needs to be filled in only if the source is H5, and leads the user to the next step in WeChat.App invoicing Because the WeChat authorization page is pulled from the external app, the authorization is automatically returned to the original app after the authorization is completed, so there is no need to fill in.
ticketstringyesttttAuthorization page ticket
typenumberyes1Type of authorization, 0: Authorization to open a ticket, 1: Authorization to fill in a field to open tickets, 2: Authorization to receive tickets

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError message
auth_urlstringAuthorized Links
appidstringOnly when the source is wxa

# 4. Note

The authorization page contains three styles, controlled by the type parameter

# 5. Code examples

Example Requests

{
  "s_pappid": "wxabcd",
  "order_id": "1234",
  "money": 11,
  "timestamp": 1474875876,
  "source": "web",
  "redirect_url": "https://mp.weixin.qq.com",
  "ticket": "tttt",
  "type": 1
}

Return an example

{
  "errcode": 0,
  "errmsg": "ok",
  "auth_url": "http://auth_url"
}

# 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
40001invalid credential  access_token isinvalid or not latestaccess_token Invalid or not recently acquired access_token, please confirm the validity of the access_token

# 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;