Return 402 Payment Required
AI-generatedOverview
This node integrates with the Solana x402 server to handle payment-required scenarios using Solana SOL cryptocurrency. It supports two main operations: returning an HTTP 402 Payment Required response indicating the amount of SOL needed to access a resource, and verifying a Solana payment transaction. This is useful for applications that want to gate access to premium content or services until a specified SOL payment is made, such as paywalls or premium API access.
Use Case Examples
- Return a 402 Payment Required response specifying that 0.01 SOL is needed to access a premium article.
- Verify a Solana transaction signature to confirm that a payment of 0.01 SOL was made within the last 5 minutes.
Properties
| Name | Meaning |
|---|---|
| Amount (SOL) | The amount of SOL cryptocurrency required to access the protected resource. Must be at least 0.000001 SOL. |
| Resource ID | An optional unique identifier for the protected resource, used to specify which resource requires payment. |
Output
JSON
json- The JSON response from the Solana x402 server, which varies by operation. For 'require402', it contains the HTTP 402 payment requirement details. For 'verifyPayment', it contains the verification result of the payment transaction.
Dependencies
- Requires credentials for the Solana x402 API, including network, recipient address, and optionally an RPC URL.
Troubleshooting
- Initialization failure of the x402 server due to incorrect or missing credentials. Ensure the Solana x402 API credentials are correctly configured.
- Errors during operation execution, such as invalid parameters or failed payment verification. Check the error messages returned and verify input parameters like amount, resource ID, and transaction signature.
- If 'continueOnFail' is enabled, errors for individual items will be returned in the output JSON under an 'error' property instead of stopping the node execution.
Links
- Solana Documentation - Official documentation for the Solana blockchain platform.
- x402 Server SDK - GitHub repository for the x402 server SDK used to create payment-required responses and verify payments.