> This page is for MVS Pay.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mvscloud.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mvscloud.com/_mcp/server.

# Create a payment

POST https://pay.mvscloud.com/api/transfers
Content-Type: application/json

Mints a Hyperswitch payment_intent and returns the `client_secret` the browser SDK confirms with the card.

**Trust model (ADR-010):** the organization is resolved from a VERIFIED context, never the body. On a tenant host (`acme.mvspay.io`) the public checkout path is used with **no** API key; off a tenant host, the `x-api-key` path (`transactions:write`) applies. A `metadata.organization_id` that disagrees with the verified org is rejected (403). Public promotion of this endpoint is gated on the §6 anti-automation controls in the platform plan.

Reference: https://docs.mvscloud.com/mvs-pay/api/payments/create-payment

## Authentication

- `x-api-key` header (required) — A scoped MvsPayApiKey, e.g. `mvspay_live_…`. Mint and scope keys from the dashboard (Settings → API Keys).

## Request

### Body (application/json)

This endpoint expects a PaymentCreateRequest.

- `amount` (integer, required) — Minor units (cents).
- `currency` (string, required, default: USD)
- `confirm` (boolean, optional) — false → intent only (browser confirms); true → server confirm.
- `capture_method` (enum, optional)
  - Allowed values: `automatic`, `manual`
- `customer_id` (string, optional)
- `description` (string, optional)
- `payment_method` (string, optional) — A saved payment-method id (saved-card flow).
- `payment_method_data` (map from string to any, optional) — Tokenized fresh-card data, e.g. \{ token }.
- `return_url` (string, optional)
- `surcharge_amount` (integer, optional)
- `convenience_amount` (integer, optional)
- `tip_amount` (integer, optional)
- `healthcare_clinic_amount` (integer, optional)
- `invoice_reference_number` (string, optional)
- `metadata` (map from string to any, optional) — A metadata.organization_id, if present, must match the verified tenant org.

## Response

### 200

The created payment_intent (loosely typed; extra Hyperswitch fields pass through).

- `payment_id` (string, required)
- `status` (string, required) — e.g. requires_payment_method, requires_confirmation, succeeded, processing, cancelled.
- `amount` (integer, required) — Minor units (cents).
- `currency` (string, required)
- `client_secret` (string, optional) — Mounted by the browser SDK to confirm with the card.
- `merchant_id` (string, optional)
- `connector` (string, optional) — Connector chosen by Hyperswitch (may be null).
- `metadata` (map from string to any, optional) — Includes server-stamped mvs_org_id / mvs_org_slug.

## Errors

### 400 Bad Request Error

Invalid request (e.g. malformed JSON, missing required field, amount below minimum).

- `error` (ErrorResponseError, required)

### 403 Forbidden Error

The key lacks the required scope, or the body references a different organization.

- `error` (ErrorResponseError, required)

### 404 Not Found Error

Unknown tenant.

- `error` (ErrorResponseError, required)

### 502 Bad Gateway Error

The payments engine (Hyperswitch/connector) returned an error.

- `error` (ErrorResponseError, required)

## Types

### ErrorResponseError

- `code` (string, required) — e.g. UNAUTHORIZED, FORBIDDEN, ERROR.
- `message` (string, required)
- `details` (map from string to any, optional)

## Examples

**Request**

```json
{
  "amount": 2500,
  "currency": "USD",
  "confirm": false,
  "description": "Invoice #1042",
  "surcharge_amount": 75,
  "metadata": {
    "invoice_reference": "1042"
  }
}
```

**Response**

```json
{
  "payment_id": "string",
  "status": "string",
  "amount": 1,
  "currency": "string",
  "client_secret": "string",
  "merchant_id": "string",
  "connector": "string",
  "metadata": {}
}
```

**SDK Code**

```python Payments_createPayment_example
import requests

url = "https://pay.mvscloud.com/api/transfers"

payload = {
    "amount": 2500,
    "currency": "USD",
    "confirm": False,
    "description": "Invoice #1042",
    "surcharge_amount": 75,
    "metadata": { "invoice_reference": "1042" }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Payments_createPayment_example
const url = 'https://pay.mvscloud.com/api/transfers';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"amount":2500,"currency":"USD","confirm":false,"description":"Invoice #1042","surcharge_amount":75,"metadata":{"invoice_reference":"1042"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Payments_createPayment_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://pay.mvscloud.com/api/transfers"

	payload := strings.NewReader("{\n  \"amount\": 2500,\n  \"currency\": \"USD\",\n  \"confirm\": false,\n  \"description\": \"Invoice #1042\",\n  \"surcharge_amount\": 75,\n  \"metadata\": {\n    \"invoice_reference\": \"1042\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Payments_createPayment_example
require 'uri'
require 'net/http'

url = URI("https://pay.mvscloud.com/api/transfers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": 2500,\n  \"currency\": \"USD\",\n  \"confirm\": false,\n  \"description\": \"Invoice #1042\",\n  \"surcharge_amount\": 75,\n  \"metadata\": {\n    \"invoice_reference\": \"1042\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Payments_createPayment_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://pay.mvscloud.com/api/transfers")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": 2500,\n  \"currency\": \"USD\",\n  \"confirm\": false,\n  \"description\": \"Invoice #1042\",\n  \"surcharge_amount\": 75,\n  \"metadata\": {\n    \"invoice_reference\": \"1042\"\n  }\n}")
  .asString();
```

```php Payments_createPayment_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://pay.mvscloud.com/api/transfers', [
  'body' => '{
  "amount": 2500,
  "currency": "USD",
  "confirm": false,
  "description": "Invoice #1042",
  "surcharge_amount": 75,
  "metadata": {
    "invoice_reference": "1042"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Payments_createPayment_example
using RestSharp;

var client = new RestClient("https://pay.mvscloud.com/api/transfers");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": 2500,\n  \"currency\": \"USD\",\n  \"confirm\": false,\n  \"description\": \"Invoice #1042\",\n  \"surcharge_amount\": 75,\n  \"metadata\": {\n    \"invoice_reference\": \"1042\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Payments_createPayment_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": 2500,
  "currency": "USD",
  "confirm": false,
  "description": "Invoice #1042",
  "surcharge_amount": 75,
  "metadata": ["invoice_reference": "1042"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://pay.mvscloud.com/api/transfers")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```