openapi: 3.0.3 info: title: ChargeDesk REST 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 - name: Customers description: Manage customer billing records - name: Subscriptions description: Manage recurring subscriptions - name: Products description: Manage products and pricing plans - name: Webhooks description: Manage webhook configurations - name: Gateway description: Live payment processing operations 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' /customers: get: operationId: listCustomers summary: List all customers tags: - Customers parameters: - name: query in: query schema: type: string - name: count in: query schema: type: integer minimum: 1 maximum: 500 default: 20 - name: offset in: query schema: type: integer minimum: 0 maximum: 50000 default: 0 responses: '200': description: A list of customers content: application/json: schema: $ref: '#/components/schemas/CustomerList' '401': $ref: '#/components/responses/Unauthorized' post: operationId: createCustomer summary: Create a customer record tags: - Customers requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/CustomerInput' responses: '200': description: Customer created content: application/json: schema: $ref: '#/components/schemas/Customer' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /customers/{customer_id}: get: operationId: getCustomer summary: Retrieve a customer tags: - Customers parameters: - $ref: '#/components/parameters/CustomerId' responses: '200': description: Customer record content: application/json: schema: $ref: '#/components/schemas/Customer' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' post: operationId: updateCustomer summary: Update a customer record tags: - Customers parameters: - $ref: '#/components/parameters/CustomerId' requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/CustomerInput' responses: '200': description: Updated customer content: application/json: schema: $ref: '#/components/schemas/Customer' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' delete: operationId: deleteCustomer summary: Delete a customer record tags: - Customers parameters: - $ref: '#/components/parameters/CustomerId' - name: delete_all in: query schema: type: integer enum: [0, 1, 2] description: > Deletion mode: 1=full deletion including charges, 0=record only, 2=anonymize charges responses: '200': description: Customer deleted '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /customers/grouped: get: operationId: getGroupedCustomers summary: Get structured billing history for customers tags: - Customers responses: '200': description: Grouped customer billing history content: application/json: schema: type: object '401': $ref: '#/components/responses/Unauthorized' /subscriptions: get: operationId: listSubscriptions summary: List all subscriptions tags: - Subscriptions parameters: - name: status in: query schema: type: string enum: - requested - pending - new - trialing - active - past_due - canceled - unpaid - suspended - pending_cancel - name: customer[id] in: query schema: type: string - name: count in: query schema: type: integer minimum: 1 maximum: 500 default: 20 - name: offset in: query schema: type: integer minimum: 0 maximum: 50000 default: 0 responses: '200': description: A list of subscriptions content: application/json: schema: $ref: '#/components/schemas/SubscriptionList' '401': $ref: '#/components/responses/Unauthorized' post: operationId: createSubscription summary: Create a subscription record tags: - Subscriptions requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/SubscriptionInput' responses: '200': description: Subscription created content: application/json: schema: $ref: '#/components/schemas/Subscription' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /subscriptions/{subscription_id}: get: operationId: getSubscription summary: Retrieve a subscription tags: - Subscriptions parameters: - $ref: '#/components/parameters/SubscriptionId' responses: '200': description: Subscription record content: application/json: schema: $ref: '#/components/schemas/Subscription' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' post: operationId: updateSubscription summary: Update a subscription record tags: - Subscriptions parameters: - $ref: '#/components/parameters/SubscriptionId' requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/SubscriptionInput' responses: '200': description: Updated subscription content: application/json: schema: $ref: '#/components/schemas/Subscription' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /products: get: operationId: listProducts summary: List all products tags: - Products parameters: - name: count in: query schema: type: integer minimum: 1 maximum: 500 default: 20 - name: offset in: query schema: type: integer minimum: 0 maximum: 50000 default: 0 responses: '200': description: A list of products content: application/json: schema: $ref: '#/components/schemas/ProductList' '401': $ref: '#/components/responses/Unauthorized' post: operationId: createProduct summary: Create a product tags: - Products requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/ProductInput' responses: '200': description: Product created content: application/json: schema: $ref: '#/components/schemas/Product' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /products/{product_id}: get: operationId: getProduct summary: Retrieve a product tags: - Products parameters: - $ref: '#/components/parameters/ProductId' responses: '200': description: Product record content: application/json: schema: $ref: '#/components/schemas/Product' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' post: operationId: updateProduct summary: Update a product tags: - Products parameters: - $ref: '#/components/parameters/ProductId' requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/ProductInput' responses: '200': description: Updated product content: application/json: schema: $ref: '#/components/schemas/Product' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /webhooks: get: operationId: listWebhooks summary: List all webhooks tags: - Webhooks responses: '200': description: A list of webhooks content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Webhook' '401': $ref: '#/components/responses/Unauthorized' post: operationId: createWebhook summary: Create a webhook tags: - Webhooks requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/WebhookInput' responses: '200': description: Webhook created content: application/json: schema: $ref: '#/components/schemas/Webhook' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /webhooks/{webhook_id}: delete: operationId: deleteWebhook summary: Delete a webhook tags: - Webhooks parameters: - name: webhook_id in: path required: true schema: type: string responses: '200': description: Webhook deleted '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /gateway/products/charge: post: operationId: gatewayCreateCharge summary: Create a live charge, subscription, or payment request via gateway tags: - Gateway requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object properties: using: type: string description: Payment method. Set to 'card' for charge, 'invoice' for payment request. example: card customer[id]: type: string description: Customer identifier amount: type: number description: Charge amount currency: type: string description: 3-letter ISO currency code description: type: string product[interval]: type: string description: Billing interval for subscriptions (day, week, month, year) enum: [day, week, month, year] product[interval_count]: type: integer description: Number of intervals between billings product[trial_period_days]: type: integer description: Number of trial days product[billing_cycles_total]: type: integer description: Total number of billing cycles contact: type: string description: Contact email for payment request link_only: type: boolean description: Return only pay link, do not send email lines[]: type: array items: type: string description: Line items for payment request metadata[key]: type: string description: Arbitrary metadata key-value pairs responses: '200': description: Gateway charge/subscription created content: application/json: schema: $ref: '#/components/schemas/Charge' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /gateway/charges/{charge_id}/refund: post: operationId: gatewayRefundCharge summary: Refund a charge via gateway tags: - Gateway parameters: - $ref: '#/components/parameters/ChargeId' requestBody: content: application/x-www-form-urlencoded: schema: type: object properties: amount: type: number description: Amount to refund (omit for full refund) log_reason: type: string description: Reason for the refund responses: '200': description: Charge refunded content: application/json: schema: $ref: '#/components/schemas/Charge' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /gateway/charges/{charge_id}/capture: post: operationId: gatewayCapturCharge summary: Capture an authorized charge via gateway tags: - Gateway parameters: - $ref: '#/components/parameters/ChargeId' requestBody: content: application/x-www-form-urlencoded: schema: type: object properties: amount: type: number description: Amount to capture (0 to void) responses: '200': description: Charge captured content: application/json: schema: $ref: '#/components/schemas/Charge' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /gateway/charges/{charge_id}/void: post: operationId: gatewayCancelPaymentRequest summary: Cancel a payment request (void) tags: - Gateway parameters: - $ref: '#/components/parameters/ChargeId' responses: '200': description: Payment request cancelled '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /gateway/subscriptions/{subscription_id}/cancel: post: operationId: gatewayCancelSubscription summary: Cancel a subscription via gateway tags: - Gateway parameters: - $ref: '#/components/parameters/SubscriptionId' requestBody: content: application/x-www-form-urlencoded: schema: type: object properties: log_reason: type: string description: Reason for cancellation responses: '200': description: Subscription cancelled content: application/json: schema: $ref: '#/components/schemas/Subscription' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /gateway/subscriptions/{subscription_id}/plans: post: operationId: gatewayEditSubscriptionPlans summary: Edit subscription plans via gateway tags: - Gateway parameters: - $ref: '#/components/parameters/SubscriptionId' requestBody: content: application/x-www-form-urlencoded: schema: type: object properties: plans[][id]: type: string description: Plan identifier trial_end: type: string format: date-time description: When the trial period ends prorate: type: boolean description: Whether to prorate the subscription change invoice: type: boolean description: Whether to generate an invoice responses: '200': description: Subscription plans updated content: application/json: schema: $ref: '#/components/schemas/Subscription' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' components: securitySchemes: basicAuth: type: http scheme: basic description: > Use your ChargeDesk secret key as the username with an empty password. Format: Authorization: YOUR_SECRET_KEY: parameters: ChargeId: name: charge_id in: path required: true schema: type: string description: Unique charge identifier CustomerId: name: customer_id in: path required: true schema: type: string description: Unique customer identifier SubscriptionId: name: subscription_id in: path required: true schema: type: string description: Unique subscription identifier ProductId: name: product_id in: path required: true schema: type: string description: Unique product identifier responses: Unauthorized: description: Authentication failed content: application/json: schema: $ref: '#/components/schemas/Error' NotFound: description: Resource not found content: application/json: schema: $ref: '#/components/schemas/Error' BadRequest: description: Invalid request parameters content: application/json: schema: $ref: '#/components/schemas/Error' schemas: Error: type: object properties: error: type: object properties: message: type: string type: type: string code: 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) 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 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 Customer: type: object properties: id: type: string description: Unique customer identifier object: type: string example: customer customer_id: type: string email: type: string format: email name: type: string phone: type: string username: type: string customer_company: type: string website: type: string format: uri description: type: string country: type: string delinquent: type: boolean card_on_file: type: boolean tax_number: type: string billing_address: $ref: '#/components/schemas/BillingAddress' invoice_details: type: string metadata: type: object additionalProperties: type: string CustomerInput: type: object required: - customer_id properties: customer_id: type: string email: type: string format: email country: type: string name: type: string phone: type: string username: type: string customer_company: type: string website: type: string format: uri description: type: string delinquent: type: boolean card_on_file: type: boolean tax_number: type: string billing_address: type: object invoice_details: type: string metadata: type: object additionalProperties: type: string CustomerList: type: object properties: object: type: string example: list data: type: array items: $ref: '#/components/schemas/Customer' total_count: type: integer count: type: integer offset: type: integer CustomerRef: type: object properties: id: type: string email: type: string name: type: string BillingAddress: type: object properties: line1: type: string line2: type: string city: type: string state: type: string postal_code: type: string country: type: string Subscription: type: object properties: id: type: string object: type: string example: subscription subscription_id: type: string customer_id: type: string status: type: string enum: - requested - pending - new - trialing - active - past_due - canceled - unpaid - suspended - pending_cancel amount: type: number currency: type: string interval: type: string enum: [day, week, month, year] interval_count: type: integer quantity: type: integer trial_start: type: string format: date-time trial_end: type: string format: date-time billing_cycles_total: type: integer billing_cycles_current: type: integer items: type: array items: type: object metadata: type: object additionalProperties: type: string SubscriptionInput: type: object required: - subscription_id properties: subscription_id: type: string customer_id: type: string status: type: string amount: type: number currency: type: string interval: type: string enum: [day, week, month, year] interval_count: type: integer quantity: type: integer trial_start: type: string format: date-time trial_end: type: string format: date-time billing_cycles_total: type: integer billing_cycles_current: type: integer items[]: type: array items: type: string metadata: type: object additionalProperties: type: string SubscriptionRef: type: object properties: id: type: string Product: type: object properties: id: type: string object: type: string example: product product_id: type: string name: type: string description: type: string url: type: string format: uri amount: type: number currency: type: string interval: type: string enum: [day, week, month, year] trial_period_days: type: integer billing_cycles_total: type: integer setup_amount: type: number chargeable: type: boolean ProductInput: type: object required: - product_id properties: product_id: type: string name: type: string description: type: string url: type: string format: uri amount: type: number currency: type: string interval: type: string enum: [day, week, month, year] trial_period_days: type: integer billing_cycles_total: type: integer setup_amount: type: number chargeable: type: boolean ProductList: type: object properties: object: type: string example: list data: type: array items: $ref: '#/components/schemas/Product' total_count: type: integer ProductRef: type: object properties: id: type: string name: type: string Webhook: type: object properties: id: type: string object: type: string example: webhook url: type: string format: uri events: type: array items: type: string active: type: boolean created: type: string format: date-time WebhookInput: type: object required: - url properties: url: type: string format: uri description: Endpoint URL to receive webhook notifications events: type: array items: type: string description: List of event types to subscribe to