> ## 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.

# Grant credits to a customer

> Adds credits to a customer balance. Use Idempotency-Key to make grants safe to retry.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sdk/customers/{reference}/credits
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/{reference}/credits:
    post:
      tags:
        - Customers
      summary: Grant credits to a customer
      description: >-
        Adds credits to a customer balance. Use Idempotency-Key to make grants
        safe to retry.
      operationId: CustomerSdkController_grantCredits
      parameters:
        - description: Customer reference identifier
          in: path
          name: reference
          required: true
          schema:
            example: cus_3c4d5e6f7g8h
            type: string
        - description: Provider-scoped idempotency key for safe grant retries
          in: header
          name: Idempotency-Key
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GrantCustomerCreditsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrantCustomerCreditsResponse'
          description: Credits granted successfully
        '404':
          description: Customer not found
      security:
        - SecretKey: []
components:
  schemas:
    GrantCustomerCreditsRequest:
      properties:
        credits:
          exclusiveMinimum: true
          minimum: 0
          type: integer
        reason:
          maxLength: 256
          pattern: ^[\p{L}\p{N}\s.,'"&\/()+:%;?!@#_[\]\-]*$
          type: string
      required:
        - credits
      type: object
    GrantCustomerCreditsResponse:
      properties:
        balance:
          description: Customer credit balance after the grant
          type: number
        credits:
          description: Granted credit amount
          type: number
        customerRef:
          description: Customer reference identifier
          type: string
        reason:
          description: Machine-readable grant reason
          type: string
        success:
          description: Whether the grant was recorded
          type: boolean
      required:
        - success
        - customerRef
        - credits
        - balance
      type: object
  securitySchemes:
    SecretKey:
      bearerFormat: JWT
      description: >-
        Provider secret API key (sk_live_… / sk_test_…) supplied as a Bearer
        token.
      scheme: bearer
      type: http

````