SuperAPI AI Directory

fortune-prediction-payment

General & other

View repository

Updated 10-15 16:47

About this skill

Today's Horoscope Product Payment

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:

  1. Run npm --version, confirm that the npm command is available; if it is not available, stop the process and explain that npm。
  2. Run which alipay-bot, confirm that the alipay-bot CLI is installed.
  3. If which alipay-bot finds an executable file, skip installation.
  4. 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:

  • --endpoint Prefer using the result_endpoint。
  • --out-trade-no must use the out_trade_no。
  • Only after the Alipay payment processing skill explicitly returns success can this script be called.
  • Only the zodiac_sign and fortunefrom 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

  1. Complete the "Prerequisite" and confirm that npm is available and the alipay-bot CLI is installed.
  2. Call the references/create-cashier-url.js script, passing in --endpoint and --zodiac;--zodiac must use the constellation explicitly selected by the user.
  3. Read the non-empty cashier_urlfrom the JSON returned by the script, and save this out_trade_no、zodiac_sign and result_endpoint。
  4. Verify that cashier_url must point to the Alipay Open Platform gateway: the domain is openapi.alipay.com, and the path is /gateway.do; otherwise stop.
  5. Call alipay-bot trigger-payment-signal。
alipay-bot trigger-payment-signal \
  --payment-link "<cashier_url>" \
  --merchant-info "<星座>今日运势预测" \
  --amount "0.01"
  1. From the trigger-payment-signal returned JSON, read the non-empty paymentLink。
  2. Immediately load the Alipay payment processing skill, and pass the complete raw paymentLink to that skill.
  3. Before the Alipay payment processing skill returns success, do not deliver the horoscope prediction result, and do not declare that the payment was successful.
  4. After a successful payment, call references/get-fortune-result.js, passing in the result_endpoint and out_trade_no。
  5. From the result script's returned JSON, read zodiac_sign and fortune, 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_url from 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-signal from the JSON returned by paymentLink to the Alipay payment processing skill.
  • The original value of paymentLink must be preserved completely, character by character.
  • Do not open, display, rewrite, re-encode, compress, truncate, or convert paymentLink。
  • Do not directly hand the cashier_url returned 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

  • npm unavailable: stop the flow and explain that this machine lacks npm。
  • alipay-bot not installed and executing npx -y @alipay/agent-payment@latest install failed: 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_no or result_endpoint: stop the process and explain that the order return is missing result retrieval information.
  • cashier_url prefix does not meet the requirement: stop the process and explain that what was returned is not an Alipay checkout counter link.
  • trigger-payment-signal did not return a non-empty paymentLink: 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.