LaunaDocs
GETTING STARTED

Card payments

Accept buyers' card payments through your linked Stripe account.

Card acceptance is available as a deployment-enabled pilot. A buyer completes Stripe-hosted Checkout and receives access through your Launa gateway. The charge belongs to your connected Stripe account. You can offer cards alongside x402 or use cards alone.

Connect your account

  1. Select Sandbox or Live in the seller dashboard.
  2. Open Account → Accept card payments, then Connect Stripe. Sign in again if your session is more than 30 minutes old.
  3. Complete Stripe authorization and return to Launa. The connection must show Ready to accept cards.
  4. In your API's endpoint editor, enable Accept card payments, enter the final USD price, and choose whether to also accept x402.

The initial release supports permanent, read-only GET endpoints, prices from $0.50 to $999,999.99, and responses up to 5 MiB with a 60-second upstream deadline. Oversized, incomplete, or timed-out responses fail delivery and queue a refund. Enable this only for requests that have no side effects. Card acceptance is separate from your Launa plan billing. Connect your account independently in each environment. Stripe mode is deployment-controlled: on Launa staging, both workspace environments use Stripe sandbox. Check the Stripe sandbox banner before testing.

Configure an endpoint with the SDK

Use a build containing the card-payments feature; the currently published 0.0.7 SDK does not include these additions.

await client.endpoints.create(apiId, {
  method: "GET",
  path_pattern: "/report",
  accepts: [],
  card_payment: { enabled: true, currency: "usd", amount_minor: "100" },
});

amount_minor is an integer string in cents. Preserve a populated accepts array to also offer x402. Updating with accepts: [] clears x402; omitting it preserves existing pricing. Omit card_payment to preserve it, send null to remove it, or set enabled:false to disable it. Another payment rail must remain configured.

TypeScript exposes client.cardPayments.connection() and .list(). Python uses client.card_payments; Go uses StripeConnection and ListCardPayments. CLI supports cards connection, cards list, and endpoint --card-payment JSON. MCP adds launa_stripe_connection, launa_card_payments, and endpoint card_payment arguments. Reads need payment_accounts:read or payments:read; endpoint configuration uses endpoints:write. Linking remains interactive in the dashboard.

Open a paid endpoint in your browser

Open a card-enabled GET endpoint directly in a browser to go to Stripe Checkout. After you confirm payment, Launa returns you to the endpoint, displays the API response, and offers a download. Refreshing reuses the same purchase. Cancelling gives you a button to reopen the same checkout.

This flow requires JavaScript and cookies. The browser stores its purchase in a secure, HttpOnly cookie for up to 24 hours; no payment token appears in the URL or reaches your upstream API. Keep that browser session until the response is delivered. A different path or query is a separate purchase. Refunded and disputed purchases cannot retrieve the response again.

An endpoint can support cards and x402 together. API clients still receive HTTP 402 payment requirements, explicit x402 requests keep the x402 flow, and card SDK clients keep the checkout/status/resume flow. Browser checkout uses Launa's colors while retaining the seller's identity in Stripe.

Launa's checking, response and attention pages share the same branding and support light and dark appearance. A successful response includes a receipt and download. Refund, dispute and expired states explain why access is unavailable; a temporary failure lets you check the same purchase again. The response is displayed as text, including when the upstream returns HTML.

Test with Stripe sandbox

Confirm the Account page says Stripe sandbox before using test cards. On staging this applies to both Launa Live and Sandbox. Use a future expiration date and any three-digit CVC with these Stripe test cards:

ScenarioTest card / actionExpected result
Successful payment4242 4242 4242 4242The browser returns to the API response. Refreshing reuses its receipt and does not add a sale or delivery.
Declined payment4000 0000 0000 0002Stripe shows a decline. The checkout remains unpaid and retryable; no API response or sale is recorded.
Immediate dispute4000 0000 0000 0259Stripe creates a simulated dispute. Once reconciled, Launa shows Payment disputed and blocks further delivery.
Partial or full refundRefund the test payment in the connected seller's Stripe DashboardIncome reflects the confirmed refunded amount. Even a partial refund blocks further access.
Failed API deliveryPay a test endpoint whose upstream returns HTTP 500Launa shows Refund in progress, then Payment refunded after Stripe confirms it.

Cancellation lets you reopen the same checkout. A decline is an unsuccessful payment attempt within that checkout, so Launa can show it as pending / Not paid while Stripe allows another card. Disputes cannot recall content that was already delivered. Consult Stripe for the dispute's financial resolution; Launa reports it as disputed.

Pay for a request

import { CardCheckout } from "@launaio/sdk";

const purchase = new CardCheckout("https://gateway.example/report", {
  token: savedToken, // restore an existing purchase after a reload
});
await savePurchaseSecurely(purchase.url, purchase.token);
const state = await purchase.start();
// Show state.checkout_url as a link and let the buyer complete Stripe Checkout.
const response = await purchase.resume();
if (response.ok && response.status !== 202 && response.headers.has("Launa-Payment-Receipt")) {
  const report = await response.json();
}

savePurchaseSecurely is your application's persistence function. Persist the token before starting checkout. Reuse the same token, URL, query and headers for polling/resuming after a network error. purchase.status() only inspects the existing payment. A 202 response is a payment status, not your API's content. Do not send seller API keys/JWTs to buyer gateway URLs.

Python provides CardCheckout; Go provides the cards package. React provides CardPaymentButton with required onToken persistence and an onPaid callback. These hosted card helpers do not need a cryptocurrency wallet. The buyer explicitly chooses cards; existing x402 helpers do not automatically switch payment methods.

For a browser or React integration, add your application's exact origin under API → Configuration → Gateway CORS before calling the gateway. This includes the port for a local development page. The gateway allows the card request headers and exposes Launa-Payment-Receipt to approved origins. An ordinary navigation to hosted Checkout does not need a cross-origin fetch permission.

Agent wallets and protocol discovery

inspect url (also available as x402 inspect) displays card offers alongside any x402 requirements. The gateway advertises hosted card checkout in Launa-Card-Payment; card-only 402 responses also include card_payment in the body. This is the Launa checkout protocol, not an x402 payment scheme or an MPP challenge. Inspection does not initiate a payment.

Instructions in the unpaid response

Initial JSON 402 responses include payment_options, so an agent can see all available choices. A mixed endpoint lists cryptocurrency via x402 and cards via launa-checkout; single-method endpoints list only their configured option. The x402 PAYMENT-REQUIRED header remains authoritative for crypto terms.

Card-enabled responses also include card_payment_flow:

  • protocol: "launa-checkout" and version: 1 identify this custom flow.
  • documentation_url links to this guide.
  • request_target: "same_url" means use the original URL and query for each step.
  • operation_header: "Launa-Payment" selects checkout, status or resume.
  • token_header: "Launa-Payment-Token" carries the same securely saved token each time.
  • token_format specifies 32 random bytes encoded as unpadded base64url.
  • instructions and recovery explain buyer authorization, Checkout handoff, polling, delivery and safe retries.
  • delivery_receipt_header: "Launa-Payment-Receipt" identifies a delivered response.

Generate and securely persist the token before requesting Checkout. It is a recovery/access capability, not a payment credential or proof of payment. Obtain payment authorization, call checkout, and present checkout_url to the buyer. Use status with the same token, respecting Retry-After; once paid, call resume. HTTP 202 still means status, not the purchased API content. Keep the exact URL and relevant headers unchanged, and never expose the token in a URL or logs.

Choose one payment option. Never automatically switch to crypto or create another card payment after an uncertain result. Discovery itself creates no purchase; these instructions are omitted from payment-attempt errors and recovery responses. Older builds may lack the added fields. Existing x402 headers and body fields remain compatible, and these additions do not implement MPP.

ChatGPT Wallet can use existing checkout pages according to OpenAI's payment guidance. The Stripe Checkout path is intended for that browser flow, but an actual ChatGPT Wallet purchase has not yet been validated. A successful Stripe sandbox test-card purchase does not establish Wallet compatibility. For agent plugins, OpenAI documents a browser handoff using continue_url; direct plugin–Wallet interactions are still evolving.

MPP agent card pilot

MPP is an opt-in HTTP card path using the same seller account, card price and delivery/refund protections. Base MPP is deployed on staging and sandbox payment acceptance has been tested. It remains disabled by default in new deployments. Published SDKs and hosted tools may not contain every source addition.

MPP requires a Stripe business profile for the connected seller, in addition to Checkout readiness. Account shows separate MPP readiness. On an enabled deployment, opt in a permanent public GET endpoint using:

{
  "card_payment": {
    "enabled": true,
    "currency": "usd",
    "amount_minor": "100",
    "mpp": { "enabled": true, "buyer_auth": "none" }
  }
}

Only enable this for side-effect-free resources without buyer login, cookies or API-key authentication. General authentication-before-payment is not implemented. Keep native x402 accepts configured to offer crypto alongside cards.

An unpaid API request advertises WWW-Authenticate: Payment for stripe/charge. A compatible client obtains a buyer-approved Shared Payment Token (SPT), sends Authorization: Payment, then receives the resource and Payment-Receipt after confirmed payment and saved delivery. Discovery lists MPP, x402 and hosted Checkout separately. Browser navigation keeps the Checkout flow described above.

Use Stripe Link CLI for card-wallet approval; mppx is the first TypeScript interoperability client. Launa's CardCheckout helpers still use hosted Checkout, and launa pay is still x402-only. Updated inspect output recognizes an MPP challenge without paying. Go wire support does not supply a Stripe wallet. Link approval against a deployed Launa MPP endpoint and actual ChatGPT Wallet acceptance remain unverified.

Retain the original MPP credential securely for recovery. A 503 means reconciliation is needed: do not mint a new token or fall back to Checkout/crypto automatically. Declines must be confirmed cancelled before Launa issues a fresh challenge. The newer 3DS continuation build preserves authentication-required payments for the token issuer; older deployments cancel them. See the flow below. Refunds/disputes revoke future cached access; successful retries do not charge again.

On opted-in, ready routes, OpenAPI x-payment-info.offers describes MPP. Mixed routes preserve the older x402 discovery metadata at x-launa-x402-payment-info; native runtime x402 headers remain unchanged. Runtime challenges determine current terms.

View card income

Open Income to see card sales, confirmed refunds, unique API deliveries and recent card history. Card totals cover the last 30 days; history shows the latest 100 payment attempts across the selected workspace environment. Each payment links to its original seller Stripe account. Card income stays separate from the on-chain ledger and Launa custodial payouts; Stripe manages its fees and payouts. Search recent payments by API, purchase ID, Stripe payment ID, payment status or delivery status, and filter by Checkout or MPP. Payment details shows the full purchase ID, receiving account, Stripe mode, refund amount and delivery state. You can copy the purchase ID or open the API and original Stripe payment. These filters apply to the latest 100 attempts, not the aggregate totals. Account keeps Stripe connection setup and readiness, with a link to Income instead of a duplicate payment history.

Retry and recovery

A payment token is a secret capability. Keep it out of URLs, logs and analytics. Never generate a fresh token or fall back to another payment method while a payment is uncertain.

Checkout and unused access expire after one hour. Paid purchases that never start delivery are queued for refund. Successful results are recoverable from an encrypted cache for 24 hours without another upstream execution. Endpoint/price changes or known upstream failures prevent delivery and queue a refund. refund_pending means Stripe has not yet confirmed the refund. An execution interrupted before its result is saved requires support reconciliation; keep the purchase ID and original token rather than paying again.

Your Income page lists recent card payments. Disconnecting in Launa prevents new card delivery in the selected environment; historical purchases stay attached to the original Stripe account. Stripe authorization remains available for refunds; remove Launa in Stripe Dashboard to revoke access across all linked environments. If deauthorization removes Launa's access, resolve pending refunds in that Stripe account's Dashboard. Commerce fulfillment events for Shopify/GBO, non-GET requests, subscriptions, dynamic taxes, and card service-credit metering are later work.

Environments and reporting

Launa Live and Sandbox keep separate APIs and Stripe connections. On a staging deployment, both can be configured to use Stripe sandbox; the Account page identifies the Stripe mode. Use only test cards when it says Stripe sandbox. Linking a merchant account is independent of the Stripe account used to buy Launa settlement packages.

Overview and API analytics show card payments, sales, unique API deliveries, refunds and disputes. Card amounts are USD before Stripe fees. Sales include payments later refunded; refund amounts are shown separately. Counts come from purchases created in the selected period, not from checkout polling or cached response retries. On-chain earnings remain separately labeled. Income → Recent card payments lists the latest 100 card purchases.

Attempt counts include Checkout and MPP attempts, including unpaid ones. Checkout and MPP counts identify each entry path. MPP paid totals require confirmed payment, not just a PaymentIntent ID. Payment counts include verified payments that were later refunded or disputed; delivery counts include completed responses even when access is later revoked. Disputed amounts are not reported as refunds. These figures describe payment activity, not the seller's net Stripe balance or available payout amount.

3DS and token-issuer authentication

The feat/mpp-3ds backend/gateway adds a Launa recovery extension. It must be rolled out on both services before clients rely on it; earlier staging builds cancel authentication-required PaymentIntents.

A seller PaymentIntent created from an SPT can report requires_action with next_action.type=shared_payment_token_action. Its seller-side client secret is not a browser 3DS continuation. The wallet/agent that issued the SPT retrieves /v1/shared_payment/issued_tokens/{id} in its own Stripe account and handles next_action.use_stripe_sdk.value using Stripe.js handleNextAction({hashedValue: value}). The buyer completes the bank challenge. Launa holds no issuer credentials and never accepts a browser success flag as payment evidence. See Stripe's issuer-side next-action flow.

While authentication is pending, the original paid request returns:

{
  "type": "about:blank",
  "title": "Authenticate this payment in the wallet that issued the token",
  "status": 402,
  "code": "payment_requires_action",
  "authentication": {
    "type": "stripe_spt",
    "actor": "token_issuer",
    "expires_at": "2026-11-24T12:15:00Z"
  },
  "detail": "The token issuer must handle Stripe SPT next_action. Then retry the exact request with the original credential. Do not create another token or switch payment methods while this attempt is pending.",
  "cancel": { "header": "X-Launa-MPP-Operation", "value": "cancel" }
}

There is no fresh WWW-Authenticate challenge and no Payment-Receipt in that response. It is not a portable MPP authentication standard: clients must recognize this Launa extension, or let their wallet handle SPT authentication independently. An HTTP 402 alone is not permission to create another token. Keep the exact URL, query, relevant headers and original credential, then retry after wallet completion. Launa verifies the original PaymentIntent on the original connected account/mode; only settled payment plus saved API delivery produces a receipt.

To abandon authentication, explicitly retry the same request and credential with X-Launa-MPP-Operation: cancel. Cancellation cannot create a purchase, change the request binding or deliver the resource. Only confirmed provider cancellation can produce a new challenge. A timeout remains unresolved (503). A durable cancellation fence prevents delivery if authentication wins the race; a payment that settles after that fence is refunded through the existing engine. The server cancels a still-action-required payment after 15 minutes from purchase creation (or earlier purchase expiry), when polled or reconciled by its worker. SPT expiry can be earlier. Closing a browser window does not prove cancellation.

Neither wallet authentication nor this extension is an automatic fallback to Checkout or x402. Hosted Checkout already owns its own interactive authentication and keeps its existing token/status/resume contract.

Local card lab and acceptance checklist

The SDK repository's examples/mpp-card-lab is a local-only development page with Stripe Elements, selected test-card fixtures, saved-credential retry, provider status, partial/full refunds and a redacted wire debugger. It targets staging and rejects live Stripe keys. A separate issuer profile is required for its 3DS mode. Do not embed seller secret keys in an agent client or publish the lab server.

Test success (4242 4242 4242 4242), decline (4000 0000 0000 0002), authentication (4000 0025 0000 3155), and dispute (4000 0000 0000 0259) using sandbox only. For 3DS, exercise completion, failure, cancellation and expiry, then retry the same credential. Check that there is one charge, no delivery before settlement, one unique delivery, unchanged totals on retries, and revoked access after a partial or full refund or dispute. A failed upstream must refund the payment without executing the API again. Provider, gateway and Income results must agree.

Authentication status in the dashboard

Income shows Awaiting buyer authentication for a pending MPP bank challenge. When the server supplies an authentication deadline, the table and payment details show it. The buyer completes authentication in the issuing wallet. After the deadline, Launa displays that reconciliation is pending; expiry alone is not proof that Stripe cancelled the payment. Refresh to fetch current recorded state.

Operators have a separate Card payments screen for card configuration checks, verified Connect webhook activity and purchases needing attention. This is independent of settlement-package billing. Refunds and disputes are managed in Stripe; the seller payment links open the correct connected account and mode.

Agent-to-buyer Checkout handoff

Choose one flow and keep its purchase credentials with the client that starts it:

  • Buyer browser: give the buyer the original gateway resource URL. They open it in their own browser, which keeps the purchase cookie through Stripe and retrieves the API response after payment. Do not open checkout in an agent browser and copy that browser's Stripe link to the buyer.
  • Agent token: follow card_payment_flow with a saved purchase token and Launa-Payment: checkout. Share the returned checkout_url with the buyer. After payment, the agent calls status, then resume, using the same token, exact URL and relevant headers. Do not set Launa-Payment-Browser in this flow.

A Stripe return in a different browser cannot recover the original purchase cookie. Launa directs the buyer back to the original agent/browser without starting another purchase. Never put purchase tokens in links or chat messages.

Payment, API response retrieval, and a merchant's order or shipping status are separate. Seller Income labels response retrieval as API response; Not retrieved does not mean unpaid or undelivered merchandise. In the GBO shop, payment.status: paid with complete_in_progress means no second payment is needed. Resume with the original credential if response retrieval is pending, then poll the shop for its order ID. An empty order field is not evidence that payment failed. Payment attempts cannot be canceled as unstarted checkouts.

On this page