Solana x402 Client icon

Solana x402 Client

Make SOL payments in response to HTTP 402 errors

Parse 402 Response

AI-generated

Overview

This node, named Solana x402 Client, is designed to handle payment operations related to HTTP 402 Payment Required responses specifically for the Solana blockchain. It supports parsing payment requirements from a 402 response, making SOL payments based on parsed or manual input, and a combined operation to parse and immediately pay. This node is useful in scenarios where automated handling of payment requests from services requiring SOL payments is needed, such as subscription services or APIs that enforce payment via Solana transactions.

Use Case Examples

  1. Automatically parse a 402 response to extract payment details for user review.
  2. Make a SOL payment to a specified recipient with a given amount and optional payment ID.
  3. Parse a 402 response and immediately execute the payment in one step, streamlining the payment process.

Properties

Name Meaning
402 Response Body The JSON body of the HTTP 402 response containing payment requirements to be parsed.

Output

JSON

  • parsed - Indicates that the 402 response was successfully parsed.
  • paymentDetails - Details of the payment requirements extracted from the 402 response.
  • success - Indicates that the payment was successfully made.
  • signature - The transaction signature of the SOL payment on the Solana blockchain.
  • amount - The amount of SOL sent in the payment.
  • recipient - The Solana address that received the payment.
  • timestamp - The timestamp when the payment transaction was executed.
  • explorerUrl - URL to view the transaction on the Solana blockchain explorer.
  • error - Error message if the operation failed and continueOnFail is enabled.

Dependencies

  • solanaX402ClientApi credential for network and private key access
  • x402-client-sdk for parsing and payment execution
  • @solana/web3.js for Solana blockchain interactions
  • bs58 for decoding base58 encoded private keys

Troubleshooting

  • Invalid private key format error: Ensure the private key is base58 encoded as required by the node.
  • Payment failures: Verify network settings and recipient address correctness.
  • Parsing errors: Confirm the 402 response body JSON is correctly formatted and contains valid payment requirements.
  • If continueOnFail is enabled, errors will be returned in the output JSON under the 'error' key for each failed item.

Links

Discussion