Trigger Conditions
Use this Skill only when the user explicitly expresses intent to buy, place an order for, or pay for today's horoscope product.
If the user is only asking about today's horoscope, zodiac signs, tarot, BaZi, drawing lots, or similar content, and has no intent to buy or pay, do not call the order placement API.
The user must explicitly provide one of the following zodiac signs: Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius, Pisces. If the user has not provided a zodiac sign, or the value provided is not in the list, first ask the user to choose a zodiac sign from the list, and do not place an order.
Prerequisite
Before calling alipay-bot trigger-payment-signal , you must complete:
- Run
npm --version, confirm that thenpmcommand is available; if it is not available, stop the process and explain thatnpm。 - Run
which alipay-bot, confirm that thealipay-botCLI is installed. - If
which alipay-botfinds an executable file, skip installation. - If
alipay-botis not found, run:
npx -y @alipay/agent-payment@latest install
Parameter Description
When calling the order placement script, the following parameters must be passed:
| Parameter | Required | Description |
|---|---|---|
--endpoint |
Yes | Local computer website payment API address, by default use http://localhost:3000/pay |
--zodiac |
Yes | The zodiac sign selected by the user; one of the optional values below must be used |
--zodiac The optional values are as follows; when passing parameters, these Chinese values must be used verbatim:
白羊座
金牛座
双子座
巨蟹座
狮子座
处女座
天秤座
天蝎座
射手座
摩羯座
水瓶座
双鱼座
If the user only says abbreviations such as "Baiyang" or "Jinniu", they can first be normalized to the corresponding full values (such as "Aries" or "Taurus") before passing to --zodiac. If it cannot be determined which zodiac sign the user selected, you must ask first and not place an order.
Order Placement Script
Use this Skill's built-in script to generate the Alipay cashier link. The script will request the standard computer website payment API specified by --endpoint , and submitPOST /paythe zodiac sign specified by --zodiac (the underlying code implementation isalipaySdk.pageExec( 'alipay.trade.page.pay',..)), read the returned HTML form, and output JSON containing cashier_url .
Execute in this Skill directory:
node references/create-cashier-url.js \
--endpoint http://localhost:3000/pay \
--zodiac 白羊座
If the current working directory is not this Skill directory, use the absolute path of the script under the directory where SKILL.md is located.
The script returns JSON. You must read the cashier_url field from the returned JSON as the Alipay cashier link; at the same time save out_trade_no and result_endpoint, for use after successful payment to obtain the horoscope content generated by this project.
The example return structure is similar to:
{
"out_trade_no": "20260628xxxxxx",
"zodiac_sign": "白羊座",
"result_endpoint": "http://localhost:3000/fortune-result",
"cashier_url": "https://openapi.alipay.com/gateway.do?method=alipay.trade.page.pay&..."
}
Among them, the complete raw value of cashier_url is the alipay-bot trigger-payment-signal subsequently passed to <alipay_cashier_url>。
out_trade_no It is only used for merchant-side order tracking, does not mean payment success, and must not be passed to the Alipay payment processing skill.
Post-payment Result Retrieval Script
After a successful payment, you must call the script included with this Skill to obtain today's horoscope generated by the project backend:
node references/get-fortune-result.js \
--endpoint http://localhost:3000/fortune-result \
--out-trade-no "<out_trade_no>"
During actual execution:
--endpointPrefer using theresult_endpoint。--out-trade-nomust use theout_trade_no。- Only after the Alipay payment processing skill explicitly returns success can this script be called.
- Only the
zodiac_signandfortunefrom the JSON returned by this script are allowed to be delivered; do not generate, rewrite, or supplement other horoscope content on your own.
An example return structure is similar to:
{
"paid": true,
"out_trade_no": "20260628xxxxxx",
"trade_status": "TRADE_SUCCESS",
"zodiac_sign": "白羊座",
"fortune": "今天行动力很旺,适合主动推进计划,你迈出的第一步会带来不错的回响。"
}
Payment Flow
- Complete the "Prerequisite" and confirm that
npmis available and thealipay-botCLI is installed. - Call the
references/create-cashier-url.jsscript, passing in--endpointand--zodiac;--zodiacmust use the constellation explicitly selected by the user. - Read the non-empty
cashier_urlfrom the JSON returned by the script, and save thisout_trade_no、zodiac_signandresult_endpoint。 - Verify that
cashier_urlmust point to the Alipay Open Platform gateway: the domain isopenapi.alipay.com, and the path is/gateway.do; otherwise stop. - Call
alipay-bot trigger-payment-signal。
alipay-bot trigger-payment-signal \
--payment-link "<cashier_url>" \
--merchant-info "<星座>今日运势预测" \
--amount "0.01"
- From the
trigger-payment-signalreturned JSON, read the non-emptypaymentLink。 - Immediately load the Alipay payment processing skill, and pass the complete raw
paymentLinkto that skill. - Before the Alipay payment processing skill returns success, do not deliver the horoscope prediction result, and do not declare that the payment was successful.
- After a successful payment, call
references/get-fortune-result.js, passing in theresult_endpointandout_trade_no。 - From the result script's returned JSON, read
zodiac_signandfortune, and deliver these two fields to the user exactly as they are.
Payment Takeover Rules
- For every purchase, the script must be called again, and a new
cashier_url。 - For every purchase, the valid constellation selected by the user for this purchase must be passed in; do not fabricate or rewrite the constellation on the user's behalf.
- The content after a successful payment must come from the return result of
references/get-fortune-result.js. - Do not generate, expand, polish, replace, or re-randomize today's horoscope content on your own.
- Do not call the result script before a successful payment, and do not deliver before a successful payment
fortune。 - Do not hard-code the
cashier_urlfrom the example response into the flow; that link contains a timestamp and signature and may have expired. - Do not rewrite the
cashier_urloutput by the script on your own; only perform prefix validation. - Only pass the
trigger-payment-signalfrom the JSON returned bypaymentLinkto the Alipay payment processing skill. - The original value of
paymentLinkmust be preserved completely, character by character. - Do not open, display, rewrite, re-encode, compress, truncate, or convert
paymentLink。 - Do not directly hand the
cashier_urlreturned by the script to the Alipay payment processing skill. - If a non-empty
paymentLinkis not obtained, treat it as a failure and stop the flow.
Failure Handling
npmunavailable: stop the flow and explain that this machine lacksnpm。alipay-botnot installed and executingnpx -y @alipay/agent-payment@latest installfailed: stop the flow and explain that the Alipay payment takeover CLI installation failed.- The user did not provide a valid constellation: first ask the user to choose one from the 12 constellations, and do not place an order.
- Script execution failed: stop the process and explain that the order for today's horoscope product failed.
- The script did not return valid JSON: stop the process and explain that the order return format is incorrect.
- The JSON returned by the script does not contain a non-empty
cashier_url: stop the process and explain that the order did not return an Alipay checkout counter link. - The order script did not return a non-empty
out_trade_noorresult_endpoint: stop the process and explain that the order return is missing result retrieval information. cashier_urlprefix does not meet the requirement: stop the process and explain that what was returned is not an Alipay checkout counter link.trigger-payment-signaldid not return a non-emptypaymentLink: stop the process and explain that payment takeover information generation failed.- The Alipay payment processing skill did not successfully complete the payment: do not deliver today's horoscope result, and explain the current payment status according to the result returned by that skill.
- Result script execution failed: stop the process and explain that the payment has been processed but today's horoscope could not be obtained from the project interface; do not generate substitute content on your own.