Skip to main content
1

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.
2

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.
3

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.
4

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().
5

Frontend — mount the widget when ready

When your chatbot receives the session_id, mount the widget into a <div> inside the chat message:
The iframe appears inline. Customer types their card, hits pay. Your callbacks fire — 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.
6

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: If the widget mounts but doesn’t render, check your browser console. The usual culprit is 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 your mvn_test_* key against a gateway in sandbox mode:

Full example — vanilla JS chatbot

Next

SDK Reference

Complete options, callbacks, and controller methods.

Customization

Theme, labels, fields, and sizing options.