SalePayments

The latest version of the Cin7 Core API (V2) is available, with more advanced functionality and support for recent system changes. See the full API documentation to get started.

The SalePayments resource allows getting detailed info about Prepayments, Payments and Refunds for particular Sale or for all sales, create new payment or update existing and delete payment. This is how you call it:

  • /SalePayments – returns paginated list with first 100 payments for tenant.
  • /SalePayments?page=2&limit=200&taskid=E6E8163F-6911-40e9-B740-90E5A0A3A996 – returns list of 200 payments for sale task with specified ID, started from 201 to 400 payment.

The full range of URIs and HTTP Verbs supported are:

Operation HTTP Action
List of paginated Payments for Tenant GET /SalePayments/
Create new Payment POST /SalePayments
Modify Payment PUT /SalePayments
Delete Payment DELETE /SalePayments/{id}

These filters can be used with the GET SalePayments endpoint:

Filter Description
limit Specifies the page size for pagination. Default page size is 100.
taskid Only return prepayments, payments and refunds for specified Sale task.

Filters are used by adding the filter and value to the URI: /SalePayments?page=2&limit=500&taskid= E6E8163F-6911-40e9-B740-90E5A0A3A996

Available Fields for Payment:

Property Type Length Required Notes
TaskID String 50 Yes Identifier for Sale task, which current payment belongs to
ID String 50 Ignored for POST, Required for PUT and DELETE
Reference String 50 Payment reference number
Amount Decimal with up to 2 decimal places Yes Payment amount in customer currency
DatePaid Date Yes Date when payment has been made
Account String 50 Yes Account Code of the bank/payment account from Chart of accounts
CurrencyRate Decimal with up to 5 decimal places Yes Currency Conversion rate expressed as number of Base currency units for one Customer currency unit.
DateCreated Date Date of creation payment record. Ignored for POST, PUT.
Type String enum Yes See valid values below

Valid values for Type:

Value Description
PREPAYMENT Prepayment
PAYMENT Regular payment
REFUND Refund payment

Create new Payment

To create new Payment you need to send POST request to SalePayments endpoint with Payment structure (see above) as payload.

Payment creation details

The following properties of the Payment are read-only for POST request. If any of these properties are included in the request, it will be ignored.

  • ID
  • DateCreated

The properties marked “Required” are required for POST request. The request won’t be fulfilled unless these properties are valid.

Sample of payload

POST /SalePayments

{ "TaskID": "E6E8163F-6911-40e9-B740-90E5A0A3A996", "Reference": "Test payment", "Amount": 12.45, "DatePaid": "2015/01/01", "Account": "620", "CurrencyRate": 1.12, "Type": "PREPAYMENT" }

Return value

In case if no errors occurred you will receive response with newly created Payment structure, otherwise you will receive response with error list, like this:

[{ “ErrorCode”:400, “Exception”:”Error explanation will be here” }, { “ErrorCode”:400, “Exception”:”Amount can’t be negative” }]

Update existing Payment

To update Payment you need to send PUT request to SalePayments endpoint with part of Payment structure as payload. You also could provide full structure’s data as payload, but in this case all not read-only fields will be updated.

Payment update details

The following properties of the Payment are read-only for PUT request. You can’t update it.

  • ID
  • DateCreated
  • TaskID
  • Type

All provided fields of Payment, except read-only fields will be updated.

Samples of update request

PUT /SalePayments/_some_guid_

{ “Amount”: 15.50 }

Return value

In case if no errors occurred you will receive response with updated Payment structure, otherwise you will receive response with error list, like this:

[{ “ErrorCode”:400, “Exception”:”Error explanation will be here” }, { “ErrorCode”:400, “Exception”:”Error explanation will be here” }]

Delete existing Payment

To delete Payment you need to send DELETE request to SalePayments endpoint with ID of payment as parameter

Return value

In case if no errors occurred you will receive HTTP Status code 200 – OK.

Was this article helpful?

Have more questions? Submit a request