INNER CODE UNIT · JavaScript
parsePaymentRequired
nirholas/XActions · packages/xactions-edge/index.js:98
function parsePaymentRequired(message) {
if (!message.includes('x402Version')) return null;
try {
const payload = JSON.parse(message);
return payload?.x402Version ? payload : null;
} catch {
return null;
}
}
/**
* Low-level Streamable HTTP client for an MCP server.
*
* Handshake happens once, lazily, on the first call and is then reused. The
* server is stateless, so there is no session to keep alive and no socket to
* reconnect: every call is one HTTP round trip.
*/
export class McpClient {