diff --git a/packages/atxp-client/package.json b/packages/atxp-client/package.json index 1025892..69895ba 100644 --- a/packages/atxp-client/package.json +++ b/packages/atxp-client/package.json @@ -1,6 +1,6 @@ { "name": "@atxp/client", - "version": "0.11.12", + "version": "0.11.10", "description": "ATXP Client - MCP client with OAuth authentication and payment processing", "license": "MIT", "repository": { @@ -33,8 +33,8 @@ "pack:dry": "npm pack --dry-run" }, "dependencies": { - "@atxp/common": "0.11.11", - "@atxp/mpp": "0.11.11", + "@atxp/common": "0.11.10", + "@atxp/mpp": "0.11.10", "@modelcontextprotocol/sdk": "^1.15.0", "@x402/core": "^2.9.0", "@x402/evm": "^2.9.0", diff --git a/packages/atxp-client/src/atxpAccountHandler.ts b/packages/atxp-client/src/atxpAccountHandler.ts index 8311ffc..0fada9f 100644 --- a/packages/atxp-client/src/atxpAccountHandler.ts +++ b/packages/atxp-client/src/atxpAccountHandler.ts @@ -76,6 +76,7 @@ export class ATXPAccountHandler implements ProtocolHandler { paymentRequirements: authorizeParams.paymentRequirements, challenge: authorizeParams.challenge, challenges: authorizeParams.challenges as unknown[] | undefined, + paymentRequestId: typeof challengeData.paymentRequestId === 'string' ? challengeData.paymentRequestId : undefined, }); } catch (error) { logger.error(`ATXPAccountHandler: authorize failed: ${error instanceof Error ? error.message : String(error)}`); diff --git a/packages/atxp-client/src/x402ProtocolHandler.ts b/packages/atxp-client/src/x402ProtocolHandler.ts index df24e08..4870855 100644 --- a/packages/atxp-client/src/x402ProtocolHandler.ts +++ b/packages/atxp-client/src/x402ProtocolHandler.ts @@ -149,6 +149,7 @@ export class X402ProtocolHandler implements ProtocolHandler { protocols: ['x402'], destination: url, paymentRequirements: enrichedRequirements, + paymentRequestId: paymentChallenge.paymentRequestId, }); const paymentHeader = authorizeResult.credential; diff --git a/packages/atxp-common/src/atxpAccount.ts b/packages/atxp-common/src/atxpAccount.ts index ca92299..bcb892e 100644 --- a/packages/atxp-common/src/atxpAccount.ts +++ b/packages/atxp-common/src/atxpAccount.ts @@ -339,6 +339,8 @@ export class ATXPAccount implements Account { body.currency = 'USDC'; // X402 fields if (params.paymentRequirements) body.paymentRequirements = params.paymentRequirements; + // Phase 6: lets accounts key the X402 cap reservation to the challenge so it releases on settle. + if (params.paymentRequestId) body.paymentRequestId = params.paymentRequestId; // MPP fields if (params.challenges) body.challenges = params.challenges; if (params.challenge) body.challenge = params.challenge; diff --git a/packages/atxp-common/src/types.ts b/packages/atxp-common/src/types.ts index 4ef5767..d007a6f 100644 --- a/packages/atxp-common/src/types.ts +++ b/packages/atxp-common/src/types.ts @@ -208,6 +208,11 @@ export interface AuthorizeParams { challenge?: unknown; /** MPP: array of challenges from multi-chain omni-challenge (preferred) */ challenges?: unknown[]; + /** + * The challenge's payment-request id. Threaded to accounts at authorize so it can key the + * X402 binding cap reservation (upto sessions) to it and release it on settle (Phase 6). + */ + paymentRequestId?: string; } export interface AuthorizeResult {