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

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

Creates a billing customer for the authenticated organization via the MVS Pay client (which also provisions the underlying Hyperswitch customer identity). Pass an `Idempotency-Key` header to make retries safe. The response is the created customer object as returned by the MVS Pay client (loosely typed; extra fields pass through).

Reference: https://docs.mvscloud.com/mvs-pay/api/customers/create-customer

## Authentication

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

## Request

### Headers

- `Idempotency-Key` (string, optional) — Client-supplied idempotency key for safe retries.

### Body (application/json)

This endpoint expects a CustomerCreateRequest.

- `email` (string, optional) — Customer email.
- `name` (string, optional) — Customer full name.
- `phone` (string, optional) — Customer phone number.

## Response

### 200

The created customer.

- `id` (string, optional) — The org-scoped billing customer id.
- `email` (string, optional, nullable)
- `name` (string, optional, nullable)
- `phone` (string, optional, nullable)

## Errors

### 400 Bad Request Error

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

- `error` (ErrorResponseError, required)

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (ErrorResponseError, required)

### 403 Forbidden Error

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

- `error` (ErrorResponseError, required)

### 500 Internal Server Error

Unexpected server error.

- `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
{
  "email": "jane.roe@example.com",
  "name": "Jane Roe",
  "phone": "+15555550123"
}
```

**Response**

```json
{
  "id": "bcus_01H8sample123",
  "email": "jane.roe@example.com",
  "name": "Jane Roe",
  "phone": "+15555550123"
}
```

**SDK Code**

```python Customers_createCustomer_example
import requests

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

payload = {
    "email": "jane.roe@example.com",
    "name": "Jane Roe",
    "phone": "+15555550123"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Customers_createCustomer_example
const url = 'https://pay.mvscloud.com/api/customers';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"email":"jane.roe@example.com","name":"Jane Roe","phone":"+15555550123"}'
};

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

```go Customers_createCustomer_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"email\": \"jane.roe@example.com\",\n  \"name\": \"Jane Roe\",\n  \"phone\": \"+15555550123\"\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 Customers_createCustomer_example
require 'uri'
require 'net/http'

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

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  \"email\": \"jane.roe@example.com\",\n  \"name\": \"Jane Roe\",\n  \"phone\": \"+15555550123\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://pay.mvscloud.com/api/customers")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"jane.roe@example.com\",\n  \"name\": \"Jane Roe\",\n  \"phone\": \"+15555550123\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://pay.mvscloud.com/api/customers', [
  'body' => '{
  "email": "jane.roe@example.com",
  "name": "Jane Roe",
  "phone": "+15555550123"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Customers_createCustomer_example
using RestSharp;

var client = new RestClient("https://pay.mvscloud.com/api/customers");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"email\": \"jane.roe@example.com\",\n  \"name\": \"Jane Roe\",\n  \"phone\": \"+15555550123\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Customers_createCustomer_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "email": "jane.roe@example.com",
  "name": "Jane Roe",
  "phone": "+15555550123"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://pay.mvscloud.com/api/customers")! 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()
```