feat(agentflow): add x402 paid HTTP node for Pyrimid-compatible APIs#6377
feat(agentflow): add x402 paid HTTP node for Pyrimid-compatible APIs#6377darshankumar97 wants to merge 2 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'X402PaidApi' node for Agentflow, enabling HTTP requests with automated x402 USDC payment settlement. The changes include the addition of the new node, a corresponding credential type, necessary package dependencies, and UI icon updates. The reviewer provided actionable feedback suggesting the use of loose equality (== null / != null) for nullish checks throughout the new node implementation to improve code consistency and readability.
| if (h?.key && h.value !== undefined && h.value !== null) { | ||
| requestHeaders[h.key] = String(h.value) | ||
| } |
There was a problem hiding this comment.
For improved readability and consistency with the project's coding standards, it's better to use != null for checking against both null and undefined.
if (h?.key && h.value != null) {
requestHeaders[h.key] = String(h.value)
}References
- In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.
| if (p?.key && p.value !== undefined && p.value !== null) { | ||
| params.append(p.key, String(p.value)) | ||
| } |
There was a problem hiding this comment.
For improved readability and consistency with the project's coding standards, it's better to use != null for checking against both null and undefined.
if (p?.key && p.value != null) {
params.append(p.key, String(p.value))
}References
- In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.
| } | ||
| client.onBeforePaymentCreation(async (ctx: { selectedRequirements: { amount?: string | number } }) => { | ||
| const raw = ctx?.selectedRequirements?.amount | ||
| if (raw === undefined || raw === null) return undefined |
There was a problem hiding this comment.
For improved readability and consistency with the project's coding standards, it's better to use == null for checking against both null and undefined.
| if (raw === undefined || raw === null) return undefined | |
| if (raw == null) return undefined |
References
- In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.
| if (maybe !== undefined && maybe !== null) { | ||
| amountPaidAtomic = String(maybe) | ||
| } |
There was a problem hiding this comment.
For improved readability and consistency with the project's coding standards, it's better to use != null for checking against both null and undefined.
| if (maybe !== undefined && maybe !== null) { | |
| amountPaidAtomic = String(maybe) | |
| } | |
| if (maybe != null) { | |
| amountPaidAtomic = String(maybe) | |
| } |
References
- In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.
… node Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed the requested nullish-check style changes and pushed the updates. Thanks for the review! |
Summary
Adds a new Agent Flow node: HTTP (x402 / Pyrimid) for handling paid x402-compatible API requests inside Flowise.
This implementation enables:
Tested against live Pyrimid paid endpoints.
Closes #6367
What Changed
Added new credential
x402EvmWalletAdded new Agent Flow node
HTTP (x402 / Pyrimid)Added dependencies
@x402/axios@x402/evmviemTesting Performed
Test endpoint used:
Observed behavior:
payment_requiredwhen wallet lacks sufficient Base USDC balanceThis validates:
Screenshots
screenshots :


Note: Full payment completion requires a wallet funded with Base USDC. Current testing validates the 402 detection, settlement attempt, and retry integration flow.