link-cli mpp pay to request a browser session, approve the payment in Link, and connect with Stagehand, Playwright, or Puppeteer. You don’t need a Browserbase account or API key.
Connect your Link account
Install Link CLI with Node.js:payment_methods.agentic scope, use link-cli auth upgrade with the same options to add it.
Inspect the payment challenge
Make an unauthenticated request to see the price before paying:cURL
402 Payment Required with payment challenges in the WWW-Authenticate header. Link CLI uses the challenge with method="stripe", which specifies the merchant, amount, and currency. This request doesn’t create a session or make a payment.
This example requests 250 minutes for 0.50 USD, the minimum purchase. Increase estimatedMinutes to buy more time.
Pay with Link
Runlink-cli mpp pay with the same session request:
--context explains the purchase in Link’s approval screen and must be at least 100 characters.
Open the approval URL returned by the CLI and review the amount before approving. Follow the CLI’s continuation instructions to finish the request. After approval, Link CLI retrieves a one-time Shared Payment Token and sends it to Browserbase in an MPP payment credential.
When calling the CLI from an agent, invoke the returned _next.pay_argv command and argument array directly. Set its JSON header to Content-Type: application/json, preserving capitalization, and keep the original --approved-challenge, method, and body. See Stripe’s Link CLI guide for details.
After a successful payment, Browserbase returns session details including:
sessionId for status checks and the connectUrl for browser access. Treat the connection URL as a credential: anyone with it can connect while the session is active.
Connect to the session
SetBROWSERBASE_CONNECT_URL in your environment to the connectUrl from the response. Choose a browser library, install it, and save its example as browser.mjs.
- Stagehand
- Playwright
- Puppeteer
Expected output
The script printsExample Domain.
Manage the session
SetSESSION_ID to the returned sessionId. You can check the remaining browser time without another payment:
cURL
Cleanup
When you’re finished, terminate the session:cURL
Further reading
See the Link CLI documentation for approval and Shared Payment Tokens.MPP overview
Review pricing, prerequisites, and how the payment flow works.
x402 quickstart
Create browser sessions using x402 payments.