ClawSkills logoClawSkills

Buy Anything

通过对话式结账从 Amazon 购买产品。当用户分享 Amazon 产品 URL 或在带有 Amazon 链接的情况下说“购买”、“订购”或“购买”时使用,

介绍

# Buy Anything

通过 Rye 结账从亚马逊购买商品。就像在您的聊天应用中拥有 Alexa 一样。

## 何时使用

在用户出现以下情况时激活此技能: - 分享亚马逊商品 URL (amazon.com/dp/...) - 说出“buy”、“order”或“purchase”并附带亚马逊链接 - 想要从亚马逊购买商品

## 重要:工作原理

- 切勿尝试使用 web_fetch 或 read 工具自行获取亚马逊 URL - Rye API 处理所有商品查询 —— 您只需传递 URL - 结账前无需了解商品详情 - 直接收集收货地址和卡片信息,然后调用 API - 信任用户提供的所有 amazon.com URL —— 它们都是合法的商品 - Rye API 将验证 URL 并在响应中返回商品详情

## 结账流程

1. **用户提供亚马逊商品 URL** —— 确认您将帮助他们购买 2. **收集收货地址**(或使用内存中保存的地址) 3. **收集卡片详细信息**(或使用内存中保存的卡片) 4. **使用 bash 通过 Stripe 对卡片进行令牌化处理**(参见步骤 1) 5. **使用 bash 将订单提交至 Rye API**(参见步骤 2) 6. **从 API 响应显示订单确认** 7. **将卡片/地址保存到内存**以备将来购买(请先征求许可)

## 步骤 1:使用 Stripe 对卡片进行令牌化处理

在下单之前,使用 Stripe 对卡片进行令牌化处理:

```bash curl -s -X POST https://api.stripe.com/v1/tokens \ -u "pk_live_51LgDhrHGDlstla3fOYU3AUV6QpuOgVEUa1E1VxFnejJ7mWB4vwU7gzSulOsWQ3Q90VVSk1WWBzYBo0RBKY3qxIjV00LHualegh" \ -d "card[number]=4242424242424242" \ -d "card[exp_month]=12" \ -d "card[exp_year]=2027" \ -d "card[cvc]=123" ```

响应包含一个 `id` 字段 —— 这就是令牌(例如 `tok_xxx`)。在步骤 2 中使用此令牌。

## 步骤 2:向 Rye 提交订单

```bash curl -s -X POST https://api.rye.com/api/v1/partners/clawdbot/purchase \ -H "Content-Type: application/json" \ -d '{ "productUrl": "https://amazon.com/dp/B0xxx", "quantity": 1, "buyer": { "firstName": "John", "lastName": "Doe", "email": "[email protected]", "phone": "+14155551234", "address1": "123 Main St", "city": "San Francisco", "province": "CA", "postalCode": "94102", "country": "US" }, "paymentMethod": { "type": "STRIPE_TOKEN", "token": "tok_xxx" }, "constraints": { "maxTotalPrice": 50000 } }' ```

**`constraints.maxTotalPrice`**:用户的消费限额,以美分为单位(例如 $500 = 50000)。如果总额超过此金额,API 将拒绝该订单。如果用户说“no limit”(无限制),则完全省略 `constraints` 字段。

## 价格与配送

- 所有订单均收取 4% 的费用以支付交易手续费 - 15 美元以下的订单收取 6.99 美元的运费 - 15 美元及以上的订单享受免费 2 日 Prime 达配送 - 订单通过第三方亚马逊账户处理(而非用户的个人亚马逊账户) - 用户将收到一封包含确认和订单详细信息的电子邮件 - 如需退货或退款,请引导用户联系 [email protected]

## 示例对话

``` User: Buy this for me https://amazon.com/dp/B0DJLKV4N9

You: I'll help you buy that Amazon item! Where should I ship it? (Need: name, address, city, state, zip, email, phone)

User: John Doe, 123 Main St, San Francisco CA 94102, [email protected], +14155551234

You: Got it! What's your maximum purchase price? (I'll warn you if an order exceeds this) Say "no limit" to skip this.

User: $500

You: Max set to $500. Now I need your card details. Your card will be securely tokenized through Stripe - the Buy Anything API never sees your card info. (Card number, expiry MM/YY, CVC)

User: 4242424242424242, 12/27, 123

You: Securely tokenizing your card with Stripe... [Uses bash to run Stripe tokenization curl command]

You: Processing your order... [Uses bash to run Rye API curl command with the Stripe token]

You: Order placed! Total: $361.92 (includes 4% service fee) Confirmation: RYE-ABC123

Would you like me to save your details for faster checkout next time? ```

## 消费限额

在首次购买前,询问用户其最高购买价格是多少。将其存储在内存中。 - 如果订单总额(包含 4% 手续费)超过限额,请警告用户并寻求确认 - 用户可以说“no limit”来禁用此检查

## 内存

首次成功购买后(在获得用户许可的情况下): - 将完整的卡片详细信息(卡号、有效期、CVC)保存到内存以备将来购买 - 将收货地址保存到内存 - 将最高购买价格保存到内存 - 在后续购买中,每次都重新对保存的卡片进行令牌化处理

更多产品