Create a Customer
curl --request POST \
--url https://api.viarosandbox.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"description": "<string>",
"metadata": {}
}
'import requests
url = "https://api.viarosandbox.com/v1/customers"
payload = {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"description": "<string>",
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
email: '<string>',
phone: '<string>',
description: '<string>',
metadata: {}
})
};
fetch('https://api.viarosandbox.com/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.viarosandbox.com/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'description' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.viarosandbox.com/v1/customers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.viarosandbox.com/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.viarosandbox.com/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_bodyCustomers
Create a Customer
Creates a new customer object to track payments, payment methods, and subscriptions.
POST
/
customers
Create a Customer
curl --request POST \
--url https://api.viarosandbox.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"description": "<string>",
"metadata": {}
}
'import requests
url = "https://api.viarosandbox.com/v1/customers"
payload = {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"description": "<string>",
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
email: '<string>',
phone: '<string>',
description: '<string>',
metadata: {}
})
};
fetch('https://api.viarosandbox.com/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.viarosandbox.com/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'description' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.viarosandbox.com/v1/customers"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.viarosandbox.com/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.viarosandbox.com/v1/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_bodyCustomer objects allow you to track multiple payments, invoices, and subscriptions that belong to the same person or organization.
Request Body
string
required
The customer’s full name or business entity name.
string
required
The customer’s primary email address for sending receipts and invoices.
string
The customer’s primary phone number in international E.164 format (e.g.,
+237670000001).string
An arbitrary string that you can attach to a customer object.
object
Key-value pairs for storing arbitrary custom attributes (e.g., internal user ID, membership tier).
Code Examples
curl -X POST https://api.viarosandbox.com/v1/customers \
-u sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG: \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Doe",
"email": "[email protected]",
"phone": "+237670000001",
"metadata": {
"tier": "gold",
"internal_user_id": "usr_90210"
}
}'
import requests
url = "https://api.viarosandbox.com/v1/customers"
auth = ("sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG", "")
payload = {
"name": "Jane Doe",
"email": "[email protected]",
"phone": "+237670000001",
"metadata": {
"tier": "gold",
"internal_user_id": "usr_90210"
}
}
response = requests.post(url, auth=auth, json=payload)
print(response.json())
const axios = require('axios');
async function createCustomer() {
const response = await axios.post(
'https://api.viarosandbox.com/v1/customers',
{
name: 'Jane Doe',
email: '[email protected]',
phone: '+237670000001',
metadata: {
tier: 'gold',
internal_user_id: 'usr_90210'
}
},
{
auth: {
username: 'sk_test_uLsofsae3tB9Izwgeuy0Mxbh4JIxUPSG',
password: ''
}
}
);
console.log(response.data);
}
createCustomer();
Response
{
"id": "cus_9f1a2b3c4d5e",
"object": "customer",
"name": "Jane Doe",
"email": "[email protected]",
"phone": "+237670000001",
"currency": "XAF",
"balance": 0,
"delinquent": false,
"metadata": {
"tier": "gold",
"internal_user_id": "usr_90210"
},
"created_at": "2026-11-06T12:00:00Z"
}

