team-telnyx/ai/telnyx-x402-payment
Claude Code and agent skill by team-telnyx/ai
- community
Checking that the SKILL.md file is still in the repository.
Make cryptocurrency payments to fund a Telnyx account using the x402 protocol (USDC on Base). Covers quoting, EIP-712 signing, and settlement.
Install
npx vskill@latest install team-telnyx/ai/telnyx-x402-paymentSKILL.md
The same SKILL.md was published earlier as majiayu000/claude-skill-registry/telnyx-x402-payment.
Telnyx x402 Cryptocurrency Payment
Fund a Telnyx account with USDC on the Base blockchain using the x402 payment protocol. The flow has three steps: get a quote, sign the payment client-side, and submit for settlement.
Feature Flag: x402 payments are gated behind theX402_PAYMENTS_ENABLEDfeature flag. If not enabled for the account, the API returns403 Forbidden.
Prerequisites
- Telnyx API key (
TELNYX_API_KEY) - Crypto wallet with USDC on Base network (chain ID:
eip155:8453) - USDC contract on Base:
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Environment Variables
| Variable | Required | Description | |
|---|---|---|---|
TELNYX_API_KEY | Yes | Telnyx API v2 key |
Step 1: Get a Quote
Request a quote for the USD amount to fund. Per-payment minimum and maximum limits apply; they are configurable and may change, and the API's 422 error messages state the current values. Quotes expire after 5 minutes.
Response:
Quote Response Fields
| Field | Description | |
|---|---|---|
id | Quote identifier (use in submission) | |
record_type | Always "quote" | |
amount_usd | Requested USD amount | |
amount_crypto | USDC amount in smallest unit (6 decimals: $50.00 → "50000000") | |
network | CAIP-2 network identifier (e.g. "eip155:8453") | |
expires_at | ISO 8601 quote expiry (5 minutes from creation) | |
payment_requirements | x402 V2 payment requirements (see below) |
Payment Requirements (x402 V2)
The payment_requirements object follows the x402 protocol V2 structure:
- `x402Version` — Protocol version (
2) - `resource` — The resource being paid for:
url— Canonical resource URL (included in the payment signature)description— Human-readable descriptionmimeType— Response content type- `accepts` — Array of accepted payment methods, each containing:
scheme— Payment scheme ("exact"for fixed-amount transfers)network— CAIP-2 network (e.g."eip155:8453")amount— Amount in token smallest unitsasset— Token contract addresspayTo— Recipient wallet addressmaxTimeoutSeconds— Maximum time before quote expiresextra— Additional metadata:quoteId,facilitatorUrl, and EIP-712 domain fieldsnameandversion. Note:chainIdis derived fromnetwork(e.g.,eip155:8453→8453) andverifyingContractis the same asasset
Step 2: Sign the Payment (Client-Side)
The user must sign an EIP-712 typed data message authorizing a USDC transferWithAuthorization (EIP-3009). This is done client-side using ethers.js, viem, or any EIP-712 signing library.
⚠️ Security: Never hardcode private keys in source code or commit them to version control. Use environment variables, a hardware wallet, or a secure key management service.
Required inputs:
- Payer wallet's private key
- Quote details from
payment_requirements.accepts[0]:payTo,amount, and the EIP-712 domain fromextra - A random 32-byte nonce
- Validity period (current time → quote expiry)
EIP-712 domain (assembled from multiple sources):
Important: Onlynameandversionare provided in the quote response (accepts[0].extra). The client must derive the remaining EIP-712 domain fields:- `chainId`: Parse from the CAIP-2 network string inaccepts[0].network(e.g.,"eip155:8453"→8453)- `verifyingContract`: Same asaccepts[0].asset— the USDC token contract addressThese are not included in the quote response; they are derived from other fields inaccepts[0].
EIP-712 types (TransferWithAuthorization):
The signing produces a signature (r, s, v) that authorizes the USDC transfer without requiring an on-chain transaction from the user.
This step cannot be done with curl alone — it requires a crypto signing library. Guide the user to use ethers.js, viem, or a similar tool.
Building the payment_signature Payload
After signing, you must construct the payment payload JSON and base64-encode it.
⚠️ Critical: The PaymentPayload v2 has THREE top-level keys:x402Version,accepted, andpayload. Thepayload(signature + authorization) is a top-level sibling ofaccepted, NOT nested inside it.
PaymentPayload v2 structure:
Correct v2 format (complete example with realistic values):
Note: Theresourcefield is optional per the@x402/coreschema, but the working e2e implementation includes it. It describes the API endpoint being paid for.
Full Flow: Quote → PaymentPayload → Submit
1. You receive a quote response (from Step 1):
2. You construct the PaymentPayload:
`accepted` — Copy payment_requirements.accepts[0] from your quote response exactly as the accepted value. Do not modify or omit any fields.
`payload` — Constructed by the client:
| PaymentPayload field | Source | |
|---|---|---|
payload.signature | Your EIP-712 signature (0x-prefixed) | |
payload.authorization.from | Your wallet address | |
payload.authorization.to | Same as accepted.payTo | |
payload.authorization.value | Same as accepted.amount | |
payload.authorization.validAfter | "0" (immediate) | |
payload.authorization.validBefore | Unix timestamp (quote expiry) | |
payload.authorization.nonce | Random 32-byte hex (0x-prefixed) |
`resource` (optional) — The working e2e implementation includes a top-level resource object describing the API endpoint being paid for. The @x402/core schema considers this optional, but including it is recommended.
3. Base64-encode and submit:
Step 3: Submit the Payment
Request Body
POST /v2/x402/credit_account
The request body is a JSON object with exactly two required fields:
| Field | Type | Required | Description | |
|---|---|---|---|---|
id | string | Yes | The quote ID returned from the quote endpoint. Format: quote_<uuid> (e.g. quote_78ab4393-b7c1-4949-a6df-9ffa56642252) | |
payment_signature | string | Yes | Base64-encoded JSON string of the PaymentPayload v2 structure (see Building the `payment_signature` Payload above) |
Both fields are required. The id must reference a valid, unexpired quote. The payment_signature must be the entire PaymentPayload v2 JSON (with the accepted wrapper), base64-encoded.
Complete Example
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/telnyx-x402-payment/SKILL.md
Popularity
- Repository stars
- 219
- Repository forks
- 21
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/team-telnyx/ai/telnyx-x402-payment)