Overview
The "Nevermined Payments" node integrates with the Nevermined platform to manage AI-related payments, subscriptions, and access control through credit plans. Specifically, the Redeem Credits operation allows users to redeem a specified number of credits from an existing plan, optionally providing proof data such as transaction hashes or verification codes.
This node is beneficial in scenarios where AI services or APIs are monetized via credit-based plans. For example, an AI service provider can use this node to deduct credits when a user consumes API calls or accesses premium features, ensuring proper billing and usage tracking.
Practical example:
- A developer running an AI chatbot service wants to charge users based on usage. When a user sends a message, the system redeems one credit from their subscription plan using this node, optionally attaching proof of the transaction for audit purposes.
Properties
| Name | Meaning |
|---|---|
| Plan ID | The unique identifier of the credit plan from which credits will be redeemed. |
| Amount | The number of credits to redeem. Must be a positive whole number and cannot exceed available credits. |
| Proof | Optional JSON object containing proof or verification data for the redemption (e.g., transaction hash, signature, timestamp). |
Output
The output JSON contains detailed information about the redemption attempt:
redemptionId: Unique identifier for the redemption event.status:"completed"if successful,"failed"otherwise.timestamp: ISO string of when the redemption was processed.planId: The ID of the plan used for redemption.redemption: Object detailing:requestedAmount: Number of credits requested to redeem.redeemedAmount: Number of credits actually redeemed (may be less if failed).remainingBalance: Remaining credits after redemption.
- If successful:
success: Contains a message confirming the number of credits redeemed and remaining credits.
- If failed:
error: Contains error message and reason (e.g., insufficient credits or invalid proof).
environment: Indicates whether the request was made against production or test environment.message: Human-readable summary of the redemption result.
No binary data is output by this operation.
Dependencies
- Requires an API key credential for authenticating requests to the Nevermined Payments API.
- The node makes HTTP requests to the Nevermined API endpoints, which differ based on environment (production or test).
- Proper configuration of the API base URLs and credentials is necessary.
- The node depends on n8n's HTTP request helper for making authenticated API calls.
Troubleshooting
- Missing API Key: The node throws an error if no API key is provided. Ensure the API key credential is configured correctly.
- Invalid Plan ID: Redeeming credits requires a valid plan ID; missing or incorrect IDs cause errors.
- Invalid Amount: Amount must be a positive integer. Non-integer or zero/negative values trigger validation errors.
- Invalid Proof JSON: If proof data is provided, it must be valid JSON. Malformed JSON causes parsing errors.
- Insufficient Credits: Redemption may fail if the plan does not have enough credits remaining. The error message will indicate this.
- API Errors: Unexpected API responses or status codes other than 200/201 result in errors with messages from the API response.
- Ethereum Address Format: Although not directly relevant to redeeming credits, other operations validate Ethereum addresses starting with "0x". Similar care should be taken when entering related fields.
To resolve issues:
- Verify all required fields are correctly filled.
- Check that the API key has appropriate permissions.
- Confirm the plan ID exists and has sufficient credits.
- Validate any JSON input fields before execution.
- Review the error messages returned for specific guidance.
Links and References
- Nevermined Documentation - Official docs for API and payment plans.
- Nevermined API Reference - Details on endpoints used by the node.
- n8n HTTP Request Node - For understanding how HTTP requests are handled internally.