Credits

This s a documentation page for our shiny new REST API - you weren't meant to find it. This API isn't ready for public use yet. We're chopping and changing it a LOT as we grow it. So if you build something that uses it then it's very likely to break in a future update. Don't say you weren't warned!

URL:

https://api.kashflow.com/v2/internal/invoices/{invoiceid}/credits

Method(s):

get,post

Response Formats:

JSON, XML

Description:

Allows to retrieve credit list and to apply payments so that customer’s credit can be used

Parameters

NameTypeDescription
IdNumericIf type is AdvancePayment then Id is the unique bank identifier.
If type is CreditNote then Id is the unique invoice identifier.
If type is OverPayment then Id is the unique invoice payment identifier.
AmountNumericThe amount that can be credited.
DateDateIf type is AdvancePayment then Date is paid date.
If type is CreditNote then Date is the invoice date.
If type is OverPayment then Date is the transaction date.
TypeStringThe type of credit. The acceptable values for this parameter are:
1. OverPayment
2. AdvancePayment
3. CreditNote
CommentStringNote for this record

GET Operation

Returns a list of credits.

URL : /internal/invoices/{invoiceid}/credits

Example response for GET of credit list


[{
    "Amount": 46.0000,
    "Comment": "Advance Payment on Invoice Test #1111111435",
    "Date": "2013-06-07 12:00:00",
    "Id": 23438824,
    "Type": "AdvancePayment"
}, {
    "Amount": 46.0000,
    "Comment": "Credit Note #1111111435",
    "Date": "2013-06-07 12:00:00",
    "Id": 23081430,
    "Type": "CreditNote"
}, {
    "Amount": 100.0000,
    "Comment": "Advance Payment on Invoice Test #1111111462",
    "Date": "2013-06-10 12:00:00",
    "Id": 23438895,
    "Type": "AdvancePayment"
}, {
    "Amount": 100.0000,
    "Comment": "Advance Payment on Invoice Test #1111111465",
    "Date": "2013-06-10 12:00:00",
    "Id": 23438896,
    "Type": "AdvancePayment"
}, {
    "Amount": 468.0000,
    "Comment": "Advance Payment on Invoice Test #1111111461",
    "Date": "2013-06-10 12:00:00",
    "Id": 23438898,
    "Type": "AdvancePayment"
}]

POST Operation

Assigns multiple credits to an invoice. The API returns updated invoice in response(HTTP Status 200).

URL : /internal/invoices/{invoiceid}/credits

Example request for POST of credit


[{
    "Amount": 100.0000,
    "Comment": "Advance Payment on Invoice Test #1111111462",
    "Date": "2013-06-10 12:00:00",
    "Id": 23438895,
    "Type": "AdvancePayment"
},
{
    "Amount": 150.0000,
    "Comment": "Overpayment on Invoice Test #1111111462",
    "Date": "2013-06-15 12:00:00",
    "Id": 6745454,
    "Type": "OverPayment"
}]

Example response for POST of credit


{
  "Address": {
    "AddressLine1": 123 Tooley Street,
    "AddressLine2": null,
    "AddressLine3": null,
    "AddressLine4": null,
    "PostalCode": null
  },
  "Currency": {
    "Code": "GBP",
    "ExchangeRate": 1.0000,
    "Id": 0,
    "Name": "British Pounds",
    "Symbol": "£",
    "DisplaySymbolOnRight": false
  },
  "AutomaticCreditControlEnabled": true,
  "CustomerDiscount": 0,
  "CustomerId": 0,
  "CustomerName": null,
  "CustomerReference": null,
  "DeliveryAddress": null,
  "DueDate": "2012-10-09 12:00:00 +05:30",
  "EmailCount": 0,
  "GrossAmount": 117.5000,
  "HomeCurrencyGrossAmount: 117.5000, 
  "Id": 196172,
  "InvoiceInECMemberState": false,
  "InvoiceOutsideECMemberState": true,
  "IssuedDate": "2012-10-09 12:00:00 +05:30",
  "LineItems": [{
    "ApplyTax1": false,
    "ApplyTax2": false,
    "ApplyTax3": false,
    "ApplyTax4": false,
    "ApplyTax5": false,
    "NominalCode": 2341,
    "Description": "",
    "Number": 1,
    "ProductCode": "510",
    "ProductName": "Mobile",
    "Quantity": 10.0000,
    "Rate": 10.0000,
    "Tax1Amount": 0.0000,
    "Tax2Amount": 0.0000,
    "Tax3Amount": 0.0000,
    "Tax4Amount": 0.0000,
    "Tax5Amount": 0.0000,
    "VATAmount": 17.5000,
    "VATExempt": 0,
    "VATLevel": 17.5000,
    "ProjectNumber": 0
  }],
  "LastPaymentDate": "2012-10-09 12:00:00 +05:30",
  "NetAmount": 100.0000,
  "Number": 2,
  "OverdueDays": 0,
  "PaidDate": null,
  "PaymentLines": [{
    "AccountId": 55166,
    "Amount": 110.5000,
    "Id": 2,
    "InvoiceNumber": 0,
    "Date": "2012-10-09 12:00:00 +05:30",
    "Method": 409844,
    "Note": "Test Payment",
    "Permalink": "/v2/documents/invoice/payment/3a22b041-8d45-496a-946d-bd2252a0d28c"
  }, {
    "AccountId": 55166,
    "Amount": 7.0000,
    "Id": 53,
    "InvoiceNumber": 0,
    "Date": "2012-10-09 12:00:00 +05:30",
    "Method": 409844,
    "Note": "",
    "Permalink": "/v2/documents/invoice/payment/3a22b041-8d45-496a-946d-bd2252a0d546"
  }],
  "Status": "Paid",
  "SuppressNumber": 0,
  "TotalPaidAmount": 117.5000,
  "UpdateCustomerAddress": false,
  "UpdateCustomerDeliveryAddress": false,
  "UseCustomDeliveryAddress": false,
  "VATAmount": 17.5000,
  "VATNumber": "",
  "PreviousNumber" : 1,
  "NextNumber" : 3,
  "Permalink": "/v2/documents/invoice/3a22b041-8d45-496a-946d-bd2252a0d28c",
  "PackingSlipPermalink": "v2/documents/packingslip/3a22b041-8d45-496a-946d-bd2252a0d28c"
  "ReminderLetters": [{
    "IsSent": true,
    "Number": 3,
    "SentDate": "2012-07-30 12:00:00"
  }, {
    "IsSent": true,
    "Number": 1,
    "SentDate": "2008-01-02 12:00:00"
  }, {
    "IsSent": true,
    "Number": 2,
    "SentDate": "2008-01-02 12:00:00"
  }],
  "IsWhtDeductionToBeApplied": true
}

See how KashFlow works with your business and your books