Create a Charge
1 min
POST
https://developer.digitail.io/api/v1/charges
Query Parameters
- includeDescription
Body Parameters
- bodyobjectrequired
- clinic_idintegerExampleDescription
- client_idintegerExampleDescription
- sale_idintegerExampleDescription
- amountnumber<float>ExampleFormatfloat
- typeintegerExampleDescriptionAllowed123467
- card_brandstring<master_card | visa | american_express | discover | other>ExampleAllowedmaster_cardvisaamerican_expressdiscoverother
- provider_dataobjectDescription
- payment_method_idstringExampleDescription
- datestring<date-time>ExampleFormatdate-time
- notesstringDescription
- create_receiptboolean
- as_creditbooleanDescription
- surchargenumber<float>ExampleDescriptionFormatfloatMinimum (exclusive)0
Responses
201
- object
- dataobjectDescription
- idinteger
- amountstringExample
- amount_refundedstringExample
- amount_leftstring<float>DescriptionFormatfloat
- made_atstring<date-time>ExampleFormatdate-time
- typeintegerExampleDescriptionAllowed1234567891011
- card_brandcard_brand
- main_sale_idintegerExampleDescription
- main_saleobject
- main_payment_idintegerExample
- main_paymentobject
- has_single_paymentboolean
- has_multiple_paymentbooleanExample
- paymentsdata[]
- paid_salesdata[]
- charge_receiptobject
422
- undefinedExample
{ "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." ] } }
curl
curl --request POST \
--url https://developer.digitail.io/api/v1/charges \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://developer.digitail.io/api/v1/charges", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://developer.digitail.io/api/v1/charges")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://developer.digitail.io/api/v1/charges"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Created
{
"data": {
"id": 0,
"amount": "100.00",
"amount_refunded": "0.00",
"amount_left": "",
"made_at": "2023-12-14T11:32:44.000000Z",
"type": 2,
"card_brand": {},
"main_sale_id": 1,
"main_sale": {},
"main_payment_id": 1,
"main_payment": {},
"has_single_payment": false,
"has_multiple_payment": true,
"payments": [
""
],
"paid_sales": [
""
],
"charge_receipt": {}
}
}422
// Bad request
"{\"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.\"]}}"