curl --request POST \
--url https://api-dashboard.payra.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123"
}
'import requests
url = "https://api-dashboard.payra.com/v1/customers"
payload = {
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123"
}
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({
reference: 'user_48213',
name: 'Ada Lovelace',
email: '[email protected]',
phone: '+15555550123'
})
};
fetch('https://api-dashboard.payra.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-dashboard.payra.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([
'reference' => 'user_48213',
'name' => 'Ada Lovelace',
'email' => '[email protected]',
'phone' => '+15555550123'
]),
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-dashboard.payra.com/v1/customers"
payload := strings.NewReader("{\n \"reference\": \"user_48213\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"[email protected]\",\n \"phone\": \"+15555550123\"\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-dashboard.payra.com/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"user_48213\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"[email protected]\",\n \"phone\": \"+15555550123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.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 \"reference\": \"user_48213\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"[email protected]\",\n \"phone\": \"+15555550123\"\n}"
response = http.request(request)
puts response.read_body{
"object": "customer",
"id": "019e2b4c-7a1d-7c3e-9f20-5b8d4e6a1c30",
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123",
"created_at": "2026-09-29T14:00:00.000Z"
}{
"object": "customer",
"id": "019e2b4c-7a1d-7c3e-9f20-5b8d4e6a1c30",
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123",
"created_at": "2026-09-29T14:00:00.000Z"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Create a customer
Creates a customer of your workspace, to save payment methods on and charge them again later. It appears under Customers in the Payra dashboard, and its payments are filed on it. With a reference that already belongs to a customer, that customer is returned with 200 instead, unchanged. Not available on a workspace whose customers come from an ERP integration.
curl --request POST \
--url https://api-dashboard.payra.com/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123"
}
'import requests
url = "https://api-dashboard.payra.com/v1/customers"
payload = {
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123"
}
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({
reference: 'user_48213',
name: 'Ada Lovelace',
email: '[email protected]',
phone: '+15555550123'
})
};
fetch('https://api-dashboard.payra.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-dashboard.payra.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([
'reference' => 'user_48213',
'name' => 'Ada Lovelace',
'email' => '[email protected]',
'phone' => '+15555550123'
]),
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-dashboard.payra.com/v1/customers"
payload := strings.NewReader("{\n \"reference\": \"user_48213\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"[email protected]\",\n \"phone\": \"+15555550123\"\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-dashboard.payra.com/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"user_48213\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"[email protected]\",\n \"phone\": \"+15555550123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dashboard.payra.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 \"reference\": \"user_48213\",\n \"name\": \"Ada Lovelace\",\n \"email\": \"[email protected]\",\n \"phone\": \"+15555550123\"\n}"
response = http.request(request)
puts response.read_body{
"object": "customer",
"id": "019e2b4c-7a1d-7c3e-9f20-5b8d4e6a1c30",
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123",
"created_at": "2026-09-29T14:00:00.000Z"
}{
"object": "customer",
"id": "019e2b4c-7a1d-7c3e-9f20-5b8d4e6a1c30",
"reference": "user_48213",
"name": "Ada Lovelace",
"email": "[email protected]",
"phone": "+15555550123",
"created_at": "2026-09-29T14:00:00.000Z"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"param": "<string>"
}
}Authorizations
A secret key, sk_test_... or sk_live_...; a publishable key (pk_...) on the browser routes only
Body
Your own id for the customer, such as your user id, unique in the workspace. When a customer already has it, that customer is returned (200) and nothing is created or changed, so the call is safe to repeat.
1 - 100"user_48213"
1 - 200"Ada Lovelace"
Where Payra sends this customer's payment receipts, when the workspace sends them.
254E.164.
^\+[1-9]\d{9,14}$/u"+15555550123"
Response
A customer already had this reference
customer Pass it as customer on a payment method session, a checkout session or a payment.
"019e2b4c-7a1d-7c3e-9f20-5b8d4e6a1c30"
Your own id for the customer; null for customers created in the Payra dashboard or by an ERP.
"user_48213"
The name shown in the Payra dashboard: the email, or the reference, when created without one.
"Ada Lovelace"
"+15555550123"
"2026-09-29T14:00:00.000Z"