Aidutu Universal API
- Notes on the Aidutu universal API
QR Code Login
Login via QR code involves 2 steps.
1. Get Login QR Code
shell
curl --request POST \
--url https://www.lingduquan.com/wx/qrlogin \
--header 'Content-Type: application/json' \
--data '{
"app":"aidutu",
"prefix":"yi"
}'curl --request POST \
--url https://www.lingduquan.com/wx/qrlogin \
--header 'Content-Type: application/json' \
--data '{
"app":"aidutu",
"prefix":"yi"
}'Request body:
json
{
"app": "aidutu",
"prefix": "yi"
}{
"app": "aidutu",
"prefix": "yi"
}app: Official Account identifierprefix: service prefix
Response:
url— QR code link for following the Official Account; display as a QR code for WeChat scanningtoken— used in the next step
json
{
"token": "yi:abc1212233",
"url": "http://weixin.qq.com/q/02gemzBCLXdwF1TjUhxEcf"
}{
"token": "yi:abc1212233",
"url": "http://weixin.qq.com/q/02gemzBCLXdwF1TjUhxEcf"
}2. Get Login Result
Response:
json
{
"open_id": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk",
"status": "success",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user_id": "21324"
}{
"open_id": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk",
"status": "success",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user_id": "21324"
}| Field | Type | Description |
|---|---|---|
| open_id | string | WeChat Official Account open_id |
| status | string | success or wait_scan |
| token | string | JWT token — include in the Authorization header for future calls |
| user_id | string | User ID |
The JWT token contains user_id, open_id, and expiry time. Contact staff for the signing secret.
WeChat Pay
- Outside WeChat: user scans a QR code to get a payment link, then pays inside WeChat
- Inside WeChat: link directly to the payment page
- Requires a pre-agreed webhook URL and return URL
1. Get Payment Link
Direct the user to: https://www.lingduquan.com/pay/weixin/yi-{user_id}-{amount}
yi— service prefixuser_id— user UIDamount— payment amount in RMB cents
Example: https://www.lingduquan.com/pay/weixin/yi-9-100 — UID 9, amount 1 RMB
If outside WeChat, convert the link to a QR code for scanning.
2. Webhook
json
{
"do": "finish",
"act": "yi",
"ctime": 1758611970,
"payload": {}
}{
"do": "finish",
"act": "yi",
"ctime": 1758611970,
"payload": {}
}Respond with ok.
2.1 Order Created
json
{
"do": "create",
"act": "yi",
"ctime": 1758611970,
"payload": {
"user_id": "9",
"open_id": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk",
"amount": "10",
"trade_no": "WJ202509231447447592"
}
}{
"do": "create",
"act": "yi",
"ctime": 1758611970,
"payload": {
"user_id": "9",
"open_id": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk",
"amount": "10",
"trade_no": "WJ202509231447447592"
}
}do:create— order createdpayload.trade_no— external order number
2.2 Payment Completed
json
{
"do": "finish",
"act": "yi",
"ctime": 1758611970,
"payload": {
"user_id": "9",
"trade_no": "WJ202509231519185462",
"amount": "10",
"pay_id": "4200002792202509233954521750",
"pay_time": "1758611970",
"payer": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk"
}
}{
"do": "finish",
"act": "yi",
"ctime": 1758611970,
"payload": {
"user_id": "9",
"trade_no": "WJ202509231519185462",
"amount": "10",
"pay_id": "4200002792202509233954521750",
"pay_time": "1758611970",
"payer": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk"
}
}do:finish— payment completedpayload.payer— payer's open_idpayload.pay_id— WeChat payment order number
3. Query Payment Result
Example: https://www.lingduquan.com/pay/weixin/feed/WJ202509231519185462
json
{
"data": {
"status": "success",
"payload": {
"user_id": "9",
"trade_no": "WJ202509231519185462",
"amount": "1",
"ctime": "1758611958",
"act": "yi",
"pay_id": "4200002792202509233954521750",
"pay_time": "1758611970",
"payer": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk"
}
},
"error": 0,
"error_des": ""
}{
"data": {
"status": "success",
"payload": {
"user_id": "9",
"trade_no": "WJ202509231519185462",
"amount": "1",
"ctime": "1758611958",
"act": "yi",
"pay_id": "4200002792202509233954521750",
"pay_time": "1758611970",
"payer": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk"
}
},
"error": 0,
"error_des": ""
}data.status = success means payment was successful.
WeChat In-App Login
- Requires a pre-agreed return URL, e.g.
http://a.cn/login - Final redirect:
http://a.cn/login?code={code}
1. Get Login Code
- This is a user-triggered redirect, not a programmatic request
prefix=yi— requires a pre-agreed return URL- Redirects the user to
http://a.cn/login?code={code}
2. Fetch Login Info via Code
json
{
"open_id": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk",
"status": "success",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user_id": "21324"
}{
"open_id": "ob7tg6a6-L4pn8d0vueJPMfq4ZFk",
"status": "success",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user_id": "21324"
}| Field | Type | Description |
|---|---|---|
| open_id | string | WeChat Official Account open_id |
| status | string | success or wait_scan |
| token | string | JWT token — include in the Authorization header for future calls |
| user_id | string | User ID |
HIGO