Digitail API
Sales
Pay Sale with client credit
1min
code examples curl location globoff request post 'https //developer digitail io/api/v1/sales/{id}/pay with credit' \\ \ header 'accept application/json' \\ \ header 'content type application/json'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/sales/{id}/pay with credit", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));import requests import json url = "https //developer digitail io/api/v1/sales/{id}/pay with credit" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) \<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //developer digitail io/api/v1/sales/{id}/pay with credit', curlopt returntransfer => true, curlopt encoding => '', curlopt maxredirs => 10, curlopt timeout => 0, curlopt followlocation => true, curlopt http version => curl http version 1 1, curlopt customrequest => 'post', curlopt httpheader => array( 'accept application/json', 'content type application/json' ), )); $response = curl exec($curl); curl close($curl); echo $response; responses // successful operation return sale's payments { "data" { "id" 6, "amount" "100 00", "amount refunded" "0 00", "amount left" "0 00", "made at" "2023 12 14t11 32 44 000000z", "notes" "", "sale id" 5, "sale" { "id" 1, "clinic id" "1", "customer id" "1", "type" 1, "customer" { "id" 1, "name" "john", "last name" "doe", "email" "john\@example com", "phone" "+16175551212 ", "address" "flowers st 300, palo alto, 123456, usa", "city" "palo alto", "street" "flowers st ", "street number" "300", "country" { "id" 6, "name" "united states", "iso code" "us", "code" "usa", "language" { "id" 6, "name" "english (us)", "short name" "en us", "code" "en us" } }, "zip" "123456", "region" "california", "timezone" "america/los angeles", "has app" true, "chatuid" "e58ed763 928c 4155 bee9 fdbaaadc15f3", "vat number" "123456789", "discounts" \[ { "id" 10, "name" "digitail disc10", "description" "digitail disc10", "discount" 10, "discount type" 0, "apply on cogs" false, "discount products" 10, "discount type products" 0, "discount services" 10, "discount type services" 0, "enabled" true } ] }, "file" { "id" 1, "number" "175", "status" 1, "vet id" 1, "clinic id" 1, "pet id" 1, "sale id" 1, "date" "2021 11 19", "reason" "routine checkup", "template id" 0, "comments" "", "recommendations" "", "rabic tag number" "", "presumptive diagnosis" "", "diagnosis" "", "treatment" "" }, "counter sale" 0, "amount paid" "0 000", "amount due" "250 000", "edit state details" { "state" 0, "label" "", "can transit to" \[ { "label" "labels sale edit state states open", "action" "labels sale edit state actions open", "state" 1 } ] }, "status" 0, "total" "250 000", "global discount net" "0 000", "global discount tax" "0 000", "global discount gross" "0 000", "consolidated" false, "created at" "2022 07 18t08 58 36 000000z", "updated at" "2022 07 18t08 58 36 000000z" }, "charge id" 4, "charge" { "id" 0, "amount" "100 00", "amount refunded" "0 00", "amount left" "", "made at" "2023 12 14t11 32 44 000000z", "type" 2, "card brand" "master card", "main sale id" 1, "main sale" {}, "main payment id" 1, "main payment" {}, "has single payment" false, "has multiple payment" true, "payments" \[ { "" "" } ], "charge receipt" {} } } }// the request was invalid or contained data that was not allowed { "message" "requested filter(s) `filter1` are not allowed allowed filter(s) are date, query, " }// the authorization token is missing or invalid // the user is not authorized to perform the requested operation // this response is sent when a request fails validation the format is identical on all endpoints { "message" "the name field is required (and 1 more error)", "errors" { "field1" \[ "" ], "field2" \[ "" ] } }// the user has sent too many requests in a given amount of time ("rate limiting") max 200 requests per minute