Customers#
Customer objects allow you to store payment methods, track payments, and manage tenant information across CasaPay products.
The Customer object#
| Attribute | Type | Description |
|---|---|---|
id | string | Unique identifier with cus_ prefix |
object | string | Always "customer" |
name | string | Customer's full name |
email | string | Customer's email address |
phone | string | Phone number |
address | object | Customer's address |
default_payment_method | string | Default Payment Method ID |
balance | integer | Current balance in smallest currency unit |
currency | string | Default currency |
metadata | hash | Key-value pairs |
created | timestamp | Time at which the object was created |
livemode | boolean | Whether this is a live mode object |
{
"id": "cus_123456789",
"object": "customer",
"name": "Jane Doe",
"email": "jane.doe@example.com",
"phone": "+44 7700 900123",
"address": {
"line1": "123 High Street",
"city": "London",
"postal_code": "SW1A 1AA",
"country": "GB"
},
"default_payment_method": "pm_card_visa",
"balance": 0,
"currency": "gbp",
"metadata": {
"property_id": "prop_456",
"unit": "4B"
},
"created": 1706140800,
"livemode": false
}Create a Customer#
POST /v1/customers
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Full name |
email | string | No | Email address |
phone | string | No | Phone number |
address | object | No | Address |
payment_method | string | No | Payment Method to attach |
metadata | hash | No | Key-value pairs |
curl https://api.casapay.com/v1/customers \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"name": "Jane Doe",
"email": "jane.doe@example.com",
"metadata": { "property_id": "prop_456" }
}'Retrieve a Customer#
GET /v1/customers/:id
curl https://api.casapay.com/v1/customers/cus_123456789 \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"Update a Customer#
POST /v1/customers/:id
curl https://api.casapay.com/v1/customers/cus_123456789 \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{"email": "jane.new@example.com"}'Delete a Customer#
DELETE /v1/customers/:id
curl -X DELETE https://api.casapay.com/v1/customers/cus_123456789 \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"List Customers#
GET /v1/customers
| Parameter | Type | Description |
|---|---|---|
email | string | Filter by email |
created[gte] | timestamp | Created on or after |
limit | integer | Number of objects (1–100) |
starting_after | string | Cursor for pagination |
curl "https://api.casapay.com/v1/customers?limit=10" \
-H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"