> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solvapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new customer

> Creates a new customer record for the authenticated provider. Customers represent end-users who will purchase your products. Email is required and must be unique per provider. The name field is optional but recommended for better tracking.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sdk/customers
openapi: 3.0.0
info:
  contact: {}
  description: The SolvaPay REST API specification
  title: SolvaPay REST API
  version: '1.0'
servers: []
security: []
tags: []
paths:
  /v1/sdk/customers:
    post:
      tags:
        - Customers
      summary: Create a new customer
      description: >-
        Creates a new customer record for the authenticated provider. Customers
        represent end-users who will purchase your products. Email is required
        and must be unique per provider. The name field is optional but
        recommended for better tracking.
      operationId: CustomerSdkController_createCustomer
      parameters: []
      requestBody:
        content:
          application/json:
            examples:
              emailOnly:
                summary: Email only
                value:
                  email: customer@example.com
              withName:
                summary: Customer with name
                value:
                  email: customer@example.com
                  name: John Doe
            schema:
              $ref: '#/components/schemas/CreateCustomerRequest'
        description: Customer creation data
        required: true
      responses:
        '201':
          content:
            application/json:
              example:
                email: customer@example.com
                externalRef: auth_user_12345
                name: John Doe
                reference: cus_3c4d5e6f7g8h
              schema:
                $ref: '#/components/schemas/CustomerResponse'
          description: Customer created successfully
        '400':
          content:
            application/json:
              schema:
                example:
                  error: Bad Request
                  message: Invalid email format
                  statusCode: 400
          description: Invalid email or missing required fields
      security:
        - SecretKey: []
components:
  schemas:
    CreateCustomerRequest:
      properties:
        email:
          format: email
          type: string
        externalRef:
          type: string
        metadata:
          additionalProperties: true
          type: object
        name:
          type: string
        telephone:
          type: string
      required:
        - email
        - metadata
      type: object
    CustomerResponse:
      properties:
        email:
          description: Customer email address
          example: customer@example.com
          type: string
        externalRef:
          description: >-
            External reference ID from your auth system (if set during creation
            or update)
          example: auth_user_12345
          type: string
        name:
          description: Customer full name
          example: John Doe
          type: string
        purchases:
          description: Active purchases
          items:
            $ref: '#/components/schemas/PurchaseInfo'
          type: array
        reference:
          description: Customer reference identifier
          example: cus_3c4d5e6f7g8h
          type: string
      required:
        - reference
        - name
        - email
      type: object
    PurchaseInfo:
      properties:
        amount:
          description: Amount in USD cents (normalised for aggregation)
          example: 9900
          type: number
        cancellationReason:
          description: Reason for cancellation
          example: Customer request
          type: string
        cancelledAt:
          description: When purchase was cancelled
          example: '2025-10-28T10:00:00Z'
          type: string
        currency:
          description: ISO 4217 currency code of the customer-facing charge
          example: GBP
          type: string
        endDate:
          description: End date of purchase
          example: '2025-11-27T10:00:00Z'
          type: string
        exchangeRate:
          description: Exchange rate from original currency to USD
          example: 1.32
          type: number
        originalAmount:
          description: Original amount in the payment currency (minor units)
          example: 7500
          type: number
        planRef:
          description: Plan reference from the plan snapshot, for reliable plan matching
          example: pln_abc123
          type: string
        planSnapshot:
          description: Snapshot of the plan at time of purchase
          type: object
        productName:
          description: Product name
          example: API Gateway Manager
          type: string
        productRef:
          description: Product reference
          example: prd_abc123
          type: string
        reference:
          description: Purchase reference
          example: pur_1A2B3C4D
          type: string
        startDate:
          description: Start date
          example: '2025-10-27T10:00:00Z'
          type: string
        status:
          description: Purchase status
          example: active
          type: string
      required:
        - reference
        - productName
        - status
        - startDate
        - amount
        - currency
      type: object

````