Get customer by ID

📘

API Refs

Path parameters

NameTypeDescriptionRequired
idstringStripe customer ID (starting with "cus_")yes

Query Parameters

NameTypeDescriptionRequired
include_subscriptionsbooleanWhether to include subscription data for the customer (default: false)no

Response body

Main Response Fields

FieldTypeDescription
idstringCustomer ID
emailstringCustomer email
firstNamestringCustomer first name
lastNamestringCustomer last name
phonestringCustomer phone number
stripeCustomerIdstringStripe customer ID
addressobjectCustomer address (optional)
createdAtstringCustomer creation date (ISO 8601)
updatedAtstringLast update date (ISO 8601)
subscriptionsarrayCustomer subscriptions (only when include_subscriptions=true)

Address Object

FieldTypeDescription
streetstringStreet address (optional)
citystringCity (optional)
statestringState or province (optional)
postalCodestringPostal/ZIP code (optional)

Subscription Object (when included)

FieldTypeDescription
idstringSubscription ID
statusstringStatus (active, past_due, canceled, etc.)
planobjectPlan details
currentPeriodStartstringCurrent period start (ISO 8601)
currentPeriodEndstringCurrent period end (ISO 8601)
createdAtstringSubscription creation date (ISO 8601)

Plan Details Object

FieldTypeDescription
stripePriceIdstringStripe price ID
namestringPlan name
amountnumberPlan amount in cents
currencystringCurrency code
intervalstringBilling interval
productIdnumberProduct ID
productNamestringProduct name
productDescriptionstringProduct description (nullable)

Example Request

GET /api/public/customers/cus_ExampleCustomerID123?include_subscriptions=true
Authorization: Bearer YOUR_API_KEY

Example Response

{
  "id": "123",
  "email": "[email protected]",
  "firstName": "John",
  "lastName": "Doe",
  "phone": "+1234567890",
  "stripeCustomerId": "cus_ExampleCustomerID123",
  "address": {
    "street": "123 Main St",
    "city": "New York",
    "state": "NY",
    "postalCode": "10001"
  },
  "createdAt": "2023-12-01T00:00:00.000Z",
  "updatedAt": "2024-01-15T00:00:00.000Z",
  "subscriptions": [
    {
      "id": "sub_ExampleSubscription123",
      "status": "active",
      "plan": {
        "stripePriceId": "price_ExamplePriceID456",
        "name": "Premium Plan",
        "amount": 4999,
        "currency": "usd",
        "interval": "month",
        "productId": 456,
        "productName": "Auto Insurance",
        "productDescription": "Comprehensive auto coverage"
      },
      "currentPeriodStart": "2024-01-01T00:00:00.000Z",
      "currentPeriodEnd": "2024-02-01T00:00:00.000Z",
      "createdAt": "2023-12-01T00:00:00.000Z"
    }
  ]
}

Description

This endpoint retrieves detailed information about a specific customer including payment methods and optionally subscription history. The response includes comprehensive customer profile details, address information, and can include active and past subscriptions when requested.

Error Responses

  • 400 Bad Request: Invalid customer ID format
  • 401 Unauthorized: Invalid or missing authorization token
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Customer not found