AgnicWallet X402 Request
Make HTTP requests to X402-enabled APIs with automatic payment via AgnicWallet
Overview
This node makes HTTP requests to X402-enabled APIs with automatic payment handling via AgnicWallet. It supports OAuth2 or API Key authentication and can perform GET, POST, PUT, and DELETE requests. When the API responds with a 402 Payment Required status, the node automatically processes the payment through AgnicWallet and retries the request with the payment header. This is useful for integrating with APIs that require payment on demand, such as pay-per-use services or metered APIs.
Use Case Examples
- Automatically pay and access a metered API endpoint that requires payment before data retrieval.
- Use OAuth2 or API Key authentication to securely connect and make requests to X402-enabled APIs.
- Send JSON bodies with POST or PUT requests and handle payment-required responses seamlessly.
Properties
| Name | Meaning |
|---|---|
| Authentication | How to authenticate with AgnicWallet, either via OAuth2 or API Key. |
| Method | The HTTP method to use for the request (GET, POST, PUT, DELETE). |
| URL | The URL of the X402-enabled API endpoint to which the request is sent. |
| Headers | Additional HTTP headers to send with the request, specified as name-value pairs. |
| Body | JSON body to send with the request, applicable only for POST and PUT methods. |
Output
JSON
json_agnicWallet
*paymentMade- Boolean indicating if a payment was made during the request process.
*amountPaid- The amount paid for the request if a payment was required.
*timestamp- Timestamp of when the payment was made.
Dependencies
- Requires credentials for AgnicWallet OAuth2 or API Key authentication to authorize requests and sign payments.
Troubleshooting
- Common issues include invalid or expired authentication tokens, which will cause authentication failures.
- If the API returns a 402 Payment Required status, the node attempts to sign the payment automatically; failure in this step will throw an error indicating payment signing failure.
- Malformed JSON in the Body property for POST or PUT requests can cause request failures; ensure valid JSON format.
- Non-JSON responses are handled but logged as warnings; unexpected response formats may require manual handling.
Links
- AgnicWallet X402 API Documentation - Official documentation for the X402-enabled API and payment integration.