POST /payments

Allows callers to register a payment.

This request is idempotent only if the payment being created and the one Invisible Collector has are the same. If they’re not a 409 CONFLICT error will be returned.

Creating a payment also updates all referenced debts:

Each payment line can also reference either a credit note or a debit note. If they do a direct reference between that note and the document will be created instead.

curl -XPOST \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer 5e0f7262ad958072a368722a42e38ed9a249604dcff590975112c134b84ac058" \
  https://api.invisiblecollector.com/payments  \
  --data '...'
require "net/https"
require "json"
require "uri"

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

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

response = http.request(request)
// example available soon
using InvisibleCollectorLib;
using InvisibleCollectorLib.Model;

var ic = new InvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
var newPayment = new Payment() {
  // set the fields, including the mandatory ones
}

Payment payment = await ic.SetNewPayment(paymentId);

This request can receive, for example, the following JSON data:

{
  "number": "RG TEST/001",
  "externalId": "123455",
  "status": "FINAL",
  "date": "2016-07-01",
  "type": "RG",
  "netTotal": 25.00,
  "tax": 5.75,
  "grossTotal": 30.75,
  "currency": "EUR",
  "lines": [
    {
      "number": "FT TEST/001",
      "amount": 10.75
    },
    {
      "number": "FT TEST/001",
      "referenceNumber": "NC NC/001",
      "amount": 20.00
    }
  ]
}

Endpoint

POST https://api.invisiblecollector.com/payments

Request body

Attribute Type Mandatory Default Description
number string yes N/A An identifier for this payment. Must be unique within the scope of a company.
externalId string no N/A An external identifier of this payment.
status string yes FINAL The current status of this payment. Accepted values are FINAL or CANCELLED.
type string yes N/A The type of payment.
date date yes N/A The payment date. The valid format is year-month-day.
netTotal double no N/A The amount paid without taxes.
tax double no N/A The amount paid for tax purposes.
grossTotal double no N/A The total value of this payment i.e. net total plus taxes.
currency string yes N/A The ISO 4217 currency code.
lines list of Line yes N/A A list of debts being paid.

Line object

Attribute Type Mandatory Default Description
number string yes N/A The identifier of the debt being paid.
referenceNumber string no N/A An optional reference to either a credit note or a debit note.
amount double yes N/A The amount being deducted from this debt.

Errors

This endpoint may return the following errors

HTTP Code Description
401 Unauthorized Invalid credentials were supplied
404 Not Found One or more documents referenced by this payment was not found
409 Conflict A different payment with the same number already exists on Invisible Collector
422 Unprocessable Entity The request is syntactically correct but not a valid payment JSON object