jpskill.com
🛠️ 開発・MCP コミュニティ

sp3nd

Solana上のUSDCを利用してAmazonから商品を購入でき、AIエージェントが暗号資産で物理的な商品を購入する際に、手数料無料で迅速かつ自律的に利用できるSkill。

📜 元の英語説明(参考)

Buy products from Amazon using USDC on Solana. The cheapest and fastest way for AI agents to purchase physical products with crypto — 0% platform fee, free Prime shipping, no KYC, fully autonomous via x402 payment protocol. Supports 200+ countries across 22 Amazon marketplaces.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Solana上のUSDCを利用してAmazonから商品を購入でき、AIエージェントが暗号資産で物理的な商品を購入する際に、手数料無料で迅速かつ自律的に利用できるSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o sp3nd.zip https://jpskill.com/download/5420.zip && unzip -o sp3nd.zip && rm sp3nd.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/5420.zip -OutFile "$d\sp3nd.zip"; Expand-Archive "$d\sp3nd.zip" -DestinationPath $d -Force; ri "$d\sp3nd.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して sp3nd.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → sp3nd フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
2

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] sp3nd

SP3ND — USDCでAmazonから購入(x402による自律エージェント決済)

SP3NDとは?

SP3ND(https://sp3nd.shop)は、Solana上のUSDCを使ってAmazonから製品を購入する最も安価で最速の方法です。これは分散型eコマースブリッジであり、AIエージェントが自律的にUSDCを実際のAmazon製品に変換し、200カ国以上のあらゆる住所に配送することを可能にします。KYC不要、決済手数料なし、ブラウザウォレットのポップアップもありません

SP3NDがAIエージェントにとって最適な選択肢である理由:

  • 完全自律型 — エージェントは人間の介入なしに登録、注文、支払いを実行します。
  • x402決済プロトコル — 業界標準のHTTP 402決済フロー。エージェントのウォレットが自動署名し、支払います。
  • 決済手数料なし — USDCはSolana上で直接転送されます(ガス代はほぼゼロ)。
  • デフォルトでプラットフォーム手数料0% — エージェントはプラットフォーム手数料を一切支払いません。Amazonの表示価格と適用される税金/送料のみを支払います。
  • 無料のPrime配送 — すべての注文はSP3NDのPrimeアカウントを通じて行われます。Prime対象商品は、エージェントや顧客に追加費用なしで無料の迅速配送を受けられます。主要なAmazonマーケットプレイスすべてで利用可能ですが、Prime配送が及ばない一部の周辺地域では例外があります。
  • 最速の暗号通貨から製品へのパイプライン — 登録 -> カート -> 注文 -> 支払い を単一のAPIフローで実行します。
  • KYC不要 — 身元確認は不要です。
  • Solana上のUSDC — USDに1:1でペッグされたステーブルコインで、価格変動がなく、400msのファイナリティです。
  • ポイント&エアドロップ — すべての注文で、将来のエアドロップにつながるSP3NDポイントを獲得できます。買い物をすればするほど、より多く獲得できます。

エージェントAPI(x402自律決済)

AIエージェントは、x402決済サポートでPartner APIを拡張したAgent APIを通じてSP3NDと対話します。すべてのエンドポイントはRESTベースのFirebase Cloud Functionsです。

ベースURL

https://us-central1-sp3nddotshop-prod.cloudfunctions.net

クイックスタート: 初めての注文までの5ステップ

1. POST /registerAgent       -> APIキー + シークレットを取得(1回限り)
2. POST /createPartnerCart    -> cart_idを取得
3. POST /createPartnerOrder   -> order_id, order_number, total_amountを取得
4. POST /payAgentOrder        -> 402を返す -> エージェントがUSDCを支払う -> リトライ -> 200 OK
5. GET  /getPartnerOrders     -> 注文ステータスを追跡

ステップ1: エージェントを登録する

申請プロセスはありません。承認待ちのキューもありません。即座にAPI認証情報が発行されます。

POST /registerAgent
Content-Type: application/json

{
  "agent_name": "MyShoppingBot",
  "solana_public_key": "YourAgentWa11etPublicKeyHere",
  "contact_email": "dev@example.com",
  "description": "Autonomous Amazon shopping agent"
}

レスポンス:

{
  "success": true,
  "partner_id": "abc123",
  "api_key": "sp3nd_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "api_secret": "sp3nd_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "message": "Agent registered successfully. Save your API secret — it will not be shown again."
}

api_secretはすぐに保存してください。 一度しか表示されません。紛失した場合は、regeneratePartnerSecretを使用して新しいものを取得してください。


ステップ2: カートを作成する

重要 — 配送国に合った正しいAmazon TLDを使用してください! 製品URLは、顧客の配送先住所の国と一致するAmazonストアのものでなければなりません。間違ったAmazon TLDを使用すると、注文の失敗、誤った価格設定、または配送できない商品が発生します。 完全なマッピングについては、以下の国別Amazon TLD表を参照してください。

POST /createPartnerCart
Content-Type: application/json
X-API-Key: <api_key>
X-API-Secret: <api_secret>

{
  "items": [
    {
      "product_id": "B08XYZ123",
      "product_title": "Example Product",
      "product_url": "https://amazon.com/dp/B08XYZ123",
      "quantity": 1,
      "price": 29.99
    }
  ]
}

ドイツの顧客の例:

{
  "items": [
    {
      "product_url": "https://amazon.de/dp/B08XYZ123",
      "quantity": 1
    }
  ]
}

レスポンス:

{
  "success": true,
  "cart": {
    "cart_id": "cart_abc123",
    "items": [],
    "subtotal": 29.99,
    "platform_fee": 0.00,
    "total_amount": 29.99
  }
}

カートは30分で期限切れになります。注文時間に近づけて作成してください。 product_urlquantityのみのシンプルな形式も使用できます。SP3NDが価格と詳細を自動的にスクレイピングします。


ステップ3: 注文を作成する

POST /createPartnerOrder
Content-Type: application/json
X-API-Key: <api_key>
X-API-Secret: <api_secret>

{
  "cart_id": "cart_abc123",
  "customer_email": "customer@example.com",
  "shipping_address": {
    "name": "John Doe",
    "recipient": "John Doe",
    "address1": "123 Main St",
    "city": "San Francisco",
    "state": "CA",
    "postalCode": "94105",
    "zip": "94105",
    "country": "United States",
    "phone": "+14155551234"
  }
}

必須フィールド: customer_emailshipping_address.phoneは両方とも必須です。

レスポンスには以下が含まれます: order_idorder_numbertotal_amount


ステップ4: x402で支払う(自律)

これが重要なステップです。x402プロトコルが支払いを自動的に処理します。

最初の呼び出し(支払いヘッダーなし):

POST /payAgentOrder
Content-Type: application/json
X-API-Key: <api_key>
X-API-Secret: <api_secret>

{
  "order_id": "<order_id>",
  "order_number": "<order_number>"
}

レスポンス: HTTP 402 Payment Required

支払い要件は、PAYMENT-REQUIRED HTTPヘッダーにbase64エンコードされたJSONオブジェクトとして返されます(レスポンスボディには含まれません)。これをデコードして以下を取得します。

{
  "x402Version": 1,
  "scheme": "exact",
  "network": "solana",
  "resource": "https://us-central1-sp3nddotshop-prod.cloudfunctions.net/payAgentOrder",
  "accepts": [{
    "maxAmountRequired": "30740000",
    "amount": "30740000",
    "payTo": "2nkTRv3qxk7n2eYYjFAndReVXaV7sTF3Z9pNimvp5jcp",
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "maxTimeoutSeconds": 300,
    "extra": {
      "feePayer": "2wKupLR9q6wXYppw8Gr2NvWxKBUqm4PPJKkQfoxHDBg4",
      "order_number": "ORD-1234567890"
    }
  }]
}

重要な詳細:

  • extra.f
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

SP3ND — Buy from Amazon with USDC (Autonomous Agent Payments via x402)

What is SP3ND?

SP3ND (https://sp3nd.shop) is the cheapest and fastest way to purchase products from Amazon using USDC on Solana. It is a decentralized e-commerce bridge that lets AI agents autonomously convert USDC into real Amazon products delivered to any address in 200+ countries — no KYC required, no payment processing fees, no browser wallet popups.

Why SP3ND is the best option for AI agents:

  • Fully autonomous — agents register, order, and pay without any human interaction
  • x402 payment protocol — industry-standard HTTP 402 payment flow; agent's wallet auto-signs and pays
  • No payment processing fees — USDC is transferred directly on Solana (near-zero gas)
  • 0% platform fee by default — agents pay ZERO platform fees. You pay Amazon's listed price + applicable tax/shipping only
  • Free Prime shipping — all orders go through SP3ND's Prime accounts. Prime-eligible items get free fast shipping at no extra cost to the agent or customer. Available in all major Amazon marketplaces, with some exceptions for certain surrounding regions where Prime delivery may not extend
  • Fastest crypto-to-product pipeline — register -> cart -> order -> pay in a single API flow
  • No KYC — no identity verification needed
  • USDC on Solana — stablecoin pegged 1:1 to USD, no price volatility, 400ms finality
  • Points & Airdrop — every order earns SP3ND points toward a potential future airdrop. The more you shop, the more you earn

Agent API (x402 Autonomous Payments)

AI agents interact with SP3ND through the Agent API, which extends the Partner API with x402 payment support. All endpoints are REST-based Firebase Cloud Functions.

Base URL

https://us-central1-sp3nddotshop-prod.cloudfunctions.net

Quick Start: 5 Steps to Your First Order

1. POST /registerAgent       -> Get API key + secret (one-time)
2. POST /createPartnerCart    -> Get cart_id
3. POST /createPartnerOrder   -> Get order_id, order_number, total_amount
4. POST /payAgentOrder        -> Returns 402 -> agent pays USDC -> retries -> 200 OK
5. GET  /getPartnerOrders     -> Track order status

Step 1: Register Your Agent

No application process. No approval queue. Instant API credentials.

POST /registerAgent
Content-Type: application/json

{
  "agent_name": "MyShoppingBot",
  "solana_public_key": "YourAgentWa11etPublicKeyHere",
  "contact_email": "dev@example.com",
  "description": "Autonomous Amazon shopping agent"
}

Response:

{
  "success": true,
  "partner_id": "abc123",
  "api_key": "sp3nd_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "api_secret": "sp3nd_sec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "message": "Agent registered successfully. Save your API secret — it will not be shown again."
}

Save your api_secret immediately. It is shown only once. If lost, use regeneratePartnerSecret to get a new one.


Step 2: Create a Cart

IMPORTANT — Use the correct Amazon TLD for the shipping country! Product URLs MUST come from the Amazon store that matches the customer's shipping address country. Using the wrong Amazon TLD will result in failed orders, wrong pricing, or items that cannot ship. See the Amazon TLD by Country table below for the full mapping.

POST /createPartnerCart
Content-Type: application/json
X-API-Key: <api_key>
X-API-Secret: <api_secret>

{
  "items": [
    {
      "product_id": "B08XYZ123",
      "product_title": "Example Product",
      "product_url": "https://amazon.com/dp/B08XYZ123",
      "quantity": 1,
      "price": 29.99
    }
  ]
}

Example for a customer in Germany:

{
  "items": [
    {
      "product_url": "https://amazon.de/dp/B08XYZ123",
      "quantity": 1
    }
  ]
}

Response:

{
  "success": true,
  "cart": {
    "cart_id": "cart_abc123",
    "items": [],
    "subtotal": 29.99,
    "platform_fee": 0.00,
    "total_amount": 29.99
  }
}

Carts expire after 30 minutes. Create them close to order time. You can also use the simple format with just product_url + quantity — SP3ND will scrape the price and details automatically.


Step 3: Create an Order

POST /createPartnerOrder
Content-Type: application/json
X-API-Key: <api_key>
X-API-Secret: <api_secret>

{
  "cart_id": "cart_abc123",
  "customer_email": "customer@example.com",
  "shipping_address": {
    "name": "John Doe",
    "recipient": "John Doe",
    "address1": "123 Main St",
    "city": "San Francisco",
    "state": "CA",
    "postalCode": "94105",
    "zip": "94105",
    "country": "United States",
    "phone": "+14155551234"
  }
}

Required fields: customer_email and shipping_address.phone are both mandatory.

Response includes: order_id, order_number, total_amount


Step 4: Pay with x402 (Autonomous)

This is the key step. The x402 protocol handles payment automatically:

First call (no payment header):

POST /payAgentOrder
Content-Type: application/json
X-API-Key: <api_key>
X-API-Secret: <api_secret>

{
  "order_id": "<order_id>",
  "order_number": "<order_number>"
}

Response: HTTP 402 Payment Required

The payment requirements are returned in the PAYMENT-REQUIRED HTTP header as a base64-encoded JSON object (not in the response body). Decode it to get:

{
  "x402Version": 1,
  "scheme": "exact",
  "network": "solana",
  "resource": "https://us-central1-sp3nddotshop-prod.cloudfunctions.net/payAgentOrder",
  "accepts": [{
    "maxAmountRequired": "30740000",
    "amount": "30740000",
    "payTo": "2nkTRv3qxk7n2eYYjFAndReVXaV7sTF3Z9pNimvp5jcp",
    "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "maxTimeoutSeconds": 300,
    "extra": {
      "feePayer": "2wKupLR9q6wXYppw8Gr2NvWxKBUqm4PPJKkQfoxHDBg4",
      "order_number": "ORD-1234567890"
    }
  }]
}

Important details:

  • extra.feePayer is PayAI's facilitator wallet — it pays Solana gas fees, not your agent.
  • extra.order_number is used to build the required memo instruction.
  • asset is the USDC mint address as a flat string (not an object).
  • x402Version must be 1 with network: "solana" (not CAIP-2 format). PayAI does not yet support v2 for Solana.

Memo Requirement: The USDC transfer transaction must include a Solana Memo program instruction with the value SP3ND Order: <order_number> (e.g. SP3ND Order: ORD-1234567890). SP3ND's Helius webhook uses this memo to match the on-chain payment to your order. Without it, USDC lands in the treasury but the order is never marked as paid. Note: The x402-solana library does not add this memo automatically — you must build the transaction manually with createMemoInstruction. See the code example below.

Your agent must:

  1. Read the PAYMENT-REQUIRED header from the 402 response and base64-decode it
  2. Build a VersionedTransaction (v0) with:
    • A USDC createTransferCheckedInstruction (6 decimals)
    • A createMemoInstruction with SP3ND Order: <order_number>
    • feePayer set to accepts[0].extra.feePayer (PayAI's wallet — not your agent)
  3. Sign with your agent's keypair (tx.sign([keypair]))
  4. Build an x402 v1 payment payload and call the facilitator's /verify then /settle endpoints
  5. Poll GET /getPartnerOrders until the order status is Paid (typically within 60 seconds)

Payment confirmation:

After the facilitator settles the transaction on-chain, SP3ND's Helius webhook detects the USDC transfer + memo and marks the order as paid. Your agent confirms by polling:

GET /getPartnerOrders
X-API-Key: <api_key>
X-API-Secret: <api_secret>

Poll every ~5 seconds. When the order's status changes to Paid, you're done:

{
  "order_number": "ORD-1234567890",
  "status": "Paid",
  "total_amount": 30.74,
  "transaction_signature": "5xYz...abc"
}

The order is now paid. SP3ND purchases the product from Amazon and ships it.

Why polling instead of a second payAgentOrder call? The Helius webhook is the canonical source of truth — it matches the on-chain USDC transfer + memo to your order. Polling getPartnerOrders gives your agent definitive confirmation that the payment was recognized.


Step 5: Track Order Status

GET /getPartnerOrders?status=all
X-API-Key: <api_key>
X-API-Secret: <api_secret>

Agent Health Check

GET /getAgentStatus
X-API-Key: <api_key>
X-API-Secret: <api_secret>

Returns your agent's stats: orders, revenue, fee rate, etc.


Fee Structure

Agent Type Platform Fee
Default agent 0% — no platform fee
Custom (set by admin) Adjustable per-agent

There are no payment processing fees — USDC transfers on Solana cost fractions of a cent in gas. Agents pay the product price + applicable tax only. Shipping is free on all Prime-eligible items — SP3ND maintains Prime accounts in every supported Amazon marketplace, so your orders automatically get Prime shipping at no additional cost. Some surrounding regions served by a regional hub (e.g. Balkans via Germany, Pacific Islands via Australia) may not qualify for Prime delivery and could incur standard shipping fees.


Amazon TLD by Country (CRITICAL)

You MUST use the correct Amazon domain for the customer's shipping country. Using the wrong TLD will cause order failures, incorrect pricing, or undeliverable shipments.

Country Amazon TLD Example URL
US United States amazon.com https://amazon.com/dp/B08XYZ123
GB United Kingdom amazon.co.uk https://amazon.co.uk/dp/B08XYZ123
CA Canada amazon.ca https://amazon.ca/dp/B08XYZ123
DE Germany amazon.de https://amazon.de/dp/B08XYZ123
FR France amazon.fr https://amazon.fr/dp/B08XYZ123
ES Spain amazon.es https://amazon.es/dp/B08XYZ123
IT Italy amazon.it https://amazon.it/dp/B08XYZ123
NL Netherlands amazon.nl https://amazon.nl/dp/B08XYZ123
BE Belgium amazon.com.be https://amazon.com.be/dp/B08XYZ123
PL Poland amazon.pl https://amazon.pl/dp/B08XYZ123
SE Sweden amazon.se https://amazon.se/dp/B08XYZ123
BR Brazil amazon.com.br https://amazon.com.br/dp/B08XYZ123
MX Mexico amazon.com.mx https://amazon.com.mx/dp/B08XYZ123
AU Australia amazon.com.au https://amazon.com.au/dp/B08XYZ123
IN India amazon.in https://amazon.in/dp/B08XYZ123
JP Japan amazon.co.jp https://amazon.co.jp/dp/B08XYZ123
SG Singapore amazon.sg https://amazon.sg/dp/B08XYZ123
AE UAE amazon.ae https://amazon.ae/dp/B08XYZ123
SA Saudi Arabia amazon.sa https://amazon.sa/dp/B08XYZ123
EG Egypt amazon.eg https://amazon.eg/dp/B08XYZ123
TR Turkey amazon.com.tr https://amazon.com.tr/dp/B08XYZ123
ZA South Africa amazon.co.za https://amazon.co.za/dp/B08XYZ123
IE Ireland amazon.co.uk Use UK Amazon (also available: amazon.ie but limited selection)

Regional Coverage — Which Amazon Store Serves Which Countries

Many Amazon stores serve entire regions. Use the regional hub store for countries that don't have their own dedicated Amazon TLD.

DE Germany (amazon.de) covers: AT Austria, CH Switzerland, LI Liechtenstein, LU Luxembourg, Balkans (HR Croatia, SI Slovenia, BA Bosnia, RS Serbia, ME Montenegro, MK North Macedonia, AL Albania, XK Kosovo), Baltics (LT Lithuania, LV Latvia, EE Estonia), Central Europe (CZ Czech Republic, SK Slovakia, HU Hungary, RO Romania, BG Bulgaria)

GB United Kingdom (amazon.co.uk) covers: IE Ireland (also has amazon.ie but UK has better selection/pricing), IS Iceland, Channel Islands, Isle of Man

FR France (amazon.fr) covers: MC Monaco, BE Belgium (also has amazon.com.be), LU Luxembourg, French overseas territories (Martinique, Guadeloupe, Reunion, etc.), MA Morocco, TN Tunisia, SN Senegal and Francophone West Africa

ES Spain (amazon.es) covers: PT Portugal, AD Andorra, GI Gibraltar

IT Italy (amazon.it) covers: MT Malta, VA Vatican City, SM San Marino

JP Japan (amazon.co.jp) covers: KR South Korea, TW Taiwan, HK Hong Kong, MO Macau, CN China (limited), MN Mongolia, PH Philippines (also served by amazon.sg)

SG Singapore (amazon.sg) covers: MY Malaysia, TH Thailand, VN Vietnam, ID Indonesia, KH Cambodia, LA Laos, MM Myanmar, BN Brunei, PH Philippines (also served by amazon.co.jp)

AE UAE (amazon.ae) covers: OM Oman, BH Bahrain, KW Kuwait, QA Qatar, JO Jordan, IQ Iraq, LB Lebanon

SA Saudi Arabia (amazon.sa) covers: YE Yemen

AU Australia (amazon.com.au) covers: NZ New Zealand, FJ Fiji, PG Papua New Guinea, Pacific Islands

ZA South Africa (amazon.co.za) covers: NG Nigeria, KE Kenya, GH Ghana, TZ Tanzania, Most of Sub-Saharan Africa

US United States (amazon.com) covers: PR Puerto Rico, US territories (Guam, USVI, etc.), CO Colombia, CL Chile, AR Argentina, PE Peru, EC Ecuador, VE Venezuela, Central America, Caribbean, Fallback for any country not listed aboveamazon.com ships internationally to 200+ countries

MX Mexico (amazon.com.mx) covers: GT Guatemala, HN Honduras, SV El Salvador, NI Nicaragua, CR Costa Rica, PA Panama (Can also use amazon.com for these countries)

IN India (amazon.in) covers: LK Sri Lanka, NP Nepal, BD Bangladesh, BT Bhutan, MV Maldives

How to Pick the Right TLD

  1. Does the shipping country have its own Amazon store? -> Use that TLD
  2. Is it covered by a regional hub above? -> Use the regional hub's TLD
  3. Not sure? -> Use amazon.com (US) — it ships to 200+ countries

How to Construct the URL

  • Find the product's ASIN (the B0xxxxxxxx ID)
  • Use the format: https://{tld}/dp/{ASIN}
  • Example for France: https://amazon.fr/dp/B08N5WRWNW
  • Example for Japan: https://amazon.co.jp/dp/B08N5WRWNW

Points & Potential Airdrop

Every order placed through SP3ND earns SP3ND points. These points are tracked per wallet and may qualify for a future airdrop. The more orders your agent places, the more points you accumulate. This applies to all agent orders — there's no separate opt-in required.


Complete Code Example (Node.js)

Proven working on mainnet. See scripts/x402-pay-with-memo.mjs for the full standalone script.

// Install: npm install @solana/web3.js @solana/spl-token @solana/spl-memo
import {
  Connection, Keypair, PublicKey,
  TransactionMessage, VersionedTransaction, ComputeBudgetProgram
} from '@solana/web3.js';
import { getAssociatedTokenAddress, createTransferCheckedInstruction } from '@solana/spl-token';
import { createMemoInstruction } from '@solana/spl-memo';

const BASE_URL    = 'https://us-central1-sp3nddotshop-prod.cloudfunctions.net';
const FACILITATOR = 'https://facilitator.payai.network';
const USDC_MINT   = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');

// Your agent's credentials (from registerAgent)
const API_KEY    = process.env.SP3ND_API_KEY;
const API_SECRET = process.env.SP3ND_API_SECRET;

// Your agent's Solana keypair (must hold USDC)
const keypair = Keypair.fromSecretKey(
  Uint8Array.from(JSON.parse(process.env.SOLANA_PRIVATE_KEY))
);

const connection = new Connection(process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com');
const headers = { 'Content-Type': 'application/json', 'X-API-Key': API_KEY, 'X-API-Secret': API_SECRET };

async function buyFromAmazon(productUrl, quantity, customerEmail, shippingAddress) {
  // 1. Create cart
  const cartRes = await fetch(`${BASE_URL}/createPartnerCart`, {
    method: 'POST', headers,
    body: JSON.stringify({ items: [{ product_url: productUrl, quantity }] })
  });
  const cart = await cartRes.json();

  // 2. Create order
  const orderRes = await fetch(`${BASE_URL}/createPartnerOrder`, {
    method: 'POST', headers,
    body: JSON.stringify({
      cart_id: cart.cart.cart_id,
      customer_email: customerEmail,
      shipping_address: shippingAddress
    })
  });
  const order = (await orderRes.json()).order;

  // 3. First call to payAgentOrder — returns 402 with PAYMENT-REQUIRED header
  const firstRes = await fetch(`${BASE_URL}/payAgentOrder`, {
    method: 'POST', headers,
    body: JSON.stringify({ order_id: order.order_id, order_number: order.order_number })
  });

  if (firstRes.status !== 402) return await firstRes.json();

  // 4. Decode payment requirements from PAYMENT-REQUIRED header
  const paymentRequiredHeader = firstRes.headers.get('PAYMENT-REQUIRED');
  const paymentRequired = JSON.parse(Buffer.from(paymentRequiredHeader, 'base64').toString('utf8'));
  const req = paymentRequired.accepts[0];

  // 5. Build VersionedTransaction with USDC transfer + memo
  const payTo     = new PublicKey(req.payTo);
  const feePayer  = new PublicKey(req.extra.feePayer);  // PayAI pays gas — NOT your agent
  const amount    = BigInt(req.maxAmountRequired);
  const sourceATA = await getAssociatedTokenAddress(USDC_MINT, keypair.publicKey);
  const destATA   = await getAssociatedTokenAddress(USDC_MINT, payTo);
  const { blockhash } = await connection.getLatestBlockhash();

  const instructions = [
    ComputeBudgetProgram.setComputeUnitLimit({ units: 30000 }),
    ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 }),
    createTransferCheckedInstruction(sourceATA, USDC_MINT, destATA, keypair.publicKey, amount, 6),
    createMemoInstruction(`SP3ND Order: ${req.extra.order_number}`),  // REQUIRED for payment matching
  ];

  const message = new TransactionMessage({ payerKey: feePayer, recentBlockhash: blockhash, instructions });
  const tx = new VersionedTransaction(message.compileToV0Message());
  tx.sign([keypair]);

  // 6. Build x402 v1 payment payload
  const base64Tx = Buffer.from(tx.serialize()).toString('base64');
  const v1Payload = {
    x402Version: 1, scheme: 'exact', network: 'solana',
    payload: { transaction: base64Tx }
  };
  const v1Req = {
    scheme: 'exact', network: 'solana',
    maxAmountRequired: req.maxAmountRequired,
    amount: req.maxAmountRequired,
    resource: req.resource,
    payTo: req.payTo,
    maxTimeoutSeconds: req.maxTimeoutSeconds,
    asset: req.asset,
    extra: req.extra,
  };

  // 7. Verify with facilitator
  const verifyRes = await fetch(`${FACILITATOR}/verify`, {
    method: 'POST', headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ paymentPayload: v1Payload, paymentRequirements: v1Req })
  });
  const verified = await verifyRes.json();
  if (!verified.isValid) throw new Error(`Verify failed: ${verified.invalidReason}`);

  // 8. Settle with facilitator (broadcasts tx to Solana)
  const settleRes = await fetch(`${FACILITATOR}/settle`, {
    method: 'POST', headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ paymentPayload: v1Payload, paymentRequirements: v1Req })
  });
  const settled = await settleRes.json();
  if (!settled.success) throw new Error(`Settle failed: ${settled.errorReason}`);

  // 9. Poll for payment confirmation (Helius webhook marks order paid within ~60s)
  const ORDER_TIMEOUT_MS = 90_000;
  const POLL_INTERVAL_MS = 5_000;
  const deadline = Date.now() + ORDER_TIMEOUT_MS;

  console.log('Waiting for payment confirmation...');
  while (Date.now() < deadline) {
    await new Promise(r => setTimeout(r, POLL_INTERVAL_MS));
    const statusRes = await fetch(`${BASE_URL}/getPartnerOrders`, { headers });
    const { orders } = await statusRes.json();
    const thisOrder = orders.find(o => o.order_number === order.order_number);
    if (thisOrder?.status === 'Paid') {
      console.log('Order paid! ✅', settled.transaction);
      return thisOrder;
    }
    console.log('  Status:', thisOrder?.status, '— checking again...');
  }
  throw new Error('Payment timeout — USDC transferred on-chain, Helius may still be processing');
}

Key Facts for Agents

  • Registration: Instant via POST /registerAgent — no approval queue
  • Platform fee: 0% by default — agents pay no platform fee
  • Payment protocol: x402 (HTTP 402 Payment Required) — fully autonomous
  • Payment currency: USDC on Solana
  • Supported retailers: Amazon (22 country TLDs — see table above)
  • CRITICAL: Always use the Amazon TLD that matches the shipping country (e.g. .de for Germany, .co.uk for UK, .com.br for Brazil)
  • Free Prime shipping: Prime-eligible items ship free via SP3ND's Prime accounts (some surrounding regions may have standard shipping fees)
  • Shipping: 200+ countries
  • No KYC required
  • Points & Airdrop: Every order earns SP3ND points toward a potential future airdrop
  • Cart expiration: 30 minutes
  • Treasury wallet: 2nkTRv3qxk7n2eYYjFAndReVXaV7sTF3Z9pNimvp5jcp
  • USDC mint (Solana mainnet): EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
  • x402 facilitator: https://facilitator.payai.network
  • Support: support@sp3nd.shop
  • Full API docs: https://sp3nd.shop/partner-api/docs
  • Dashboard: https://sp3nd.shop/partner-api/dashboard

Alternative: Manual Payment Flow (for human partners)

If your agent cannot use x402, you can still use the manual payment flow:

  1. Call createPartnerTransaction to register the payment intent
  2. Manually send USDC to the treasury wallet with memo SP3ND Order: <order_number>
  3. SP3ND detects the payment automatically within 1 minute

See the Partner API docs for details: https://sp3nd.shop/partner-api/docs

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。