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

# VAPI

> Integrate Maven voice payments with your VAPI agent

# VAPI Integration

Add PCI-compliant voice payments to your VAPI agent. When your agent needs to collect a payment, it calls Maven to create a session and transfers the caller to Maven's secure payment line.

## How It Works

**1. Agent triggers collect\_payment**

During a call, your VAPI agent calls the `collect_payment` function with the amount and caller's phone number.

**2. Maven creates a session**

Maven creates a payment session and returns a phone number to transfer the caller to.

**3. Agent transfers the caller**

Your agent uses the `transfer_to_payment` tool to transfer the caller to Maven's secure payment line.

> [!WARNING]
>
> **Use your own phone number, not a VAPI phone number.** VAPI originates transfers from its own number — not the caller's. Maven matches sessions by caller ID, so the transfer must come from the customer's number. Configure your VAPI agent with your own phone number (e.g. Twilio, Vonage, or Telnyx) to preserve the caller ID.

**4. Payment collected**

Maven collects the card details, processes the payment, and sends a [webhook](https://docs.trymaven.com/integrations/webhooks.md) with the result. The caller is optionally transferred back to your agent via the `callback` number.

## Setup

### Automatic (Dashboard)

The easiest way to set up is from the Maven Dashboard:

**1. Go to your app's Integrations tab**

In the [Maven Dashboard](https://app.trymaven.com), navigate to your app and click **Integrations**.

**2. Select VAPI**

Enter your VAPI Private Key and Maven API key. Optionally provide a VAPI Assistant ID to auto-attach the tools.

**3. Click Connect**

Maven creates the following tools in your VAPI account:

* `collect_payment` — creates a payment session
* `transfer_to_payment` — transfers the caller to Maven's payment line
* `get_session` — looks up a session by phone number
* `cancel_session` — cancels a pending session

Your VAPI Private Key is used once to create the tools and is never stored.

### Manual (Webhook URL)

If you prefer to configure the tools yourself, use a webhook URL:

```
https://api.trymaven.com/integrations/vapi/webhook?token=YOUR_TOKEN
```

Generate a webhook token from the dashboard or via the API. The token encodes your API key, project, gateway, and mode so they don't need to be passed as query parameters.

> [!NOTE]
>
> VAPI sends payloads in multiple formats (tool-calls, function-call, and API request). Maven auto-detects the format and handles all three.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.