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

# Create Credit Purchase



## OpenAPI

````yaml https://api.dispersed.com/openapi.json post /v1/compute/ledger/credit-purchases
openapi: 3.1.0
info:
  title: Dispersed API
  version: 1.0.0
servers:
  - url: https://api.dispersed.com
security: []
paths:
  /v1/compute/ledger/credit-purchases:
    post:
      tags:
        - Compute Ledger
      summary: Create Credit Purchase
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCreditPurchaseRequest'
      responses:
        '201':
          description: Credit purchase checkout session created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCreditPurchaseResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateCreditPurchaseRequest:
      type: object
      properties:
        amount:
          type: number
          exclusiveMinimum: 0
          description: Purchase amount in EUR.
          example: 25
        memo:
          type: string
          description: Optional memo for the purchase
        cancel_url:
          type: string
          format: uri
          description: >-
            URL to redirect to if the user cancels the Stripe Checkout. Must be
            an allowed Console domain.
          example: https://console.dispersed.com/billing?checkout=cancelled
        redirect_url:
          type: string
          format: uri
          description: >-
            URL to redirect to after successful Stripe Checkout. Must be an
            allowed Console domain.
          example: https://console.dispersed.com/billing?checkout=success
      required:
        - amount
        - cancel_url
        - redirect_url
    CreateCreditPurchaseResponse:
      type: object
      properties:
        checkout_session:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
            client_reference_id:
              type:
                - string
                - 'null'
            object:
              type: string
              enum:
                - checkout.session
            amount_subtotal:
              type:
                - number
                - 'null'
            amount_total:
              type:
                - number
                - 'null'
            currency:
              type: string
            status:
              type:
                - string
                - 'null'
            mode:
              type: string
            metadata:
              type:
                - object
                - 'null'
              properties: {}
              additionalProperties: {}
            payment_intent:
              type:
                - string
                - 'null'
            payment_status:
              type: string
            url:
              type:
                - string
                - 'null'
            success_url:
              type:
                - string
                - 'null'
            cancel_url:
              type:
                - string
                - 'null'
            return_url:
              type:
                - string
                - 'null'
            created:
              type: number
            expires_at:
              type: number
          required:
            - id
            - object
            - currency
            - mode
            - payment_status
            - created
            - expires_at
          additionalProperties: {}
          description: >-
            Full Stripe Checkout session metadata. Null when the upstream API
            has not yet been updated.
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the purchase was created
        session_id:
          type: string
          description: 'Stripe Checkout session ID. Deprecated: use checkout_session.id'
        session_url:
          type:
            - string
            - 'null'
          description: 'Stripe Checkout URL. Deprecated: use checkout_session.url'
        submitted_amount:
          type:
            - number
            - 'null'
          description: The submitted purchase amount in EUR
      required:
        - created_at
        - session_id
        - session_url
        - submitted_amount
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
    Error:
      type: object
      properties:
        code:
          type: string
        details:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              expected:
                type: string
              input:
                type: string
              keys:
                type: array
                items:
                  type: string
              message:
                type: string
              path:
                type: array
                items:
                  anyOf:
                    - type: string
                    - type: number
            required:
              - message
              - path
          default: []
        message:
          type: string
        status:
          type: number
        timestamp:
          type: string
      required:
        - code
        - message
        - status
        - timestamp

````