pay-and-book

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

pay-and-book

pay-and-book

End-to-end orchestration skill that combines hotel search and on-chain payment into a single flow. This is a meta-skill — it doesn't run any commands itself but coordinates the other skills in the right order.
这是一项将酒店搜索与链上支付整合为单一流程的端到端编排Skill。它是一项元Skill(meta-skill)——自身不执行任何命令,而是按正确顺序协调其他Skill。

When to use

使用场景

Use this skill when the user wants the entire booking handled in one shot:
  • "Book me a hotel in Tokyo for next weekend, pay with USDC"
  • "Find a 4-star place in Paris May 1–5 and book it from my wallet"
  • "I need a hotel near Shibuya for 3 nights, handle the whole thing"
Use the individual skills (
search-hotel
,
book-hotel
, etc.) when the user clearly wants step-by-step control.
当用户希望一站式完成整个预订流程时,使用本Skill:
  • “帮我预订东京下周末的酒店,用USDC支付”
  • “找巴黎5月1日至5日的四星级酒店,从我的钱包完成预订”
  • “我需要涩谷附近的酒店住3晚,全程交给你处理”
当用户明确希望分步控制时,请使用独立Skill
search-hotel
book-hotel
等)。

The full flow

完整流程

Execute these steps in order. Skip a step only if its precondition is already met.
按顺序执行以下步骤,仅当前置条件已满足时才可跳过对应步骤。

Step 1: Search hotels

步骤1:搜索酒店

Use the
search-hotel
skill. Present the top results to the user and ask which one they want. Do not pick for them.
使用
search-hotel
Skill。将搜索结果中的top选项展示给用户,询问其选择。请勿替用户做选择。

Step 2: (Optional) Show room options

步骤2:(可选)展示房型选项

If the user wants to see different rate plans for one specific hotel, use the
search-room
skill. Otherwise the default
packageId
from search-hotel is fine.
若用户希望查看某一特定酒店的不同价格方案,使用
search-room
Skill。否则,使用
search-hotel
返回的默认
packageId
即可。

Step 3: Confirm wallet is ready

步骤3:确认钱包就绪

Before authentication, check current state:
bash
npx awal@latest balance
Three cases:
  • No auth → Run
    authenticate-wallet
    skill (from
    coinbase/agentic-wallet-skills
    ). Ask the user for their email; awal sends an OTP.
  • Authenticated but USDC < booking total → Run
    fund
    skill. Calculate the shortfall (
    booking_total - current_balance + small buffer
    ) and tell the user how much to fund.
  • Authenticated with sufficient USDC → Skip to Step 4.
在认证前,先检查当前状态:
bash
npx awal@latest balance
分为三种情况:
  • 未认证 → 运行
    authenticate-wallet
    Skill(来自
    coinbase/agentic-wallet-skills
    )。向用户索要邮箱,awal会发送一次性验证码(OTP)。
  • 已认证但USDC余额不足预订总额 → 运行
    fund
    Skill。计算差额(
    预订总额 - 当前余额 + 小额缓冲
    )并告知用户需充值的金额。
  • 已认证且USDC余额充足 → 跳至步骤4。

Step 4: Final confirmation + book

步骤4:最终确认 + 预订

Use the
book-hotel
skill. It handles the x402 payment and confirmation.
使用
book-hotel
Skill。它会处理x402支付及确认流程。

Step 5: Summarize

步骤5:总结

Give the user a clean recap with booking ID, total paid (USDC), tx hash, and cancellation deadline.
向用户提供清晰的预订摘要,包含预订ID、支付总额(USDC)、交易哈希(tx hash)及取消截止日期。

Decision tree

决策树

User asks to book a hotel autonomously
  ├─ Has destination + dates?
  │    No → ask once, gather both
  │    Yes ↓
  ├─ search-hotel skill → present results
  ├─ User picked a hotel?
  │    No → wait for choice
  │    Yes ↓
  ├─ User wants to see other rate plans?
  │    Yes → search-room skill
  │    No ↓ (use default packageId)
  ├─ Wallet authenticated?
  │    No → authenticate-wallet skill
  │    Yes ↓
  ├─ USDC balance >= total + 5%?
  │    No → fund skill
  │    Yes ↓
  ├─ User confirmed total + guest details?
  │    No → ask for guest details, summarize, confirm
  │    Yes ↓
  └─ book-hotel skill (x402 pay) → confirm + recap
用户要求自主预订酒店
  ├─ 是否有目的地和日期?
  │    否 → 询问一次,收集两项信息
  │    是 ↓
  ├─ 调用search-hotel Skill → 展示结果
  ├─ 用户是否选定酒店?
  │    否 → 等待用户选择
  │    是 ↓
  ├─ 用户是否希望查看其他价格方案?
  │    是 → 调用search-room Skill
  │    否 ↓(使用默认packageId)
  ├─ 钱包是否已认证?
  │    否 → 调用authenticate-wallet Skill
  │    是 ↓
  ├─ USDC余额是否 ≥ 总额 + 5%?
  │    否 → 调用fund Skill
  │    是 ↓
  ├─ 用户是否确认总额及宾客信息?
  │    否 → 询问宾客信息,汇总后再次确认
  │    是 ↓
  └─ 调用book-hotel Skill(x402支付)→ 确认并总结

Example session

会话示例

User: Find me a hotel in Tokyo May 1-5 and book it with USDC

Agent: [search-hotel skill]
  → Presents 5 hotels

User: Book the Park Hyatt

Agent: [check wallet] → not authenticated
  → "Need to log in first. What email?"

User: me@example.com

Agent: [authenticate-wallet skill] → email OTP
User: OTP code is 123456
Agent: [authenticate-wallet completes]
  → "Logged in. Wallet balance: 0 USDC."
  → "You'll need 1,800 USDC for this booking. Want to fund the wallet?"

User: Yes, fund 2000

Agent: [fund skill] → onramp link
  → User completes onramp
  → "Wallet now has 2000 USDC."
  → "Ready to book Park Hyatt Tokyo, May 1-5, 1,800 USDC.
     What name/email for the guest?"

User: Nguyen Van A, guest@example.com

Agent: → "Booking summary: ... Confirm? (yes/no)"
User: yes
Agent: [book-hotel skill — awal x402 pay]
  → "✅ Booked! BK_2026_05_001, paid 1,800 USDC, tx 0xabc..."
用户:帮我找东京5月1日至5日的酒店,并用USDC完成预订

Agent:[调用search-hotel Skill]
  → 展示5家酒店

用户:预订柏悦酒店

Agent:[检查钱包] → 未认证
  → “需要先登录。请问你的邮箱是?”

用户:me@example.com

Agent:[调用authenticate-wallet Skill] → 发送邮箱验证码
用户:验证码是123456
Agent:[authenticate-wallet流程完成]
  → “登录成功。钱包余额:0 USDC。”
  → “本次预订需要1800 USDC。是否需要为钱包充值?”

用户:是的,充值2000 USDC

Agent:[调用fund Skill] → 提供充值链接
  → 用户完成充值
  → “钱包当前余额为2000 USDC。”
  → “准备预订东京柏悦酒店(5月1日至5日),费用1800 USDC。
     请问宾客姓名/邮箱是?”

用户:Nguyen Van A,guest@example.com

Agent:→ “预订摘要:... 是否确认?(是/否)”
用户:是
Agent:[调用book-hotel Skill — awal x402支付]
  → “✅ 预订成功!预订编号BK_2026_05_001,支付1800 USDC,交易哈希0xabc...”

Critical rules

核心规则

  • Never skip the user choice steps. Even if the search returns one obvious result, show it to the user and wait for confirmation.
  • Never auto-fund. Always ask before triggering the
    fund
    skill — funding involves an external payment from the user.
  • Never auto-pay. The final
    book-hotel
    step always shows a summary and waits for explicit yes.
  • Stop and ask if anything is unclear: dates, occupancy, hotel choice, guest details, fund amount.
  • The user can interrupt at any step ("actually, show me different dates"). Restart the relevant earlier step.
  • 绝不能跳过用户选择步骤:即使搜索结果只有一个明显选项,也需展示给用户并等待确认。
  • 绝不能自动充值:触发
    fund
    Skill前必须先询问用户——充值涉及用户的外部支付操作。
  • 绝不能自动支付:最终的
    book-hotel
    步骤必须展示摘要并等待用户明确回复“是”。
  • 若有任何疑问,立即询问:包括日期、入住人数、酒店选择、宾客信息、充值金额等。
  • 用户可在任意步骤中断(例如“其实,帮我换个日期”),此时需重启相关的前置步骤。

Skills referenced (must be installed)

依赖Skill(需安装)

SkillSourcePurpose
search-hotel
this packageFind hotels
search-room
this package(optional) See rate plans
book-hotel
this packagex402 payment + booking
authenticate-wallet
coinbase/agentic-wallet-skills
Email OTP login
fund
coinbase/agentic-wallet-skills
Top up USDC via Coinbase Onramp
If any of the Coinbase skills aren't installed, tell the user:
This flow needs Coinbase wallet skills too. Install them with:
npx skills add coinbase/agentic-wallet-skills
Skill来源用途
search-hotel
本包搜索酒店
search-room
本包(可选)查看价格方案
book-hotel
本包x402支付 + 预订
authenticate-wallet
coinbase/agentic-wallet-skills
邮箱OTP登录
fund
coinbase/agentic-wallet-skills
通过Coinbase Onramp充值USDC
若Coinbase相关Skill未安装,请告知用户:
该流程还需Coinbase钱包Skill。请通过以下命令安装:
npx skills add coinbase/agentic-wallet-skills