Process the Payment Request
1. Required Parameters
Provide the following parameters strictly according to their defined formats:
- *
order_no (string, required): The order number from the calling skill's Phase 1 (order creation). indicator (string, required): The indicator value from the calling skill's Phase 1, typically an MD5 hash of the skill name.
[!NOTE]
The script will automatically locate the order JSON file from the fixed directory based on order_no and indicator:
- - Linux/macOS: INLINECODE4
- Windows: INLINECODE5
This JSON file is written by the calling skill's order creation phase and contains all payment-related fields (payTo, encrypted_data, amount, order_no, question, description, skill_name, resource_url, etc.).
You (the LLM) MUST NOT open, read, parse, or extract any values from this file. The script handles all file reading internally. Your only responsibility is to pass order_no and indicator as command-line arguments.
2. Hyperparameters
- *
skill-version (string): The version of the skill. Currently set to 1.0.1.
3. Execution Command
Execute the script using the following bash command. Replace the placeholders <...> with the validated parameter values. Wrap parameters that may contain spaces in quotes.
CODEBLOCK0
4. Result Processing Rules
Analyze the standard output of the execution command and strictly follow these response protocols in the given order. Stop at the first matching step; do not continue to subsequent steps.
⚡ Global Priority Rule
If the output contains 已获取到支付凭证, go to Step 2 (Obtain Credential) first to return the order number to the calling skill. The credential has already been saved to the order file by the script, and the calling skill will read it from there for decryption.
However, if the output also contains 授权链接: <AUTH_URL> or 鉴权链接: <AUTH_URL>, you MUST preserve the full original output (including the authorization/authentication URL) in memory. This is because the credential may decrypt to a failed status, in which case you will need to fall back to Step 3 using the preserved authorization/authentication URL.
In summary:
- 1. If
已获取到支付凭证 is present → go to Step 2 first. - After the calling skill decrypts the credential and reports the status:
- If the decrypted status is 成功 → go to Step 4 Case A. Done.
- If the decrypted status is 处理中 → go to Step 4 Case B. Done.
- If the decrypted status is 失败 (FAIL) → go to Step 2.1 (Credential Decryption Fallback) to check whether a preserved 授权链接: or 鉴权链接: exists, and if so, fall back to Step 3.
- 3. If
已获取到支付凭证 is NOT present → evaluate Step 1, then Step 3 in order.
Step 1 — Network/System Failure (check first)
- * Trigger: The output contains
网络或系统异常:. - Action: Report the specific error returned by the script. Additionally, if the output contains
返回消息: <MESSAGE>, display the <MESSAGE> to the user as supplementary error context. Advise the user on the next steps. Stop here; do not proceed to Step 2.
Step 2 — Obtain Credential
- * Trigger: The output contains
已获取到支付凭证 and 订单号: <ORDER_NO>. - Meaning: The HTTP request reached the server successfully. The credential (an encrypted blob containing the actual payment status) has been saved to the order file by the script. The calling skill will read it from there for decryption.
- Action:
1.
Preserve the full original script output in memory (including any
授权链接: or
鉴权链接: if present, and any
返回消息: if present). You may need it later in Step 2.1.
2. Return the order number to the calling skill for further processing:
>
订单号: INLINECODE34
将此订单号返回给调用方 skill,由调用方根据订单号从订单文件中读取支付凭证并解密,再根据其中的支付状态进行后续处理。
- * After returning the order number: Wait for the calling skill to report the decrypted
PAY_STATUS. Then proceed to Step 4 to route by decrypted status. If the status is 失败 (FAIL), Step 4 Case C will direct you to Step 2.1.
Step 2.1 — Credential Decryption Fallback (回退处理)
This step is triggered only when the calling skill decrypts the credential and the resulting status is 失败 (FAIL).
- * Trigger: The calling skill reports
PAY_STATUS: FAIL (or equivalent 失败 status) after decrypting the credential from Step 2. - Action: Check the preserved original script output from Step 2 for the presence of authorization/authentication URLs:
#### Case A: Preserved output contains 授权链接: <AUTH_URL>
* Meaning: The user has not yet been authorized. The credential contained a failure status because the payment could not proceed without authorization. The 授权链接 was present in the original output but was deferred in favor of credential processing.
* Action: Fall back to Step 3 Case A — treat this as an authorization-required scenario. Execute all actions defined in Step 3 Case A using the preserved <AUTH_URL>.
#### Case B: Preserved output contains 鉴权链接: <AUTH_URL>
* Meaning: The payment failed because authentication was not completed. The 鉴权链接 was present in the original output but was deferred.
* Action: Fall back to Step 3 Case B — treat this as an authentication-required scenario. Execute all actions defined in Step 3 Case B using the preserved <AUTH_URL>.
#### Case C: Preserved output contains NEITHER 授权链接: NOR 鉴权链接:
* Meaning: The payment genuinely failed due to business logic, and there is no authorization/authentication recovery path.
* Action: Report the failure to the user. Emphasize that the transaction was declined due to business logic. Report any error code and reason provided by the calling skill. Additionally, if the preserved original script output contains 返回消息: <MESSAGE>, display the <MESSAGE> to the user as supplementary failure context. If no specific error details were provided, inform the user that the payment failed and suggest they contact support or retry later.
Step 3 — Authorization / Authentication Required
⚠️ PREREQUISITE CHECK: This step is evaluated in two scenarios:
- 1. The original script output does NOT contain
已获取到支付凭证 at all. - You were directed here from Step 2.1 after a credential decryption failure with a preserved authorization/authentication URL.
⚠️ LINK VERIFICATION (MANDATORY): Before presenting any 授权链接 or 鉴权链接 to the user, you MUST verify the extracted URL for accuracy:
- 1. Confirm the URL is a complete, well-formed URL (starts with
http:// or https://, no truncation, no extra whitespace or line breaks). - Ensure the URL is exactly as output by the script — do NOT modify, truncate, or re-encode any part of it.
- If the URL contains query parameters (e.g.,
clawtipId), verify they are intact and not corrupted. - Do NOT hallucinate or fabricate a URL. Only use the URL that appears after
授权链接: or 鉴权链接: in the script output. - If the URL appears malformed or incomplete, report the issue to the user instead of presenting a broken link.
Case A: 失败 + 授权链接 → 待授权 (Authorization Required)
- * Trigger (direct): The output contains ALL of the following:
1.
支付状态: 失败 ←
REQUIRED (exact match)
2.
授权链接: <AUTH_URL> ←
REQUIRED
3. Does
NOT contain
已获取到支付凭证 ←
REQUIRED
- * Trigger (fallback from Step 2.1 Case A): The calling skill reported
PAY_STATUS: FAIL after credential decryption, and the preserved original output contains 授权链接: <AUTH_URL>.
- * Meaning: The user has not yet been authorized. The payment cannot proceed until the user completes authorization via the provided link.
- Action:
1. Provide the extracted
<AUTH_URL> to the user as the official
authorization link. Additionally, if the output (or preserved output) contains
返回消息: <MESSAGE>, display the
<MESSAGE> to the user as supplementary context.
2. Extract
{clawtip_id} from the authorization URL (the
clawtipId query parameter, e.g.,
...?clawtipId={clawtip_id}).
3. Create a
scheduled task to query the user's registration status:
*
Query Phrase: Use a phrase like
查询token注册状态 {clawtip_id} or
query token register status {clawtip_id}.
*
Frequency & Duration: Execute once per minute for the next 5 executions (after complete, you should notice user in the main session).
*
Crucial Note: Check the registration status, NOT the payment result.
*
Execution Limit: If it exceeds 5 times, cancel the scheduled task (
clawtip-payment user token register status {clawtip_id}).
*
Conflict Handling: Cancel any currently running scheduled tasks related to
查询token注册状态 before starting the new one.
*
Task Name: clawtip-payment user token register status {clawtip_id}。当用户需要授权,并创建了授权任务后,需要显示提示用户可以说当用户扫码完成授权后,可以说
我已授权或
我已完成授权以继续之前的流程
Case B: 处理中 + 鉴权链接 → 待鉴权 (Authentication Required)
- * Trigger (direct): The output contains ALL of the following:
1.
支付状态: 处理中 ←
REQUIRED (exact match)
2.
鉴权链接: <AUTH_URL> ←
REQUIRED
3. Does
NOT contain
已获取到支付凭证 ←
REQUIRED
- * Trigger (fallback from Step 2.1 Case B): The calling skill reported
PAY_STATUS: FAIL after credential decryption, and the preserved original output contains 鉴权链接: <AUTH_URL>.
- * Meaning: The payment is pending authentication. The user must complete authentication before the transaction can proceed.
- Action: Provide the extracted
<AUTH_URL> to the user as the official authentication link. Additionally, if the output (or preserved output) contains 返回消息: <MESSAGE>, display the <MESSAGE> to the user as supplementary context.
Stop here if Step 3 matched; do not proceed to Step 4.
Step 4 — Route by Decrypted Status
After the calling skill decrypts the credential and reports the status, follow the corresponding case:
Case A: 成功 (Transaction Success)
- * Trigger: The decrypted status is 成功.
- Action:
1. Confirm to the user that the payment has been processed successfully.
2. Display the full decrypted payment info clearly:
Payment Success Info: <DECRYPTED_PAY_INFO>
Case B: 处理中 (Processing)
- * Trigger: The decrypted status is 处理中.
- Action: Inform the user that the payment is still being processed. Suggest they wait a moment and then check the payment status again.
Case C: 失败 (Failed)
- * Trigger: The decrypted status is 失败 (or
FAIL). - Action: Go to Step 2.1 (Credential Decryption Fallback) to determine whether a recovery path (authorization/authentication) is available from the preserved original output. Do NOT simply report the failure here — always check Step 2.1 first.
Create User Payment Token
When the user explicitly requests to create a token with a phrase like 创建token xxx or create token xxx, execute the following command.
1. Required Parameters
Provide the following parameters strictly according to their defined formats:
- *
user_token (string): the user's token provided by xxx of 创建token xxx.
2. Execution Command
CODEBLOCK1
3. Other Actions
You should check and cancel the running scheduled task about 查询token注册状态 if it is running (named clawtip-payment user token register status ${device_id}). The device_id is a flexible value.
Query the User Register Status
When the user explicitly requests to query the user register status with a phrase like 查询token注册状态 xxx or query token register status xxx, or 我已注册, execute the following command.
1. Required Parameters
Provide the following parameter:
- *
device_id (string): The user's device ID.
2. Execution Command
CODEBLOCK2
3. Result Processing Rules
Analyze the standard output of the execution command and strictly follow these response protocols:
Case A: Processing
- * Trigger: The output matches the pattern
Status: processing. - Action: Inform the user that the registration is still processing, and optionally tell them the current count.
Case B: Successful
- * Trigger: The output matches the pattern
Status: successful. - Action: Confirm to the user that the registration is successful, and they have obtained the user token. You should check and cancel the running scheduled task about
查询token注册状态 if it is running (named clawtip-payment user token register status ${device_id}). The device_id is a flexible value.
Case C: Execution Failure
- * Trigger: Any error message, timeout, or failure to match the patterns above.
- Action: Report the specific error returned by the script.
View Clawtip Wallet
When the user requests to view their clawtip wallet with phrases like 查看我的clawtip钱包, 查看钱包, 打开clawtip钱包, 查看clawtip钱包, clawtip钱包管理 or view my clawtip wallet, respond with the following:
您可以通过以下链接,扫描二维码查看您的 clawtip 钱包:
👉 查看 Clawtip 钱包
请在浏览器中打开此链接然后扫描二维码以查看您的钱包详情。
处理支付请求
1. 必需参数
严格按照定义的格式提供以下参数:
- * order_no (字符串,必需):来自调用技能第一阶段(订单创建)的订单号。
- indicator (字符串,必需):来自调用技能第一阶段的指示值,通常是技能名称的MD5哈希值。
[!注意]
脚本将根据order_no和indicator自动从固定目录定位订单JSON文件:
- - Linux/macOS:/root/openclaw/skills/orders/{indicator}/{orderno}.json
- Windows:C:\openclaw\skills\orders\{indicator}\{orderno}.json
该JSON文件由调用技能的订单创建阶段写入,包含所有支付相关字段(payTo、encrypteddata、amount、orderno、question、description、skillname、resourceurl等)。
您(LLM)不得打开、读取、解析或从此文件中提取任何值。 脚本在内部处理所有文件读取。您的唯一责任是将order_no和indicator作为命令行参数传递。
2. 超参数
- * skill-version (字符串):技能版本。当前设置为1.0.1。
3. 执行命令
使用以下bash命令执行脚本。将占位符<...>替换为验证后的参数值。将可能包含空格的参数用引号括起来。
bash
python3 scripts/paymentprocess.py no>
4. 结果处理规则
分析执行命令的标准输出,并严格按照以下顺序遵循这些响应协议。在第一个匹配的步骤处停止;不要继续执行后续步骤。
⚡ 全局优先级规则
如果输出包含已获取到支付凭证,首先转到步骤2(获取凭证) 以将订单号返回给调用技能。凭证已由脚本保存到订单文件中,调用技能将从该文件中读取凭证进行解密。
但是,如果输出同时包含授权链接:URL>或鉴权链接:URL>,您必须在内存中保留完整的原始输出(包括授权/鉴权URL)。这是因为凭证可能解密为失败状态,在这种情况下,您需要使用保留的授权/鉴权URL回退到步骤3。
总结:
- 1. 如果存在已获取到支付凭证 → 首先转到步骤2。
- 调用技能解密凭证并报告状态后:
- 如果解密状态为成功 → 转到步骤4案例A。完成。
- 如果解密状态为处理中 → 转到步骤4案例B。完成。
- 如果解密状态为失败(FAIL) → 转到步骤2.1(凭证解密回退) 检查是否存在保留的授权链接:或鉴权链接:,如果存在,则回退到步骤3。
- 3. 如果不存在已获取到支付凭证 → 按顺序评估步骤1,然后步骤3。
步骤1 — 网络/系统故障(首先检查)
- * 触发条件: 输出包含网络或系统异常:。
- 操作: 报告脚本返回的具体错误。此外,如果输出包含返回消息:,将显示给用户作为补充错误上下文。建议用户下一步操作。在此处停止;不要继续执行步骤2。
步骤2 — 获取凭证
- * 触发条件: 输出包含已获取到支付凭证和订单号:。
- 含义: HTTP请求成功到达服务器。凭证(包含实际支付状态的加密数据块)已由脚本保存到订单文件中。调用技能将从该文件中读取凭证进行解密。
- 操作:
1.
在内存中保留完整的原始脚本输出(包括任何存在的授权链接:或鉴权链接:,以及任何存在的返回消息:)。稍后在步骤2.1中可能需要用到。
2. 将订单号返回给调用技能进行进一步处理:
>
订单号:
将此订单号返回给调用方技能,由调用方根据订单号从订单文件中读取支付凭证并解密,再根据其中的支付状态进行后续处理。
- * 返回订单号后: 等待调用技能报告解密的PAY_STATUS。然后转到步骤4根据解密状态进行路由。如果状态为失败(FAIL),步骤4案例C将引导您转到步骤2.1。
步骤2.1 — 凭证解密回退处理
此步骤仅在调用技能解密凭证且结果状态为失败(FAIL)时触发。
- * 触发条件: 调用技能在解密步骤2的凭证后报告PAY_STATUS:FAIL(或等效的失败状态)。
- 操作: 检查步骤2中保留的原始脚本输出中是否存在授权/鉴权URL:
#### 案例A:保留的输出包含授权链接:
* 含义: 用户尚未被授权。凭证包含失败状态,因为未经授权无法进行支付。授权链接存在于原始输出中,但为了优先处理凭证而被推迟。
* 操作: 回退到步骤3案例A — 将此视为需要授权的场景。使用保留的执行步骤3案例A中定义的所有操作。
#### 案例B:保留的输出包含鉴权链接:
* 含义: 支付失败,因为鉴权未完成。鉴权链接存在于原始输出中但被推迟。
* 操作: 回退到步骤3案例B — 将此视为需要鉴权的场景。使用保留的执行步骤3案例B中定义的所有操作。
#### 案例C:保留的输出既不包含授权链接:也不包含鉴权链接:
* 含义: 支付因业务逻辑真正失败,且没有授权/鉴权恢复路径。
* 操作: 向用户报告失败。强调交易因业务逻辑被拒绝。报告调用技能提供的任何错误代码和原因。此外,如果保留的原始脚本输出包含返回消息:,将显示给用户作为补充失败上下文。如果未提供具体的错误详情,告知用户支付失败,并建议他们联系支持或稍后重试。
步骤3 — 需要授权/鉴权
⚠️ 前置条件检查: 此步骤在两种情况下进行评估:
- 1. 原始脚本输出不包含已获取到支付凭证。
- 在凭证解密失败且保留有授权/鉴权URL后,您从步骤2.1被引导至此。
⚠️ 链接验证(强制): 在向用户呈现任何授权链接或鉴权链接之前,您必须验证提取的URL的准确性:
- 1. 确认URL是完整、格式正确的URL(以http://或https://开头,无截断,无多余空格或换行符)。
- 确保URL与脚本输出的完全一致 — 不要修改、截断或重新编码任何部分。
- 如果URL包含查询参数(例如clawtipId),验证它们完整且未被损坏。
- 不要虚构或捏造URL。 仅使用脚本输出中授权链接:或鉴权链接:后面的URL。
- 如果URL看起来格式错误或不完整,向用户报告问题,而不是呈现一个损坏的链接。
案例A:失败 + 授权链接 → 待授权(需要授权)
1. 支付状态:失败 ← 必需(精确匹配)
2. 授权链接: ← 必需
3. 不包含已获取到支付凭证 ← 必需
- * 触发条件(从步骤2.1案例A回退): 调用技能在凭证解密后报告PAYSTATUS:FAIL,且保留的原始输出包含授权链接:URL>。
- * 含义: 用户尚未被授权。在用户通过提供的链接完成授权之前,支付无法进行。
- 操作:
1. 向用户提供提取的作为官方授权链接。此外,如果输出(或保留的输出)包含返回消息:,将显示给用户作为补充上下文。
2. 从授权URL中提取{clawtip