Documentation Index
Fetch the complete documentation index at: https://docs.trymaven.com/llms.txt
Use this file to discover all available pages before exploring further.
Set up your project
If you haven’t already: create an account, create an app, connect a gateway, and grab a test API key (
mvn_test_*). Same setup as voice — gateway connections and API keys are shared.Customize the widget (optional)
Open your app → Chat Payments tab in the dashboard. Set your colors, labels, and which fields to show (cardholder name, billing ZIP). Hit Save.These settings apply automatically to every session from this project. You can still override per-session via the API, but most merchants just set it once.
Server — create a session
When your chatbot is ready to collect payment, your backend calls:Response:Hand the
session_id to your frontend — via WebSocket message, HTTP response, whatever your chatbot uses.Frontend — load the SDK once
Add this once to your page, ideally before your chatbot renders:This exposes a global
Maven object with one method: createPayment().Frontend — mount the widget when ready
When your chatbot receives the The iframe appears inline. Customer types their card, hits pay. Your callbacks fire —
session_id, mount the widget into a <div> inside the chat message:onSuccess and onFailure are hooks into your app so you can continue the chatbot conversation, update your database, or redirect the customer. The widget itself handles the card form, charging, and the success/failure UI inside the iframe.Handle webhook (recommended)
Configure a webhook URL on the project. Maven fires the same
payment-success / payment-failed event for widget payments as it does for voice — with an additional source: "chat" field.See Webhooks for the full payload.Common errors
POST /v1/widget-sessions can return these if something’s off in your setup:
| Status | Code | What it means | Fix |
|---|---|---|---|
401 | — | Bad or missing API key | Check the Authorization: Bearer mvn_test_... header |
404 | project_not_found | Project slug doesn’t exist in your org | Double-check the project value matches a slug in your dashboard |
422 | gateway_not_connected | Gateway isn’t connected for this env | Connect the gateway in the dashboard (Gateways tab). Test keys need test credentials; live keys need live credentials. |
422 | invalid_amount | amount_cents is 0 or negative in charge mode | Pass amount_cents > 0, or use mode: "tokenize" to save a card without charging |
429 | — | Rate limited | Back off; defaults are 20 session creates/minute per IP |
Maven is not defined — that means the <script src="…"> tag didn’t load. Hard-refresh and check the URL is reachable.
Test cards
Use these with yourmvn_test_* key against a gateway in sandbox mode:
| Outcome | Number | CVV | Expiry |
|---|---|---|---|
| Success | 4242 4242 4242 4242 | Any 3 digits | Any future date |
| Declined | 4000 0000 0000 0002 | Any 3 digits | Any future date |
| Amex | 3782 822463 10005 | Any 4 digits | Any future date |
Full example — vanilla JS chatbot
Next
SDK Reference
Complete options, callbacks, and controller methods.
Customization
Theme, labels, fields, and sizing options.
