v1

latestOpenAPI 3.0.02026-07-24161215397.4 KB
Charges

Create a new charge for invoice

Create a new charge for the specified invoice.

Required scopes: flex.billing.charges.create

post/api/v2/organizations/{orgSlug}/charges

Path parameters

orgSlugstring required

organization slug

Request body

paymentstring required

The payment for which the charge should be created

datestring required

The date of the charge

amountnumber required

The amount of the charge.

accountstring required

The account with which the charge will be associated.

referencestring

A short description of the charge

providerChargeReferencestring

Provider payment gateway charge reference used for reconciliation and operational tooling.

status'pending' | 'fail' | 'success' | 'refund'

The status of the charge.

sourcestring

The origin of the charge, you should denote entries created from the API accordingly.

Example request

{
  "payment": "6080186f490fcf6e0547ec50",
  "date": "2024-10-31T13:00:00.000Z",
  "amount": 1000,
  "account": "Cash",
  "reference": "Charge Reference 1",
  "providerChargeReference": "ch_3ABC123DEF456",
  "source": "API"
}

Response

_idstring required

The _id of the charge.

amountnumber required

The amount of the charge.

currencystring

The currency of the charge.

accountstring

The account to which the charge is allocated.

referencestring

A short description of the charge

datestring

The date of the charge.

sourcestring

The source of the charge. The source will be an accounting integration if the charge is synced from an integration.

status'pending' | 'fail' | 'success' | 'refund'

The status of the charge.

paymentstring

Reference to the invoice, to which the charge belongs to.

providerChargeReferencestring

The payment gateway reference for the charge (e.g., Stripe charge ID).

createdAtstring date-time

The date when the charge has been created at.

createdBystring

The user that created the charge.

modifiedAtstring date-time

The date when the charge has been modified for the last time.

modifiedBystring

The user that did the last modification to the charge. Before the first modification, this field equals to the createdBy field.

Example response

{
  "_id": "6080186f490fcf6e0547ec50",
  "amount": 15,
  "currency": "USD",
  "account": "Cash",
  "reference": "Charge Reference 1",
  "date": "2025-01-01T00:00:00.000Z",
  "accounting": {
    "provider": "xero",
    "providerId": "123456789",
    "externalOrgId": "987654321",
    "deepLink": "https://quickbooks.com/123456789",
    "lastSync": "2025-01-01T00:00:00.000Z",
    "error": "An error occurred while syncing with Xero"
  },
  "source": "API",
  "payment": "6080186f490fcf6e0547ec50",
  "providerChargeReference": "ch_3ABC123DEF456",
  "createdAt": "2025-01-01T00:00:00.000Z",
  "createdBy": "6080186f490fcf6e0547ec50",
  "modifiedAt": "2025-01-01T00:00:00.000Z",
  "modifiedBy": "6080186f490fcf6e0547ec50"
}