PUT /payments/:id/cancel

Cancels a payment. Cancelled payments aren’t included or mentioned in any notification sent to debtors.

Cancelling a payment causes the balance of referenced documents to be recalculated.

The :id accepted by the endpoint is the externalId of the payment provided when it was registered.

This operation is idempotent and cancelling an already canceled payment won’t yield any change.

curl -XPUT \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer 4b1e8df2ff50110ca86e28f2b499facbd78310c9cda0125543ad80ac70cc28d1" \
  https://api.invisiblecollector.com/payments/12345/cancel
require "net/https"
require "uri"
require "json"

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

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

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

var ic = new InvisibleCollector("56a73507b66cd761caae7547ef2a66fc3a393746ba4bb9a91e303fcb3ceefb98");
string paymentId = ... ; // externalId of payment
Payment payment = await ic.CancelPaymentAsync(paymentId);

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

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

Endpoint

PUT https://api.invisiblecollector.com/payments/12345/cancel

Errors

This endpoint may return the following errors

HTTP Code Description
401 Unauthorized Invalid credentials were supplied
404 Not Found The payment being canceled was not found