当前位置:网站首页>Charging interface docking tutorial of enterprise and micro service provider platform

Charging interface docking tutorial of enterprise and micro service provider platform

2022-07-06 08:37:00 renkai721

Preface

1、 The previous process was for users to add third-party applications , Then login , Then operate .

2、 The current process is for users to add third-party applications , Then the service provider buys an account , The service provider receives... When the user adds a third-party application or when the user logs in 【unlicensed_notify】 Interface license expiration notification , Authorize to activate the user , Then the user logs in , Then operate .

Official documents of enterprises and micro enterprises

Description of platform charging mode adjustment for service providers

Platform interface license fee

Enterprise and micro service provider background management operation tutorial

1、 Users in the enterprise and micro application market developed by search service providers 3 Square application , If the application name 【 Weather assistant 】. Then click Install .

2、 At this time, the background service of the service provider will receive several messages pushed by Tencent server , as follows

//  this 2 A message needs to be parsed by itself , Processing logic 
//  We have no 3 When the service provider receives this notice, it can tell the administrator , Log in to the background to buy an account for this customer company 
"InfoType"="create_auth" 
    
//  Received the news , You can activate the user , You must purchase an account number first , Generally, you can buy a basic service account 
"Event"="subscribe"

//  Received the news , It indicates that the user's current account is not activated , The user account is not authorized 
"Event"="unlicensed_notify"

3、 If the server receives 【create_auth】 news , It can be done by email , Enterprise wechat news , Enterprise micro webhook Robot messages are notified to relevant personnel , Let them log in to the background of the service provider and start buying accounts .

4、 The background login address of the service provider is as follows , Be sure to log in with administrator privileges .

//  You must log in with administrator privileges 
https://open.work.weixin.qq.com/wwopen/login

5、 First add the company to test , Otherwise, you won't see the intercepted message , Adding a testing company also requires scanning the code of the company's administrator account , Otherwise, the addition is unsuccessful .

 6、 Purchase interface

 7、 Buy an account number for the customer of the service provider , Testing companies don't need money , Direct payment is 0, Click submit order .

8、 Be sure to record the order , Later, if you call through the interface, you need to use the order number .

9、 Check the order just purchased , Click to view the test enterprise account .

 10、 You can see the account you just bought , Click the account to activate the user . Only one company account can be operated at a time .

11、 Specific operation page , Activate employees under the company .

12、 After all the above operations , Users can log in and access our service provider applications normally , The interface of user information called in the program will not report an error .  The login operation is exactly the same as that of previous service providers .

13、 If you don't buy an account , Do not activate the user's account , Then the following interfaces cannot be called .

14、 If the user is not activated , It will jump directly to the inactive page , Let's show you .

 15、 If the user is not activated , Tencent server will push messages to us . The message is as follows

 16、 in other words , When we receive this message , It can be called by program API Interface to activate the user .

17、 After the user account is activated , Will not directly jump to our home page . We need to push a message to users , Tell him , His account has been activated , You can log in and use . Then he quit the app , Log in again and you can log in to the home page .

java Background code tutorial

1、 Get the account list in the order

 Get the account list in the order 
 Query the list of platform capability service accounts under the specified order . If you pay for the order of the purchase account or the version migration order of the stock enterprise , Then return to the account activation code list ; If it is an order of renewal account , Then return the member list of the renewal account . Be careful , If the order of purchase account , Then only when the order payment is completed , The system will generate an account , So before the payment is completed , This interface will not return the account activation code .

 Request mode : POST(HTTPS)
 Request address : https://qyapi.weixin.qq.com/cgi-bin/license/list_order_account?provider_access_token=ACCESS_TOKEN

 Request packet :

{
	"order_id" : "XXXXXXXX",
	"limit":1000,
	"cursor":"xxxx"
}

 Parameter description :

 Parameters 	 Whether must 	 explain 
provider_access_token	 yes 	 Application service provider's interface call credentials , See the certificate of the service provider for the acquisition method 
order_id	 yes 	 The order number 
limit	 no 	 Maximum number of records returned , integer , Maximum 1000, The default value is 500
cursor	 no 	 Cursor for paging query , String type , Returned by the last call , For the first call, do not fill 

----------------------------- Interface interpretation 
1、 After the user installs the application , The service background will receive the subscription message , We need to log in to the background of enterprise and micro service provider with an administrator account , Buy an account for this enterprise , Then save the order number to the database , Our program reads the order number .
2、 Calling 【 Order purchase account 】,【 Get order list 】,【 Get order details 】 Get the order number through these three interfaces , Buy directly on the page , Here, you can directly read the order number of the database , Manually add the latest order number to the database .
3、cursor When this field is called for the first time, it is empty , Tencent server will return next_cursor, You have to use order_id As key, Put this next_cursor recorded , Otherwise, the next call will find out the activation code that has been used .
4、 It is better not to call this interface , After purchasing an account directly on the page , Save all accounts directly to the database , Read the activation code directly from the database .
5、 Tencent will buy an account , Generate all activation codes at one time .

2、 Activate your account

 Activate your account 
 After placing an order to purchase an account and paying , First call the account list interface in the order to get the account activation code , Then you can call this interface to bind the activation code to an enterprise employee , To activate the corresponding platform service capabilities .

 One userid It is allowed to activate a basic account and an interworking account .
 Request mode : POST(HTTPS)
 Request address : https://qyapi.weixin.qq.com/cgi-bin/license/active_account?provider_access_token=ACCESS_TOKEN

 Request packet :

{
	"active_code" : "XXXXXXXX",
	"corpid": "CORPID",
	"userid": "USERID"
}
 Parameter description :

 Parameters 	 Whether must 	 explain 
provider_access_token	 yes 	 Application service provider's interface call credentials , See the certificate of the service provider for the acquisition method 
active_code	 yes 	 Account activation code 
corpid	 yes 	 The enterprise of the member to be bound and activated corpid, Only encrypted corpid
userid	 yes 	 Enterprise members to be bound and activated userid . Only encrypted userid

----------------------------- Interface interpretation 
1、 there corpid It's the customer's corpid, It's encrypted . It's not that 【wwe The one at the beginning 】. Found by testing , As long as the employees of the service provider's own company log in , To get the corpid Are encrypted , Only employees of their own company log in , That's the message I received wwe At the beginning , At this time, you need to change yourself , You can call the following interface for conversion .
2、corpid Adapter =https://qyapi.weixin.qq.com/cgi-bin/service/corpid_to_opencorpid?provider_access_token=ACCESS_TOKEN
3、corpid Translation interface document address =https://developer.work.weixin.qq.com/document/path/95327
4、 There is a simple way , Is to buy an account for your company in the background of the service provider , Then click on the account number to see your company's encrypted corpid 了 , It is recommended to record directly after manual conversion , Write directly to the configuration file or database later , No need to call interface conversion .
5、userId Only our own companies need encryption , Others' accounts have been encrypted , You can use it directly .
6、userid Adapter =https://qyapi.weixin.qq.com/cgi-bin/batch/userid_to_openuserid?access_token=ACCESS_TOKEN
7、userid Translation interface document address =https://developer.work.weixin.qq.com/document/path/95327
8、 Pay attention to ,userid Transformation is to pass access_token,corpid Transformation requires provider_access_token, These two are different .

3、 Be careful , After user activation , Need to login again , It will not directly jump to our homepage from the inactive page .

NOTE:

1、 If you still have questions , Please leave a message , I will reply as soon as I see the message .

原网站

版权声明
本文为[renkai721]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060831002510.html