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

<Steps>
  <Step title="Agent triggers collect_payment">
    During a call, your VAPI agent calls the `collect_payment` function with the amount and caller's phone number.
  </Step>

  <Step title="Maven creates a session">
    Maven creates a payment session and returns a phone number to transfer the caller to.
  </Step>

  <Step title="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.
    </Warning>
  </Step>

  <Step title="Payment collected">
    Maven collects the card details, processes the payment, and sends a [webhook](/integrations/webhooks) with the result. The caller is optionally transferred back to your agent via the `callback` number.
  </Step>
</Steps>

## Setup

### Automatic (Dashboard)

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

<Steps>
  <Step title="Go to your app's Integrations tab">
    In the [Maven Dashboard](https://app.trymaven.com), navigate to your app and click **Integrations**.
  </Step>

  <Step title="Select VAPI">
    Enter your VAPI Private Key and Maven API key. Optionally provide a VAPI Assistant ID to auto-attach the tools.
  </Step>

  <Step title="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
  </Step>
</Steps>

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.
</Note>
