ChargeDesk Charges API

Manage charge records across payment gateways

OpenAPI Specification

chargedesk-charges-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: ChargeDesk REST Charges API
  description: 'RESTful API for managing charges, customers, subscriptions, products, and webhooks across multiple payment gateways including Stripe, Braintree, PayPal, Authorize.Net, WooCommerce, Shopify, Square, GoCardless, and 14+ others. Supports creating and capturing charges, processing refunds, cancelling subscriptions, requesting payments, and managing customer data.

    '
  version: v1
  contact:
    name: ChargeDesk Support
    url: https://chargedesk.com/api-docs
  termsOfService: https://chargedesk.com/terms
servers:
- url: https://api.chargedesk.com/v1
  description: Production API
security:
- basicAuth: []
tags:
- name: Charges
  description: Manage charge records across payment gateways
paths:
  /charges:
    get:
      operationId: listCharges
      summary: List all charges
      tags:
      - Charges
      parameters:
      - name: status
        in: query
        schema:
          type: string
          enum:
          - pending
          - paid
          - partially refunded
          - refunded
          - failed
          - authorized
          - void
          - invoiced
          - invoice canceled
          - unpaid
          - past due
          - subscription pending
          - disputed
          - trial
          - credit
          - uncollectible
          - open
          - draft
          - unclaimed
      - name: query
        in: query
        schema:
          type: string
        description: Search query string
      - name: customer[id]
        in: query
        schema:
          type: string
      - name: customer[email]
        in: query
        schema:
          type: string
      - name: customer[name]
        in: query
        schema:
          type: string
      - name: customer[username]
        in: query
        schema:
          type: string
      - name: last_4_digits
        in: query
        schema:
          type: string
      - name: transaction_id
        in: query
        schema:
          type: string
      - name: occurred[max]
        in: query
        schema:
          type: string
          format: date-time
      - name: occurred[min]
        in: query
        schema:
          type: string
          format: date-time
      - name: count
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 500
          default: 20
        description: Number of results to return
      - name: offset
        in: query
        schema:
          type: integer
          minimum: 0
          maximum: 50000
          default: 0
        description: Pagination offset
      responses:
        '200':
          description: A list of charges
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChargeList'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createCharge
      summary: Create a charge record
      tags:
      - Charges
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ChargeInput'
      responses:
        '200':
          description: Charge created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /charges/preview:
    get:
      operationId: previewCharge
      summary: Preview a charge with tax calculation
      tags:
      - Charges
      parameters:
      - name: amount
        in: query
        required: true
        schema:
          type: number
      - name: currency
        in: query
        required: true
        schema:
          type: string
      - name: customer[id]
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Charge preview with tax
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /charges/{charge_id}:
    get:
      operationId: getCharge
      summary: Retrieve a single charge
      tags:
      - Charges
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      responses:
        '200':
          description: Charge record
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    post:
      operationId: updateCharge
      summary: Update a charge record
      tags:
      - Charges
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ChargeInput'
      responses:
        '200':
          description: Updated charge
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Charge'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      operationId: deleteCharge
      summary: Delete a charge record
      tags:
      - Charges
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      responses:
        '200':
          description: Charge deleted
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /charges/{charge_id}/items:
    get:
      operationId: getChargeItems
      summary: Get line items for a charge
      tags:
      - Charges
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      responses:
        '200':
          description: Charge line items
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ChargeLineItem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /charges/{charge_id}/email:
    post:
      operationId: emailCharge
      summary: Send email notification for a charge
      tags:
      - Charges
      parameters:
      - $ref: '#/components/parameters/ChargeId'
      responses:
        '200':
          description: Email sent
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    ProductRef:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    ChargeInput:
      type: object
      required:
      - amount
      - currency
      - customer[id]
      properties:
        amount:
          type: number
        currency:
          type: string
        status:
          type: string
        amount_refunded:
          type: number
        last_4_digits:
          type: string
        transaction_id:
          type: string
        description:
          type: string
        customer[id]:
          type: string
        product[id]:
          type: string
        subscription[id]:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        duplicate:
          type: string
          enum:
          - update
          description: Set to 'update' to update existing record if ID already exists
    SubscriptionRef:
      type: object
      properties:
        id:
          type: string
    ChargeLineItem:
      type: object
      properties:
        id:
          type: string
        description:
          type: string
        amount:
          type: number
        quantity:
          type: integer
        currency:
          type: string
    ChargeList:
      type: object
      properties:
        object:
          type: string
          example: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/Charge'
        total_count:
          type: integer
        count:
          type: integer
        offset:
          type: integer
    CustomerRef:
      type: object
      properties:
        id:
          type: string
        email:
          type: string
        name:
          type: string
    Charge:
      type: object
      properties:
        id:
          type: string
          description: Unique charge identifier
        object:
          type: string
          example: charge
        status:
          type: string
          enum:
          - pending
          - paid
          - partially refunded
          - refunded
          - failed
          - authorized
          - void
          - invoiced
          - invoice canceled
          - unpaid
          - past due
          - subscription pending
          - disputed
          - trial
          - credit
          - uncollectible
          - open
          - draft
          - unclaimed
        amount:
          type: number
          description: Charge amount
        currency:
          type: string
          description: 3-letter ISO currency code
        amount_refunded:
          type: number
          description: Total amount refunded
        description:
          type: string
        transaction_id:
          type: string
          description: Gateway transaction ID
        last_4_digits:
          type: string
          description: Last 4 digits of the card used
        customer:
          $ref: '#/components/schemas/CustomerRef'
        product:
          $ref: '#/components/schemas/ProductRef'
        subscription:
          $ref: '#/components/schemas/SubscriptionRef'
        lines:
          type: array
          items:
            $ref: '#/components/schemas/ChargeLineItem'
        metadata:
          type: object
          additionalProperties:
            type: string
        occurred:
          type: string
          format: date-time
        pay_link:
          type: string
          format: uri
          description: Payment link (for payment requests)
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  parameters:
    ChargeId:
      name: charge_id
      in: path
      required: true
      schema:
        type: string
      description: Unique charge identifier
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: 'Use your ChargeDesk secret key as the username with an empty password. Format: Authorization: YOUR_SECRET_KEY:

        '