---
title: Create a Charge
slug: create-a-charge
docTags: 
createdAt: 2026-04-21T15:22:49.957Z
---

{
  "id": "07dHzCkWC-JP_HuUOC1eU",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://developer.digitail.io/api/v1/charges",
    "servers": [
      {
        "url": "https://developer.digitail.io/api/v1/charges",
        "description": "Sandbox server (uses test data)"
      },
      {
        "url": "https://vet.digitail.io/api/v1/charges",
        "description": "Production server (uses live data)"
      }
    ],
    "name": "Create a Charge",
    "description": "<p>Permissions needed: any of (CREATE_CHECKUPS, VIEW_COUNTER_SALE)\nCreates a new charge for a specific pet parent and clinic and returns it.\n<code>surcharge</code> is accepted only for DSP integrated saved card payments (when <code>provider_data.payment_method_id</code> is provided).</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "include",
          "description": "<p>Additional info to include:  mainSale,mainPayment,payments,chargeReceipt</p>"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "schema": [
            {
              "name": "clinic_id",
              "kind": "optional",
              "type": "integer",
              "description": "Clinic is on which pet parent is client on.",
              "example": 1234
            },
            {
              "name": "client_id",
              "kind": "optional",
              "type": "integer",
              "description": "Pet parent id",
              "example": 234
            },
            {
              "name": "sale_id",
              "kind": "optional",
              "type": "integer",
              "description": "<p>Id of sale to associate the charge to, if as_credit is false the sale will be paid first if there are multiple due sales and amount is greater than sale amount due</p>",
              "example": 234
            },
            {
              "name": "amount",
              "kind": "optional",
              "type": "number<float>",
              "description": "",
              "example": 100,
              "format": "float"
            },
            {
              "name": "type",
              "kind": "optional",
              "type": "integer",
              "description": "<p><code>1</code> - Cash <code>2</code> - Card <code>3</code> - Order <code>6</code> - Check <code>7</code> - Other</p>",
              "example": 2,
              "enum": [
                "1",
                "2",
                "3",
                "4",
                "6",
                "7"
              ]
            },
            {
              "name": "card_brand",
              "kind": "optional",
              "type": "string<master_card | visa | american_express | discover | other>",
              "nullable": true,
              "description": "",
              "example": "master_card",
              "enum": [
                "master_card",
                "visa",
                "american_express",
                "discover",
                "other"
              ]
            },
            {
              "name": "provider_data",
              "kind": "optional",
              "type": "object",
              "nullable": true,
              "description": "Required for DSP integrated saved card payments.",
              "example": "",
              "schema": [
                {
                  "name": "payment_method_id",
                  "kind": "optional",
                  "type": "string",
                  "description": "The saved card payment method id to use for this charge.",
                  "example": "pm_123"
                }
              ]
            },
            {
              "name": "date",
              "kind": "optional",
              "type": "string<date-time>",
              "description": "",
              "example": "2020-01-01T00:00:00Z",
              "format": "date-time"
            },
            {
              "name": "notes",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "Payment note",
              "example": ""
            },
            {
              "name": "create_receipt",
              "kind": "optional",
              "type": "boolean",
              "nullable": true,
              "description": "",
              "example": false
            },
            {
              "name": "as_credit",
              "kind": "optional",
              "type": "boolean",
              "description": "If true charge is not applied to due sales and is kept as client credit",
              "example": false
            },
            {
              "name": "surcharge",
              "kind": "optional",
              "type": "number<float>",
              "description": "<p>Surcharge amount to be added to the charge total. Can be sent only for DSP integrated saved card payments (<code>provider_data.payment_method_id</code>).</p>",
              "example": 0.35,
              "format": "float",
              "minimum": 0,
              "exclusiveMinimum": true
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "passport",
          "name": "passport",
          "kind": "optional",
          "type": "oauth2",
          "description": "Laravel passport oauth2 security.",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://digitail.test/oauth/authorize",
              "tokenUrl": "https://digitail.test/oauth/token",
              "refreshUrl": "https://digitail.test/oauth/token"
            }
          }
        },
        {
          "id": "Bearer",
          "name": "Bearer",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Created",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "data",
                "kind": "optional",
                "type": "object",
                "description": "<p>A charge is the act of the customer paying the clinic. A charge can later on be allocated to different sales through payments. If no sale is outstanding, the charge will be left as a credit in the customer's account.</p>",
                "example": "",
                "schema": [
                  {
                    "name": "id",
                    "kind": "optional",
                    "type": "integer",
                    "description": "",
                    "example": 0
                  },
                  {
                    "name": "amount",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "100.00"
                  },
                  {
                    "name": "amount_refunded",
                    "kind": "optional",
                    "type": "string",
                    "description": "",
                    "example": "0.00"
                  },
                  {
                    "name": "amount_left",
                    "kind": "optional",
                    "type": "string<float>",
                    "description": "Amount left to refund",
                    "example": 0,
                    "format": "float"
                  },
                  {
                    "name": "made_at",
                    "kind": "optional",
                    "type": "string<date-time>",
                    "description": "",
                    "example": "2023-12-14T11:32:44.000000Z",
                    "format": "date-time"
                  },
                  {
                    "name": "type",
                    "kind": "optional",
                    "type": "integer",
                    "description": "<p><code>1</code> - Cash <code>2</code> - Card <code>3</code> - Order <code>4</code> - Overdraft <code>5</code> - Online <code>6</code> - Check <code>7</code> - Other <code>8</code> - Client Credit <code>9</code> - Care Credit <code>10</code> - Pet Transfer Acquitted <code>11</code> - Credit Note</p>",
                    "example": 2,
                    "enum": [
                      "1",
                      "2",
                      "3",
                      "4",
                      "5",
                      "6",
                      "7",
                      "8",
                      "9",
                      "10",
                      "11"
                    ]
                  },
                  {
                    "name": "card_brand",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/paths/~1api~1v1~1charges/post/requestBody/content/application~1json/schema/properties/card_brand",
                    "customType": "card_brand",
                    "schema": []
                  },
                  {
                    "name": "main_sale_id",
                    "kind": "optional",
                    "type": "integer",
                    "nullable": true,
                    "description": "Sale id charge is associated to",
                    "example": 1
                  },
                  {
                    "name": "main_sale",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "main_payment_id",
                    "kind": "optional",
                    "type": "integer",
                    "nullable": true,
                    "description": "",
                    "example": 1
                  },
                  {
                    "name": "main_payment",
                    "kind": "optional",
                    "type": "object",
                    "nullable": true,
                    "description": "",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "has_single_payment",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "",
                    "example": false
                  },
                  {
                    "name": "has_multiple_payment",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "",
                    "example": true
                  },
                  {
                    "name": "payments",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "modelRef": "#/paths/~1api~1v1~1sales~1%7Bid%7D~1pay-with-credit/post/responses/200/content/application~1json/schema/properties/data",
                    "customType": "data[]",
                    "schema": []
                  },
                  {
                    "name": "paid_sales",
                    "kind": "optional",
                    "type": "array",
                    "description": "",
                    "modelRef": "#/paths/~1api~1v1~1sales/post/responses/200/content/application~1json/schema/properties/data",
                    "customType": "data[]",
                    "schema": []
                  },
                  {
                    "name": "charge_receipt",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "example": "",
                    "schema": []
                  }
                ]
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Bad request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "undefined",
            "example": "{\"message\":\"The given data was invalid.\",\"errors\":{\"card_brand\":[\"The card brand field can only be provided on Payments with Cards\"],\"surcharge\":[\"The surcharge field can only be provided for DSP integrated saved card payments.\"]}}",
            "description": "",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "UaUdzbaWmy0KZZqnDOlmW",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://developer.digitail.io/api/v1/charges \\\n     --header 'accept: application/json'"
        },
        {
          "id": "PQE4nluX3LYJnCapBVGI9",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://developer.digitail.io/api/v1/charges\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "PfjEs7n5mJFOzy8nIQN_B",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://developer.digitail.io/api/v1/charges\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "pMvTOlCxWnMlDVByKPO95",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://developer.digitail.io/api/v1/charges\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "UaUdzbaWmy0KZZqnDOlmW"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// Created\n{\n  \"data\": {\n    \"id\": 0,\n    \"amount\": \"100.00\",\n    \"amount_refunded\": \"0.00\",\n    \"amount_left\": \"\",\n    \"made_at\": \"2023-12-14T11:32:44.000000Z\",\n    \"type\": 2,\n    \"card_brand\": {},\n    \"main_sale_id\": 1,\n    \"main_sale\": {},\n    \"main_payment_id\": 1,\n    \"main_payment\": {},\n    \"has_single_payment\": false,\n    \"has_multiple_payment\": true,\n    \"payments\": [\n      \"\"\n    ],\n    \"paid_sales\": [\n      \"\"\n    ],\n    \"charge_receipt\": {}\n  }\n}"
        },
        {
          "id": "response-1-422",
          "language": "422",
          "code": "// Bad request\n\"{\\\"message\\\":\\\"The given data was invalid.\\\",\\\"errors\\\":{\\\"card_brand\\\":[\\\"The card brand field can only be provided on Payments with Cards\\\"],\\\"surcharge\\\":[\\\"The surcharge field can only be provided for DSP integrated saved card payments.\\\"]}}\""
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}