GET /customers/:id/debts

Returns a list of debts from the customer with a specific id.

The provided id can be either:

curl -XGET \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer 795d966936e24e19d4f9455be5ce44a4fd1d489623b966d20acf53ac0994cdfa" \
  https://api.invisiblecollector.com/customers/2314234/debts
require "net/https"
require "uri"

uri = URI.parse("https://api.invisiblecollector.com/customers/2314234/debts")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri.request_uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer 4a415cc660e67d8f4d26d5a7f390183a86fc3a4524ded78dc2448e86c48b2739'

response = http.request(request)
import com.ic.invisiblecollector.IcApiFacade;
import com.ic.invisiblecollector.model.Debt;

IcApiFacade apiFacade = new IcApiFacade("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");

String customerId = ...
List<Debt> customerDebts = apiFacade.getCustomerFacade().requestCustomerDebts(customerId);
using InvisibleCollectorLib;
using InvisibleCollectorLib.Model;

var ic = new InvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
string customerId = ... ;
IList<Debt> debts = await ic.GetCustomerDebtsAsync(customerId);
iC, err := ic.NewInvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98", ic.InvisibleCollectorUri)

var channel = make(chan ic.DebtListPair)
go iC.GetCustomerDebts(channel, aCustomerModel.Id())
p := <-channel

fmt.Println(p.Debts)

This request will return, for example, the following JSON response:

[
  {
    "number": "1",
    "id": "1fb0c683-bedc-45be-a88a-ff76da7bf650",
    "customerId": "0d3987e3-a6df-422c-8722-3fde26eec9a8",
    "type": "FT",
    "status": "PENDING",
    "date": "2018-05-02",
    "dueDate": "2019-01-02",
    "netTotal": 1000.0,
    "tax": 200.0,
    "grossTotal": 1200.0,
    "currency": "EUR",
    "items": [
      {
        "name": "an item name",
        "description": "a debt item description",
        "quantity": 3.0,
        "vat": 23.0,
        "price": 15.0
      },
      {
        "name": "another item name",
        "description": "another debt item description",
        "quantity": 4.0,
        "vat": 23.0,
        "price": 20.0
      },
    ],
    "attributes": {
      "name_1": "attribute_1",
      "name_2": "attribute_2"
    }
  },
  <anotherDebtObject>,
  ...
]

Endpoint

GET https://api.invisiblecollector.com/customers/:id/debts

Response body

Attribute Type Description
number string The debt number
id string An unique identifier of this debt
customerId string The Invisible Collector’s generated id of the customer to whom this debt was issued to.
type string The type of debt
status string The current status of this debt
date date The date this debt was created in ISO 8601 format (YYYY-MM-DD)
dueDate date The payment expiration date in ISO 8601 format (YYYY-MM-DD)
netTotal double This debt’s total net total
tax double The total amount being paid for tax purposes
grossTotal double The gross total of this debt
currency string The ISO 4217 currency code.
items array A list of items included in the transaction
attributes map A map of custom attributes related with this debt. Each attribute is a string-string key-value pair.

Item

Attribute Type Description
name string The name if the item
description string A human readable description of the item
quantity double The amount of items of this type included in the transaction
vat percentage The percentage being applied to this item for tax purposes
price double This item’s gross total

Errors

This endpoint may return the following errors

HTTP Code Description
401 Unauthorized Invalid credentials were supplied
404 Not found The user doesn’t have any customer registered with that specific id.

Feedback

If you have a question that needs an answer, please contact support.