Marketplace Gateway API

Call the same HTTPS endpoint the MCP server uses to invoke marketplace services without wiring up crypto on the client side.

Endpoint

POST https://us-central1-x402-nova.cloudfunctions.net/callMarketplaceService

Headers

  • Content-Type: application/json
  • X-Marketplace-Api-Key: mkp_live_xxx

Request Body

{
  "serviceId": "route-or-remote-id",
  "path": "/v1/generate",
  "method": "POST",
  "headers": { "content-type": "application/json" },
  "body": { "prompt": "script for a 30s video" }
}
  • serviceId — Native route IDs or linked remote service IDs from Discover.
  • path / method / headers / body — Forwarded once payment clears.

Response

JSON structure includes status, forwarded headers/body, and remainingCreditsUsd plus the raw downstream payload. HTTP 4xx/5xx bubble up if the upstream service fails; HTTP 409 indicates the subscriber's credits or Stripe subscription need attention.

{
  "serviceId": "demo-route",
  "status": 200,
  "ok": true,
  "body": { "message": "success" },
  "remainingCreditsUsd": 18.75
}

When to Use

  • Embedding the marketplace in a backend service or cron job.
  • Agent runtimes that don't yet support MCP.
  • Direct REST integrations that still want the autopay wallet experience.