@codat/lending 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -1
- package/dist/sdk/companies.d.ts +22 -7
- package/dist/sdk/companies.js +22 -7
- package/dist/sdk/models/operations/getcreateoperation.d.ts +1 -1
- package/dist/sdk/models/shared/accountingbillcreditnote.d.ts +2 -2
- package/dist/sdk/models/shared/accountingbillcreditnote.js +3 -3
- package/dist/sdk/models/shared/accountingcreateaccountresponse.d.ts +171 -34
- package/dist/sdk/models/shared/accountingcreateaccountresponse.js +194 -4
- package/dist/sdk/models/shared/accountingcreatebankaccountresponse.d.ts +116 -22
- package/dist/sdk/models/shared/accountingcreatebankaccountresponse.js +118 -4
- package/dist/sdk/models/shared/accountingcreatebanktransactionsresponse.d.ts +12 -2
- package/dist/sdk/models/shared/accountingcreatebanktransactionsresponse.js +26 -4
- package/dist/sdk/models/shared/accountingcreatedirectcostresponse.d.ts +165 -18
- package/dist/sdk/models/shared/accountingcreatedirectcostresponse.js +150 -4
- package/dist/sdk/models/shared/accountingcreatepaymentresponse.d.ts +797 -675
- package/dist/sdk/models/shared/accountingcreatepaymentresponse.js +782 -4
- package/dist/sdk/models/shared/accountingcreatesupplierresponse.d.ts +69 -11
- package/dist/sdk/models/shared/accountingcreatesupplierresponse.js +99 -4
- package/dist/sdk/models/shared/accountingcreatetransferresponse.d.ts +81 -9
- package/dist/sdk/models/shared/accountingcreatetransferresponse.js +93 -4
- package/dist/sdk/models/shared/accountingcreditnote.d.ts +2 -2
- package/dist/sdk/models/shared/accountingcreditnote.js +3 -3
- package/dist/sdk/models/shared/accountingdirectcost.d.ts +11 -5
- package/dist/sdk/models/shared/accountingdirectcost.js +18 -11
- package/dist/sdk/models/shared/accountinginvoice.d.ts +10 -5
- package/dist/sdk/models/shared/accountinginvoice.js +11 -5
- package/dist/sdk/models/shared/accountingjournalentry.d.ts +3 -7
- package/dist/sdk/models/shared/accountingjournalentry.js +3 -3
- package/dist/sdk/models/shared/accounttransactionline.d.ts +3 -7
- package/dist/sdk/models/shared/accounttransactionline.js +3 -3
- package/dist/sdk/models/shared/accounttransactionlinerecordref.d.ts +30 -0
- package/dist/sdk/models/shared/accounttransactionlinerecordref.js +70 -0
- package/dist/sdk/models/shared/bankingtransactioncategory.d.ts +5 -1
- package/dist/sdk/models/shared/bankingtransactioncategory.js +5 -1
- package/dist/sdk/models/shared/company.d.ts +10 -0
- package/dist/sdk/models/shared/company.js +20 -1
- package/dist/sdk/models/shared/companyrequestbody.d.ts +5 -0
- package/dist/sdk/models/shared/companyrequestbody.js +7 -0
- package/dist/sdk/models/shared/connection.d.ts +2 -0
- package/dist/sdk/models/shared/connection.js +2 -0
- package/dist/sdk/models/shared/contactref.d.ts +9 -3
- package/dist/sdk/models/shared/contactref.js +9 -2
- package/dist/sdk/models/shared/directcostprototype.d.ts +11 -5
- package/dist/sdk/models/shared/directcostprototype.js +18 -11
- package/dist/sdk/models/shared/errormessage.d.ts +5 -0
- package/dist/sdk/models/shared/errormessage.js +7 -0
- package/dist/sdk/models/shared/errorvalidation.d.ts +9 -0
- package/dist/sdk/models/shared/errorvalidation.js +56 -0
- package/dist/sdk/models/shared/errorvalidationitem.d.ts +15 -0
- package/dist/sdk/models/shared/errorvalidationitem.js +55 -0
- package/dist/sdk/models/shared/index.d.ts +6 -0
- package/dist/sdk/models/shared/index.js +6 -0
- package/dist/sdk/models/shared/invoicelineitem.d.ts +0 -2
- package/dist/sdk/models/shared/items.d.ts +2 -6
- package/dist/sdk/models/shared/items.js +2 -7
- package/dist/sdk/models/shared/journalentryrecordref.d.ts +30 -0
- package/dist/sdk/models/shared/journalentryrecordref.js +70 -0
- package/dist/sdk/models/shared/journalline.d.ts +2 -2
- package/dist/sdk/models/shared/journalline.js +3 -3
- package/dist/sdk/models/shared/tracking.d.ts +2 -1
- package/dist/sdk/models/shared/tracking.js +3 -2
- package/dist/sdk/models/shared/trackingrecordref.d.ts +22 -0
- package/dist/sdk/models/shared/trackingrecordref.js +62 -0
- package/dist/sdk/models/shared/withholdingtaxitems.d.ts +11 -0
- package/dist/sdk/models/shared/withholdingtaxitems.js +50 -0
- package/dist/sdk/sdk.js +3 -3
- package/docs/sdk/models/operations/createcompanyresponse.md +7 -7
- package/docs/sdk/models/operations/createconnectionresponse.md +7 -7
- package/docs/sdk/models/operations/createsupplierrequest.md +7 -7
- package/docs/sdk/models/operations/getaccountingagedcreditorsreportresponse.md +7 -7
- package/docs/sdk/models/operations/getaccountingageddebtorsreportresponse.md +7 -7
- package/docs/sdk/models/operations/getaccountingbillcreditnoteresponse.md +7 -7
- package/docs/sdk/models/operations/getaccountingbillpaymentresponse.md +7 -7
- package/docs/sdk/models/operations/getaccountingcreditnoteresponse.md +7 -7
- package/docs/sdk/models/operations/getaccountingprofileresponse.md +7 -7
- package/docs/sdk/models/operations/getaccountingsupplierresponse.md +7 -7
- package/docs/sdk/models/operations/getbankingaccountresponse.md +7 -7
- package/docs/sdk/models/operations/getbankingtransactioncategoryresponse.md +7 -7
- package/docs/sdk/models/operations/getbankingtransactionresponse.md +7 -7
- package/docs/sdk/models/operations/getcategorizedbalancesheetstatementresponse.md +7 -7
- package/docs/sdk/models/operations/getcategorizedprofitandlossstatementresponse.md +7 -7
- package/docs/sdk/models/operations/getcommercecustomerresponse.md +7 -7
- package/docs/sdk/models/operations/getcommercedisputeresponse.md +7 -7
- package/docs/sdk/models/operations/getcommercelocationresponse.md +7 -7
- package/docs/sdk/models/operations/getcommerceorderresponse.md +7 -7
- package/docs/sdk/models/operations/getcommerceproductcategoryresponse.md +7 -7
- package/docs/sdk/models/operations/getcompanyresponse.md +7 -7
- package/docs/sdk/models/operations/getconnectionresponse.md +7 -7
- package/docs/sdk/models/operations/getcreateoperationrequest.md +4 -4
- package/docs/sdk/models/operations/getloansummaryresponse.md +7 -7
- package/docs/sdk/models/operations/getpulloperationresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingaccountsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingaccounttransactionsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingbankaccountsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingbankaccounttransactionsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingbillcreditnotesresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingbillpaymentsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingbillsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingcreditnotesresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingcustomersresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingdirectcostsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingdirectincomesresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountinginvoicesresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingjournalentriesresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingjournalsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingpaymentsresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingsuppliersresponse.md +7 -7
- package/docs/sdk/models/operations/listaccountingtransfersresponse.md +7 -7
- package/docs/sdk/models/operations/listbankingaccountbalancesresponse.md +7 -7
- package/docs/sdk/models/operations/listbankingaccountsresponse.md +7 -7
- package/docs/sdk/models/operations/listbankingtransactioncategoriesresponse.md +7 -7
- package/docs/sdk/models/operations/listbankingtransactionsresponse.md +7 -7
- package/docs/sdk/models/operations/listcommercecustomersresponse.md +7 -7
- package/docs/sdk/models/operations/listcommercedisputesresponse.md +7 -7
- package/docs/sdk/models/operations/listcommercelocationsresponse.md +7 -7
- package/docs/sdk/models/operations/listcommerceordersresponse.md +7 -7
- package/docs/sdk/models/operations/listcommercepaymentmethodsresponse.md +7 -7
- package/docs/sdk/models/operations/listcommercepaymentsresponse.md +7 -7
- package/docs/sdk/models/operations/listcommerceproductcategoriesresponse.md +7 -7
- package/docs/sdk/models/operations/listcommerceproductsresponse.md +7 -7
- package/docs/sdk/models/operations/listcommercetransactionsresponse.md +7 -7
- package/docs/sdk/models/operations/listcompaniesresponse.md +7 -7
- package/docs/sdk/models/operations/listconnectionsresponse.md +7 -7
- package/docs/sdk/models/operations/listcreateoperationsresponse.md +7 -7
- package/docs/sdk/models/operations/listdataintegritydetailsresponse.md +7 -7
- package/docs/sdk/models/operations/listloantransactionsresponse.md +7 -7
- package/docs/sdk/models/operations/listpulloperationsresponse.md +7 -7
- package/docs/sdk/models/operations/refreshdatatyperesponse.md +7 -7
- package/docs/sdk/models/operations/unlinkconnectionresponse.md +7 -7
- package/docs/sdk/models/operations/updatecompanyresponse.md +7 -7
- package/docs/sdk/models/shared/accountingaccounts.md +7 -7
- package/docs/sdk/models/shared/accountingaccounttransactions.md +7 -7
- package/docs/sdk/models/shared/accountingbankaccounts.md +7 -7
- package/docs/sdk/models/shared/accountingbanktransactions.md +7 -7
- package/docs/sdk/models/shared/accountingbillcreditnote.md +1 -1
- package/docs/sdk/models/shared/accountingbillcreditnotes.md +7 -7
- package/docs/sdk/models/shared/accountingbillpayment.md +1 -1
- package/docs/sdk/models/shared/accountingbillpayments.md +7 -7
- package/docs/sdk/models/shared/accountingbills.md +7 -7
- package/docs/sdk/models/shared/accountingcreateaccountresponse.md +16 -16
- package/docs/sdk/models/shared/accountingcreateaccountresponseaccountingaccount.md +54 -0
- package/docs/sdk/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md +50 -0
- package/docs/sdk/models/shared/accountingcreatebankaccountresponse.md +16 -16
- package/docs/sdk/models/shared/accountingcreatebankaccountresponseaccountingbankaccount.md +42 -0
- package/docs/sdk/models/shared/accountingcreatebankaccounttransactions.md +11 -0
- package/docs/sdk/models/shared/accountingcreatebanktransactionsresponse.md +1 -1
- package/docs/sdk/models/shared/accountingcreatedirectcostresponse.md +16 -16
- package/docs/sdk/models/shared/accountingcreatedirectcostresponseaccountingdirectcost.md +41 -0
- package/docs/sdk/models/shared/accountingcreatedirectcostresponsecontactreference.md +11 -0
- package/docs/sdk/models/shared/accountingcreatedirectcostresponsedatatype.md +11 -0
- package/docs/sdk/models/shared/accountingcreatepaymentresponse.md +16 -16
- package/docs/sdk/models/shared/accountingcreatepaymentresponseaccountingpayment.md +703 -0
- package/docs/sdk/models/shared/accountingcreatesupplierresponse.md +1 -1
- package/docs/sdk/models/shared/accountingcreatesupplierresponseaccountingsupplier.md +29 -0
- package/docs/sdk/models/shared/accountingcreatetransferresponse.md +1 -1
- package/docs/sdk/models/shared/accountingcreatetransferresponseaccountingtransfer.md +25 -0
- package/docs/sdk/models/shared/accountingcreditnote.md +1 -1
- package/docs/sdk/models/shared/accountingcreditnotes.md +7 -7
- package/docs/sdk/models/shared/accountingcustomers.md +7 -7
- package/docs/sdk/models/shared/accountingdirectcost.md +1 -1
- package/docs/sdk/models/shared/accountingdirectcostcontactreference.md +11 -0
- package/docs/sdk/models/shared/accountingdirectcostdatatype.md +11 -0
- package/docs/sdk/models/shared/accountingdirectcosts.md +7 -7
- package/docs/sdk/models/shared/accountingdirectincomes.md +7 -7
- package/docs/sdk/models/shared/accountinginvoice.md +1 -1
- package/docs/sdk/models/shared/accountinginvoicedatatype.md +10 -0
- package/docs/sdk/models/shared/accountinginvoices.md +7 -7
- package/docs/sdk/models/shared/accountingjournalentries.md +7 -7
- package/docs/sdk/models/shared/accountingjournalentry.md +1 -1
- package/docs/sdk/models/shared/accountingjournals.md +7 -7
- package/docs/sdk/models/shared/accountingpayment.md +1 -1
- package/docs/sdk/models/shared/accountingpayments.md +7 -7
- package/docs/sdk/models/shared/accountingsuppliers.md +7 -7
- package/docs/sdk/models/shared/accountingtransfers.md +7 -7
- package/docs/sdk/models/shared/accounts.md +1 -1
- package/docs/sdk/models/shared/accounttransactionline.md +5 -5
- package/docs/sdk/models/shared/accounttransactionlinerecordref.md +11 -0
- package/docs/sdk/models/shared/accounttransactionlinerecordrefdatatype.md +20 -0
- package/docs/sdk/models/shared/bankingaccountbalances.md +7 -7
- package/docs/sdk/models/shared/bankingaccounts.md +7 -7
- package/docs/sdk/models/shared/bankingtransactioncategories.md +7 -7
- package/docs/sdk/models/shared/bankingtransactioncategory.md +3 -1
- package/docs/sdk/models/shared/bankingtransactions.md +7 -7
- package/docs/sdk/models/shared/commercecustomers.md +7 -7
- package/docs/sdk/models/shared/commercedisputes.md +7 -7
- package/docs/sdk/models/shared/commercelocations.md +7 -7
- package/docs/sdk/models/shared/commerceorders.md +7 -7
- package/docs/sdk/models/shared/commercepayment.md +1 -1
- package/docs/sdk/models/shared/commercepaymentmethods.md +7 -7
- package/docs/sdk/models/shared/commercepayments.md +7 -7
- package/docs/sdk/models/shared/commerceproductcategories.md +7 -7
- package/docs/sdk/models/shared/commerceproducts.md +7 -7
- package/docs/sdk/models/shared/commercetransactions.md +7 -7
- package/docs/sdk/models/shared/companies.md +7 -7
- package/docs/sdk/models/shared/company.md +1 -0
- package/docs/sdk/models/shared/companyrequestbody.md +1 -0
- package/docs/sdk/models/shared/connections.md +7 -7
- package/docs/sdk/models/shared/contactref.md +4 -4
- package/docs/sdk/models/shared/contactrefdatatype.md +11 -0
- package/docs/sdk/models/shared/contactreference.md +11 -0
- package/docs/sdk/models/shared/dataintegritydetails.md +7 -7
- package/docs/sdk/models/shared/directcostprototype.md +1 -1
- package/docs/sdk/models/shared/directcostprototypedatatype.md +11 -0
- package/docs/sdk/models/shared/enhancedcashflowtransaction.md +2 -2
- package/docs/sdk/models/shared/enhancedcashflowtransactions.md +5 -5
- package/docs/sdk/models/shared/enhancedinvoicesreport.md +4 -4
- package/docs/sdk/models/shared/errormessage.md +9 -8
- package/docs/sdk/models/shared/errorvalidation.md +11 -0
- package/docs/sdk/models/shared/errorvalidationitem.md +10 -0
- package/docs/sdk/models/shared/groupreference.md +8 -0
- package/docs/sdk/models/shared/invoicelineitem.md +1 -1
- package/docs/sdk/models/shared/items.md +3 -4
- package/docs/sdk/models/shared/journalentryrecordref.md +11 -0
- package/docs/sdk/models/shared/journalentryrecordrefdatatype.md +20 -0
- package/docs/sdk/models/shared/journallinetracking.md +3 -3
- package/docs/sdk/models/shared/pulloperations.md +7 -7
- package/docs/sdk/models/shared/pushoperations.md +7 -7
- package/docs/sdk/models/shared/salesorderreference.md +4 -4
- package/docs/sdk/models/shared/sourcetype.md +2 -0
- package/docs/sdk/models/shared/tracking.md +1 -1
- package/docs/sdk/models/shared/trackingrecordref.md +11 -0
- package/docs/sdk/models/shared/trackingrecordrefdatatype.md +12 -0
- package/docs/sdk/models/shared/withholdingtaxitems.md +9 -0
- package/docs/sdks/accountbalances/README.md +1 -1
- package/docs/sdks/accounts/README.md +2 -2
- package/docs/sdks/accounttransactions/README.md +2 -2
- package/docs/sdks/balancesheet/README.md +2 -2
- package/docs/sdks/bankaccounts/README.md +2 -2
- package/docs/sdks/banktransactions/README.md +2 -2
- package/docs/sdks/billcreditnotes/README.md +2 -2
- package/docs/sdks/billpayments/README.md +2 -2
- package/docs/sdks/bills/README.md +5 -5
- package/docs/sdks/cashflow/README.md +1 -1
- package/docs/sdks/categorizedstatement/README.md +1 -1
- package/docs/sdks/codatlendingaccountingbankdata/README.md +1 -1
- package/docs/sdks/codatlendingaccounts/README.md +2 -2
- package/docs/sdks/codatlendingbankingtransactions/README.md +2 -2
- package/docs/sdks/codatlendingcustomers/README.md +2 -2
- package/docs/sdks/codatlendingdirectcosts/README.md +5 -5
- package/docs/sdks/codatlendingfinancialstatementsaccounts/README.md +2 -2
- package/docs/sdks/codatlendingloanwritebackaccounts/README.md +2 -2
- package/docs/sdks/codatlendingpayments/README.md +4 -3
- package/docs/sdks/codatlendingreports/README.md +2 -2
- package/docs/sdks/codatlendingsalespayments/README.md +2 -2
- package/docs/sdks/codatlendingsuppliers/README.md +26 -7
- package/docs/sdks/codatlendingtransactions/README.md +2 -2
- package/docs/sdks/codatlendingtransfers/README.md +2 -2
- package/docs/sdks/companies/README.md +38 -13
- package/docs/sdks/companyinfo/README.md +2 -2
- package/docs/sdks/connections/README.md +5 -5
- package/docs/sdks/createoperations/README.md +2 -2
- package/docs/sdks/creditnotes/README.md +2 -2
- package/docs/sdks/customers/README.md +5 -5
- package/docs/sdks/dataintegrity/README.md +3 -3
- package/docs/sdks/directcosts/README.md +10 -11
- package/docs/sdks/directincomes/README.md +5 -5
- package/docs/sdks/disputes/README.md +2 -2
- package/docs/sdks/excelreports/README.md +3 -3
- package/docs/sdks/fileupload/README.md +3 -3
- package/docs/sdks/invoices/README.md +7 -7
- package/docs/sdks/journalentries/README.md +2 -2
- package/docs/sdks/journals/README.md +2 -2
- package/docs/sdks/liabilities/README.md +4 -4
- package/docs/sdks/locations/README.md +2 -2
- package/docs/sdks/managedata/README.md +1 -1
- package/docs/sdks/metrics/README.md +3 -3
- package/docs/sdks/orders/README.md +2 -2
- package/docs/sdks/paymentmethods/README.md +2 -2
- package/docs/sdks/payments/README.md +2 -2
- package/docs/sdks/productcategories/README.md +2 -2
- package/docs/sdks/products/README.md +2 -2
- package/docs/sdks/profitandloss/README.md +2 -2
- package/docs/sdks/pulloperations/README.md +2 -2
- package/docs/sdks/refresh/README.md +2 -2
- package/docs/sdks/reports/README.md +4 -4
- package/docs/sdks/suppliers/README.md +5 -5
- package/docs/sdks/transactioncategories/README.md +2 -2
- package/docs/sdks/transfers/README.md +3 -4
- package/package.json +1 -1
- package/docs/sdk/models/shared/accountingdirectcostcontactref.md +0 -11
- package/docs/sdk/models/shared/directcostprototypecontactref.md +0 -11
|
@@ -1,725 +1,847 @@
|
|
|
1
1
|
import { SpeakeasyBase } from "../../../internal/utils";
|
|
2
|
-
import {
|
|
2
|
+
import { AccountingCustomerRef } from "./accountingcustomerref";
|
|
3
|
+
import { AccountRef } from "./accountref";
|
|
3
4
|
import { DataType } from "./datatype";
|
|
5
|
+
import { Metadata } from "./metadata";
|
|
6
|
+
import { PaymentLine } from "./paymentline";
|
|
7
|
+
import { PaymentMethodRef } from "./paymentmethodref";
|
|
4
8
|
import { PushOperationChange } from "./pushoperationchange";
|
|
5
9
|
import { PushOperationStatus } from "./pushoperationstatus";
|
|
10
|
+
import { SupplementalData } from "./supplementaldata";
|
|
6
11
|
import { Validation } from "./validation";
|
|
7
|
-
|
|
12
|
+
/**
|
|
13
|
+
* > **Payments or bill payments?**
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* >
|
|
17
|
+
* > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills.
|
|
18
|
+
*
|
|
19
|
+
* > View the coverage for payments in the <a className="external" href="https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=payments" target="_blank">Data coverage explorer</a>.
|
|
20
|
+
*
|
|
21
|
+
* ## Overview
|
|
22
|
+
*
|
|
23
|
+
* Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote).
|
|
24
|
+
*
|
|
25
|
+
* A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to:
|
|
26
|
+
*
|
|
27
|
+
* - A payment made against an invoice, like a credit card, cheque, or cash payment.
|
|
28
|
+
* - An allocation of a customer's credit note, either to an invoice or maybe a refund.
|
|
29
|
+
* - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account.
|
|
30
|
+
*
|
|
31
|
+
* Depending on the payments allowed by the underlying accounting package, some payment types may be combined. Please see the example for more details.
|
|
32
|
+
*
|
|
33
|
+
* In Codat, a payment contains details of:
|
|
34
|
+
*
|
|
35
|
+
* - When the payment was recorded in the accounting system.
|
|
36
|
+
* - How much it is for and in what currency that amount is in.
|
|
37
|
+
* - Who the payment was _paid by_ – the _customer_.
|
|
38
|
+
* - The payment method used.
|
|
39
|
+
* - The breakdown of the types of payments – the _line items_.
|
|
40
|
+
*
|
|
41
|
+
* Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction).
|
|
42
|
+
*
|
|
43
|
+
* ## Payment types
|
|
44
|
+
*
|
|
45
|
+
* ## Payment of an invoice
|
|
46
|
+
*
|
|
47
|
+
* A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties:
|
|
48
|
+
*
|
|
49
|
+
* - An _amount_ that indicates the amount of the invoice that was paid. This is always positive.
|
|
50
|
+
* - A **links** array containing one element with the following properties:
|
|
51
|
+
* - A **type** that indicates the type of **link**, in this case an `Invoice`.
|
|
52
|
+
* - An **id** that contains the ID of the invoice that was paid.
|
|
53
|
+
* - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`.
|
|
54
|
+
*
|
|
55
|
+
* The **amount** field on the **line** equals the **totalAmount** on the payment.
|
|
56
|
+
*
|
|
57
|
+
* ## Payment of multiple invoices
|
|
58
|
+
*
|
|
59
|
+
* A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books:
|
|
60
|
+
*
|
|
61
|
+
* - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice).
|
|
62
|
+
* - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available.
|
|
63
|
+
*
|
|
64
|
+
* Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment.
|
|
65
|
+
*
|
|
66
|
+
* ## Payments and refunds on account
|
|
67
|
+
*
|
|
68
|
+
* A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties:
|
|
69
|
+
*
|
|
70
|
+
* - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive.
|
|
71
|
+
* - A **links** array containing one element with the following properties:
|
|
72
|
+
* - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`.
|
|
73
|
+
* - The **id** containing the ID of the customer.
|
|
74
|
+
* - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund.
|
|
75
|
+
*
|
|
76
|
+
* It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above.
|
|
77
|
+
*
|
|
78
|
+
* ## Using a credit note to pay an invoice
|
|
79
|
+
*
|
|
80
|
+
* The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties:
|
|
81
|
+
*
|
|
82
|
+
* - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other.
|
|
83
|
+
* - A **links** array containing two elements:
|
|
84
|
+
* - The first **link** has:
|
|
85
|
+
* - A **type** that indicates the type of **link**, in this case an `Invoice`.
|
|
86
|
+
* - An **id** that contains the ID of the invoice that was paid.
|
|
87
|
+
* - The second **link** has:
|
|
88
|
+
* - A **type** that indicates the type of **link**, in this case a `CreditNote`.
|
|
89
|
+
* - An **id** that contains the ID of the credit note used by this payment.
|
|
90
|
+
*
|
|
91
|
+
* The **amount** field on the **line** equals the **totalAmount** on the payment.
|
|
92
|
+
*
|
|
93
|
+
* ## Refunding a credit note
|
|
94
|
+
*
|
|
95
|
+
* A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties:
|
|
96
|
+
*
|
|
97
|
+
* - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund.
|
|
98
|
+
* - A **links** array that contains one element with the following properties:
|
|
99
|
+
* - A **type** that indicates the type of **link**, in this case a `CreditNote`.
|
|
100
|
+
* - An **id** that contains the ID of the credit note that was refunded.
|
|
101
|
+
*
|
|
102
|
+
* The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable.
|
|
103
|
+
*
|
|
104
|
+
* ## Refunding a payment
|
|
105
|
+
*
|
|
106
|
+
* If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records:
|
|
107
|
+
*
|
|
108
|
+
* - One for the incoming over payment.
|
|
109
|
+
* - Another for the outgoing refund.
|
|
110
|
+
*
|
|
111
|
+
* The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties:
|
|
112
|
+
*
|
|
113
|
+
* - An **amount** that indicates the amount that was refunded. This is always negative.
|
|
114
|
+
* - A **links** array that contains one element with the following properties:
|
|
115
|
+
* - A **type** that indicates the type of **link**, in this case a `Payment`.
|
|
116
|
+
* - An **id** that contains the ID of the payment that was refunded.
|
|
117
|
+
*
|
|
118
|
+
* The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable.
|
|
119
|
+
*
|
|
120
|
+
* The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice.
|
|
121
|
+
*
|
|
122
|
+
* For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines:
|
|
123
|
+
*
|
|
124
|
+
* - One for £1,000 linked to the invoice that was paid.
|
|
125
|
+
* - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment.
|
|
126
|
+
*
|
|
127
|
+
* The **line** linked to the payment has the following properties:
|
|
128
|
+
*
|
|
129
|
+
* - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund.
|
|
130
|
+
* - A **links** array containing one element with the following properties:
|
|
131
|
+
* - A **type** that indicates the type of **link**, in this case a `Refund`.
|
|
132
|
+
* - An **id** that contains the ID of the payment that refunded this line.
|
|
133
|
+
*
|
|
134
|
+
* > **Support for linked payments**
|
|
135
|
+
* >
|
|
136
|
+
* > Not all accounting packages support linking payments in this way. In some platforms, you may see a payment on account and a refund on account.
|
|
137
|
+
*
|
|
138
|
+
* ## Foreign currencies
|
|
139
|
+
*
|
|
140
|
+
* There are two types of currency rate that are included in the payments data type:
|
|
141
|
+
*
|
|
142
|
+
* Payment currency rate:
|
|
143
|
+
*
|
|
144
|
+
* - Base currency of the accounts receivable account.
|
|
145
|
+
* - Foreign currency of the payment.
|
|
146
|
+
*
|
|
147
|
+
* Payment line link currency rate:
|
|
148
|
+
*
|
|
149
|
+
* - Base currency of the item the link represents.
|
|
150
|
+
* - Foreign currency of the payment.
|
|
151
|
+
*
|
|
152
|
+
* These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either:
|
|
153
|
+
*
|
|
154
|
+
* - The base currency for the accounts receivable account.
|
|
155
|
+
* - The currency of the item.
|
|
156
|
+
*
|
|
157
|
+
* ```json title="Currency rate example"
|
|
158
|
+
* {
|
|
159
|
+
* "id": "123",
|
|
160
|
+
* "note": "",
|
|
161
|
+
* "totalAmount": 99.99,
|
|
162
|
+
* "currency": "GBP",
|
|
163
|
+
* "lines": [
|
|
164
|
+
* {
|
|
165
|
+
* "amount": 99.99,
|
|
166
|
+
* "links": [
|
|
167
|
+
* {
|
|
168
|
+
* "type": "Invoice",
|
|
169
|
+
* "id": "178",
|
|
170
|
+
* "amount": -50,
|
|
171
|
+
* "currencyRate": 1.9998
|
|
172
|
+
* }
|
|
173
|
+
* ]
|
|
174
|
+
* }
|
|
175
|
+
* ]
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
*
|
|
180
|
+
*
|
|
181
|
+
* ## Example data
|
|
182
|
+
*
|
|
183
|
+
* > **Object properties**
|
|
184
|
+
* >
|
|
185
|
+
* > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments).
|
|
186
|
+
*
|
|
187
|
+
* ## Simple examples
|
|
188
|
+
*
|
|
189
|
+
* ```json title="Payment for invoice"
|
|
190
|
+
* {
|
|
191
|
+
* "totalAmount": 1000,
|
|
192
|
+
* "lines": [
|
|
193
|
+
* {
|
|
194
|
+
* "amount" : 1000,
|
|
195
|
+
* "links" : [
|
|
196
|
+
* {
|
|
197
|
+
* "type" : "Invoice",
|
|
198
|
+
* "id" : "x",
|
|
199
|
+
* "amount" : -1000
|
|
200
|
+
* }
|
|
201
|
+
* ]
|
|
202
|
+
* }
|
|
203
|
+
* ]
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
*
|
|
208
|
+
*
|
|
209
|
+
* ```json title="Allocation of credit note"
|
|
210
|
+
* {
|
|
211
|
+
* "totalAmount": 0,
|
|
212
|
+
* "lines": [
|
|
213
|
+
* {
|
|
214
|
+
* "amount" : 0,
|
|
215
|
+
* "links" : [
|
|
216
|
+
* {
|
|
217
|
+
* "type" : "Invoice",
|
|
218
|
+
* "id" : "x",
|
|
219
|
+
* "amount" : -1000
|
|
220
|
+
* },
|
|
221
|
+
* {
|
|
222
|
+
* "type" : "CreditNote",
|
|
223
|
+
* "id" : "y",
|
|
224
|
+
* "amount" : 1000
|
|
225
|
+
* }
|
|
226
|
+
* ]
|
|
227
|
+
* }
|
|
228
|
+
* ]
|
|
229
|
+
* }
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
*
|
|
233
|
+
*
|
|
234
|
+
* ```json title="Payment of invoice and payment on account"
|
|
235
|
+
* {
|
|
236
|
+
* "totalAmount": 2000,
|
|
237
|
+
* "lines": [
|
|
238
|
+
* {
|
|
239
|
+
* "amount" : 1000,
|
|
240
|
+
* "links" : [
|
|
241
|
+
* {
|
|
242
|
+
* "type" : "Invoice",
|
|
243
|
+
* "id" : "x",
|
|
244
|
+
* "amount" : -1000
|
|
245
|
+
* }
|
|
246
|
+
* ]
|
|
247
|
+
* },
|
|
248
|
+
* {
|
|
249
|
+
* "amount" : 1000,
|
|
250
|
+
* "links" : [
|
|
251
|
+
* {
|
|
252
|
+
* "type" : "PaymentOnAccount",
|
|
253
|
+
* "id" : "y",
|
|
254
|
+
* "amount" : -1000
|
|
255
|
+
* }
|
|
256
|
+
* ]
|
|
257
|
+
* }
|
|
258
|
+
* ]
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
*
|
|
263
|
+
*
|
|
264
|
+
* ```json title="Refund of credit note"
|
|
265
|
+
* {
|
|
266
|
+
* "totalAmount": -1000,
|
|
267
|
+
* "lines": [
|
|
268
|
+
* {
|
|
269
|
+
* "amount" : -1000,
|
|
270
|
+
* "links" : [
|
|
271
|
+
* {
|
|
272
|
+
* "type" : "CreditNote",
|
|
273
|
+
* "id" : "y",
|
|
274
|
+
* "amount" : 1000
|
|
275
|
+
* }
|
|
276
|
+
* ]
|
|
277
|
+
* }
|
|
278
|
+
* ]
|
|
279
|
+
* }
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
*
|
|
283
|
+
*
|
|
284
|
+
* ```json title="Refund on accounts receivable account"
|
|
285
|
+
* {
|
|
286
|
+
* "totalAmount": -1000,
|
|
287
|
+
* "lines": [
|
|
288
|
+
* {
|
|
289
|
+
* "amount" : -1000,
|
|
290
|
+
* "links" : [
|
|
291
|
+
* {
|
|
292
|
+
* "type" : "PaymentOnAccount",
|
|
293
|
+
* "id" : "y",
|
|
294
|
+
* "amount" : 1000
|
|
295
|
+
* }
|
|
296
|
+
* ]
|
|
297
|
+
* }
|
|
298
|
+
* ]
|
|
299
|
+
* }
|
|
300
|
+
* ```
|
|
301
|
+
*
|
|
302
|
+
*
|
|
303
|
+
*
|
|
304
|
+
* ```json title="Linked refund on accounts receivable account"
|
|
305
|
+
* {
|
|
306
|
+
* "id" : "payment-001",
|
|
307
|
+
* "totalAmount": 1000,
|
|
308
|
+
* "lines": [
|
|
309
|
+
* {
|
|
310
|
+
* "amount" : 1000,
|
|
311
|
+
* "links" : [
|
|
312
|
+
* {
|
|
313
|
+
* "type" : "Refund",
|
|
314
|
+
* "id" : "refund-001",
|
|
315
|
+
* "amount" : -1000
|
|
316
|
+
* }
|
|
317
|
+
* ]
|
|
318
|
+
* }
|
|
319
|
+
* ]
|
|
320
|
+
* }
|
|
321
|
+
* {
|
|
322
|
+
* "id" : "refund-001",
|
|
323
|
+
* "totalAmount": -1000,
|
|
324
|
+
* "lines": [
|
|
325
|
+
* {
|
|
326
|
+
* "amount" : -1000,
|
|
327
|
+
* "links" : [
|
|
328
|
+
* {
|
|
329
|
+
* "type" : "Payment",
|
|
330
|
+
* "id" : "payment-001",
|
|
331
|
+
* "amount" : 1000
|
|
332
|
+
* }
|
|
333
|
+
* ]
|
|
334
|
+
* }
|
|
335
|
+
* ]
|
|
336
|
+
* }
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
*
|
|
340
|
+
*
|
|
341
|
+
* ```json title="Using a credit note and cash to pay an invoice"
|
|
342
|
+
* {
|
|
343
|
+
* "totalAmount": 250,
|
|
344
|
+
* "lines": [
|
|
345
|
+
* {
|
|
346
|
+
* "amount": 0,
|
|
347
|
+
* "links": [
|
|
348
|
+
* {
|
|
349
|
+
* "type": "Invoice",
|
|
350
|
+
* "id": "x",
|
|
351
|
+
* "amount": -750
|
|
352
|
+
* },
|
|
353
|
+
* {
|
|
354
|
+
* "type": "CreditNote",
|
|
355
|
+
* "id": "y",
|
|
356
|
+
* "amount": 750
|
|
357
|
+
* }
|
|
358
|
+
* ]
|
|
359
|
+
* },
|
|
360
|
+
* {
|
|
361
|
+
* "amount": 250,
|
|
362
|
+
* "links": [
|
|
363
|
+
* {
|
|
364
|
+
* "type": "Invoice",
|
|
365
|
+
* "id": "x",
|
|
366
|
+
* "amount": -250
|
|
367
|
+
* }
|
|
368
|
+
* ]
|
|
369
|
+
* }
|
|
370
|
+
* ]
|
|
371
|
+
* }
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
*
|
|
375
|
+
*
|
|
376
|
+
* ## Complex examples
|
|
377
|
+
*
|
|
378
|
+
* ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice"
|
|
379
|
+
* {
|
|
380
|
+
* "totalAmount": 1000,
|
|
381
|
+
* "lines": [
|
|
382
|
+
* {
|
|
383
|
+
* "amount" : 0,
|
|
384
|
+
* "links" : [
|
|
385
|
+
* {
|
|
386
|
+
* "type" : "Invoice",
|
|
387
|
+
* "id" : "x",
|
|
388
|
+
* "amount" : -1000
|
|
389
|
+
* },
|
|
390
|
+
* {
|
|
391
|
+
* "type" : "CreditNote",
|
|
392
|
+
* "id" : "y",
|
|
393
|
+
* "amount" : 1000
|
|
394
|
+
* }
|
|
395
|
+
* ]
|
|
396
|
+
* },
|
|
397
|
+
* {
|
|
398
|
+
* "amount" : 0,
|
|
399
|
+
* "links" : [
|
|
400
|
+
* {
|
|
401
|
+
* "type" : "Invoice",
|
|
402
|
+
* "id" : "x",
|
|
403
|
+
* "amount" : -1000
|
|
404
|
+
* },
|
|
405
|
+
* {
|
|
406
|
+
* "type" : "CreditNote",
|
|
407
|
+
* "id" : "z",
|
|
408
|
+
* "amount" : 1000
|
|
409
|
+
* }
|
|
410
|
+
* ]
|
|
411
|
+
* },
|
|
412
|
+
* {
|
|
413
|
+
* "amount" : 1000,
|
|
414
|
+
* "links" : [
|
|
415
|
+
* {
|
|
416
|
+
* "type" : "Invoice",
|
|
417
|
+
* "id" : "x",
|
|
418
|
+
* "amount" : -1000
|
|
419
|
+
* }
|
|
420
|
+
* ]
|
|
421
|
+
* }
|
|
422
|
+
* ]
|
|
423
|
+
* }
|
|
424
|
+
* ```
|
|
425
|
+
*
|
|
426
|
+
*
|
|
427
|
+
*
|
|
428
|
+
* ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'"
|
|
429
|
+
* {
|
|
430
|
+
* "totalAmount": 2000,
|
|
431
|
+
* "lines": [
|
|
432
|
+
* {
|
|
433
|
+
* "amount" : 0,
|
|
434
|
+
* "links" : [
|
|
435
|
+
* {
|
|
436
|
+
* "type" : "Invoice",
|
|
437
|
+
* "id" : "x",
|
|
438
|
+
* "amount" : -1000
|
|
439
|
+
* },
|
|
440
|
+
* {
|
|
441
|
+
* "type" : "CreditNote",
|
|
442
|
+
* "id" : "y",
|
|
443
|
+
* "amount" : 1000
|
|
444
|
+
* }
|
|
445
|
+
* ]
|
|
446
|
+
* },
|
|
447
|
+
* {
|
|
448
|
+
* "amount" : 0,
|
|
449
|
+
* "links" : [
|
|
450
|
+
* {
|
|
451
|
+
* "type" : "Invoice",
|
|
452
|
+
* "id" : "x",
|
|
453
|
+
* "amount" : -1000
|
|
454
|
+
* },
|
|
455
|
+
* {
|
|
456
|
+
* "type" : "CreditNote",
|
|
457
|
+
* "id" : "z",
|
|
458
|
+
* "amount" : 1000
|
|
459
|
+
* }
|
|
460
|
+
* ]
|
|
461
|
+
* },
|
|
462
|
+
* {
|
|
463
|
+
* "amount" : 1000,
|
|
464
|
+
* "links" : [
|
|
465
|
+
* {
|
|
466
|
+
* "type" : "Invoice",
|
|
467
|
+
* "id" : "x",
|
|
468
|
+
* "amount" : -1000
|
|
469
|
+
* }
|
|
470
|
+
* ]
|
|
471
|
+
* },
|
|
472
|
+
* {
|
|
473
|
+
* "amount" : 1000,
|
|
474
|
+
* "links" : [
|
|
475
|
+
* {
|
|
476
|
+
* "type" : "PaymentOnAccount",
|
|
477
|
+
* "id" : "customer-001",
|
|
478
|
+
* "amount" : -1000
|
|
479
|
+
* }
|
|
480
|
+
* ]
|
|
481
|
+
* }
|
|
482
|
+
* ]
|
|
483
|
+
* }
|
|
484
|
+
* ```
|
|
485
|
+
*
|
|
486
|
+
*
|
|
487
|
+
*
|
|
488
|
+
* ```json title="Two credit notes pay two invoices with no allocation amount specified"
|
|
489
|
+
* {
|
|
490
|
+
* "totalAmount": 0,
|
|
491
|
+
* "lines": [
|
|
492
|
+
* {
|
|
493
|
+
* "amount" : 0,
|
|
494
|
+
* "links" : [
|
|
495
|
+
* {
|
|
496
|
+
* "type" : "Invoice",
|
|
497
|
+
* "id" : "w",
|
|
498
|
+
* "amount" : -1000
|
|
499
|
+
* },
|
|
500
|
+
* {
|
|
501
|
+
* "type" : "Invoice",
|
|
502
|
+
* "id" : "x",
|
|
503
|
+
* "amount" : -1000
|
|
504
|
+
* },
|
|
505
|
+
* {
|
|
506
|
+
* "type" : "CreditNote",
|
|
507
|
+
* "id" : "y",
|
|
508
|
+
* "amount" : 1000
|
|
509
|
+
* },
|
|
510
|
+
* {
|
|
511
|
+
* "type" : "CreditNote",
|
|
512
|
+
* "id" : "z",
|
|
513
|
+
* "amount" : 1000
|
|
514
|
+
* }
|
|
515
|
+
* ]
|
|
516
|
+
* }
|
|
517
|
+
* ]
|
|
518
|
+
* }
|
|
519
|
+
* ```
|
|
520
|
+
*
|
|
521
|
+
*
|
|
522
|
+
*
|
|
523
|
+
* ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash"
|
|
524
|
+
* {
|
|
525
|
+
* "totalAmount": 2000,
|
|
526
|
+
* "lines": [
|
|
527
|
+
* {
|
|
528
|
+
* "amount" : 1000,
|
|
529
|
+
* "links" : [
|
|
530
|
+
* {
|
|
531
|
+
* "type" : "Invoice",
|
|
532
|
+
* "id" : "w",
|
|
533
|
+
* "amount" : -1000
|
|
534
|
+
* },
|
|
535
|
+
* {
|
|
536
|
+
* "type" : "Invoice",
|
|
537
|
+
* "id" : "x",
|
|
538
|
+
* "amount" : -1000
|
|
539
|
+
* },
|
|
540
|
+
* {
|
|
541
|
+
* "type" : "Invoice",
|
|
542
|
+
* "id" : "u",
|
|
543
|
+
* "amount" : -1000
|
|
544
|
+
* },
|
|
545
|
+
* {
|
|
546
|
+
* "type" : "CreditNote",
|
|
547
|
+
* "id" : "y",
|
|
548
|
+
* "amount" : 1000
|
|
549
|
+
* },
|
|
550
|
+
* {
|
|
551
|
+
* "type" : "CreditNote",
|
|
552
|
+
* "id" : "z",
|
|
553
|
+
* "amount" : 1000
|
|
554
|
+
* }
|
|
555
|
+
* ]
|
|
556
|
+
* },
|
|
557
|
+
* {
|
|
558
|
+
* "amount" : 1000,
|
|
559
|
+
* "links" : [
|
|
560
|
+
* {
|
|
561
|
+
* "type" : "Refund",
|
|
562
|
+
* "id" : "refund-001",
|
|
563
|
+
* "amount" : -1000
|
|
564
|
+
* }
|
|
565
|
+
* ]
|
|
566
|
+
* }
|
|
567
|
+
* ]
|
|
568
|
+
* }
|
|
569
|
+
* {
|
|
570
|
+
* "id" : "refund-001",
|
|
571
|
+
* "totalAmount": -1000,
|
|
572
|
+
* "lines": [
|
|
573
|
+
* {
|
|
574
|
+
* "amount" : -1000,
|
|
575
|
+
* "links" : [
|
|
576
|
+
* {
|
|
577
|
+
* "type" : "Payment",
|
|
578
|
+
* "id" : "payment-001",
|
|
579
|
+
* "amount" : 1000
|
|
580
|
+
* }
|
|
581
|
+
* ]
|
|
582
|
+
* }
|
|
583
|
+
* ]
|
|
584
|
+
* }
|
|
585
|
+
* ```
|
|
586
|
+
*
|
|
587
|
+
*
|
|
588
|
+
*
|
|
589
|
+
* In this example, a payment on account is used to pay the same invoice in January and again in February.
|
|
590
|
+
*
|
|
591
|
+
* ```json title="January"
|
|
592
|
+
* {
|
|
593
|
+
* "id": "001",
|
|
594
|
+
* "totalAmount": 5000,
|
|
595
|
+
* "date" : "1901-01-01",
|
|
596
|
+
* "lines": [
|
|
597
|
+
* {
|
|
598
|
+
* "amount" : 1000,
|
|
599
|
+
* "links" : [
|
|
600
|
+
* {
|
|
601
|
+
* "type" : "Invoice",
|
|
602
|
+
* "id" : "Invoice-x",
|
|
603
|
+
* "amount" : -1000
|
|
604
|
+
* }
|
|
605
|
+
* ]
|
|
606
|
+
* },
|
|
607
|
+
* {
|
|
608
|
+
* "amount" : 4000,
|
|
609
|
+
* "links" : [
|
|
610
|
+
* {
|
|
611
|
+
* "type" : "PaymentOnAccount",
|
|
612
|
+
* "id" : "PaymentOnAccount-y",
|
|
613
|
+
* "amount" : -4000
|
|
614
|
+
* }
|
|
615
|
+
* ]
|
|
616
|
+
* }
|
|
617
|
+
* ]
|
|
618
|
+
* }
|
|
619
|
+
* ```
|
|
620
|
+
*
|
|
621
|
+
*
|
|
622
|
+
*
|
|
623
|
+
* ```json title="February"
|
|
624
|
+
* {
|
|
625
|
+
* "id": "001",
|
|
626
|
+
* "totalAmount": 5000,
|
|
627
|
+
* "date" : "1901-02-01",
|
|
628
|
+
* "lines": [
|
|
629
|
+
* {
|
|
630
|
+
* "amount" : 1000,
|
|
631
|
+
* "links" : [
|
|
632
|
+
* {
|
|
633
|
+
* "type" : "Invoice",
|
|
634
|
+
* "id" : "Invoice-x",
|
|
635
|
+
* "amount" : -1000
|
|
636
|
+
* }
|
|
637
|
+
* ]
|
|
638
|
+
* },
|
|
639
|
+
* {
|
|
640
|
+
* "amount" : 1000,
|
|
641
|
+
* "links" : [
|
|
642
|
+
* {
|
|
643
|
+
* "type" : "Invoice",
|
|
644
|
+
* "id" : "Invoice-y",
|
|
645
|
+
* "amount" : -1000
|
|
646
|
+
* }
|
|
647
|
+
* ]
|
|
648
|
+
* },
|
|
649
|
+
* {
|
|
650
|
+
* "amount" : 3000,
|
|
651
|
+
* "links" : [
|
|
652
|
+
* {
|
|
653
|
+
* "type" : "PaymentOnAccount",
|
|
654
|
+
* "id" : "PaymentOnAccount-y",
|
|
655
|
+
* "amount" : -3000
|
|
656
|
+
* }
|
|
657
|
+
* ]
|
|
658
|
+
* }
|
|
659
|
+
* ]
|
|
660
|
+
* }
|
|
661
|
+
* ```
|
|
662
|
+
*
|
|
663
|
+
*
|
|
664
|
+
*
|
|
665
|
+
* ```json title="Two credit notes and some cash pay two invoices with no allocations specified"
|
|
666
|
+
* {
|
|
667
|
+
* "totalAmount": 500,
|
|
668
|
+
* "lines": [
|
|
669
|
+
* {
|
|
670
|
+
* "amount": 500,
|
|
671
|
+
* "links": [{
|
|
672
|
+
* "type": "Invoice",
|
|
673
|
+
* "id": "a",
|
|
674
|
+
* "amount": -1000
|
|
675
|
+
* }, {
|
|
676
|
+
* "type": "Invoice",
|
|
677
|
+
* "id": "b",
|
|
678
|
+
* "amount": -1000
|
|
679
|
+
* }, {
|
|
680
|
+
* "type": "CreditNote",
|
|
681
|
+
* "id": "y",
|
|
682
|
+
* "amount": 750
|
|
683
|
+
* },{
|
|
684
|
+
* "type": "CreditNote",
|
|
685
|
+
* "id": "z",
|
|
686
|
+
* "amount": 750
|
|
687
|
+
* }
|
|
688
|
+
* ]
|
|
689
|
+
* }
|
|
690
|
+
* ]
|
|
691
|
+
* }
|
|
692
|
+
* ```
|
|
693
|
+
*
|
|
694
|
+
* @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
695
|
+
*/
|
|
696
|
+
export declare class AccountingCreatePaymentResponseAccountingPayment extends SpeakeasyBase {
|
|
8
697
|
/**
|
|
9
|
-
*
|
|
698
|
+
* Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.
|
|
10
699
|
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Unique identifier for your SMB in Codat.
|
|
14
|
-
*/
|
|
15
|
-
companyId: string;
|
|
700
|
+
accountRef?: AccountRef;
|
|
16
701
|
/**
|
|
17
|
-
*
|
|
702
|
+
* The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.
|
|
18
703
|
*
|
|
19
704
|
* @remarks
|
|
20
705
|
*
|
|
21
|
-
*
|
|
22
|
-
* 2020-10-08T22:40:50Z
|
|
23
|
-
* 2021-01-01T00:00:00
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*
|
|
706
|
+
* ## Unknown currencies
|
|
27
707
|
*
|
|
28
|
-
*
|
|
708
|
+
* In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction.
|
|
29
709
|
*
|
|
30
|
-
*
|
|
31
|
-
* - Unqualified local time: `2021-11-15T01:00:00`
|
|
32
|
-
* - UTC time offsets: `2021-11-15T01:00:00-05:00`
|
|
33
|
-
*
|
|
34
|
-
* > Time zones
|
|
35
|
-
* >
|
|
36
|
-
* > Not all dates from Codat will contain information about time zones.
|
|
37
|
-
* > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
|
|
710
|
+
* There are only a very small number of edge cases where this currency code is returned by the Codat system.
|
|
38
711
|
*/
|
|
39
|
-
|
|
712
|
+
currency?: string;
|
|
40
713
|
/**
|
|
41
|
-
*
|
|
714
|
+
* Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.
|
|
42
715
|
*
|
|
43
716
|
* @remarks
|
|
44
|
-
* >
|
|
45
|
-
* > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills.
|
|
46
|
-
*
|
|
47
|
-
* > View the coverage for payments in the <a className="external" href="https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=payments" target="_blank">Data coverage explorer</a>.
|
|
48
|
-
*
|
|
49
|
-
* ## Overview
|
|
50
|
-
*
|
|
51
|
-
* Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote).
|
|
52
717
|
*
|
|
53
|
-
*
|
|
718
|
+
* Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit.
|
|
54
719
|
*
|
|
55
|
-
* -
|
|
56
|
-
* - An allocation of a customer's credit note, either to an invoice or maybe a refund.
|
|
57
|
-
* - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account.
|
|
720
|
+
* It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR.
|
|
58
721
|
*
|
|
59
|
-
*
|
|
722
|
+
* Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places).
|
|
60
723
|
*
|
|
61
|
-
*
|
|
724
|
+
* For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places.
|
|
62
725
|
*
|
|
63
|
-
*
|
|
64
|
-
* - How much it is for and in what currency that amount is in.
|
|
65
|
-
* - Who the payment was _paid by_ – the _customer_.
|
|
66
|
-
* - The payment method used.
|
|
67
|
-
* - The breakdown of the types of payments – the _line items_.
|
|
726
|
+
* ## Examples with base currency of GBP
|
|
68
727
|
*
|
|
69
|
-
*
|
|
728
|
+
* | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) |
|
|
729
|
+
* | :--------------- | :------------- | :------------ | :------------------------- |
|
|
730
|
+
* | **USD** | $20 | 0.781 | £15.62 |
|
|
731
|
+
* | **EUR** | €20 | 0.885 | £17.70 |
|
|
732
|
+
* | **RUB** | ₽20 | 0.011 | £0.22 |
|
|
70
733
|
*
|
|
71
|
-
* ##
|
|
734
|
+
* ## Examples with base currency of USD
|
|
72
735
|
*
|
|
73
|
-
*
|
|
736
|
+
* | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) |
|
|
737
|
+
* | :--------------- | :------------- | :------------ | :------------------------- |
|
|
738
|
+
* | **GBP** | £20 | 1.277 | $25.54 |
|
|
739
|
+
* | **EUR** | €20 | 1.134 | $22.68 |
|
|
740
|
+
* | **RUB** | ₽20 | 0.015 | $0.30 |
|
|
74
741
|
*
|
|
75
|
-
* A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties:
|
|
76
742
|
*
|
|
77
|
-
* -
|
|
78
|
-
* - A **links** array containing one element with the following properties:
|
|
79
|
-
* - A **type** that indicates the type of **link**, in this case an `Invoice`.
|
|
80
|
-
* - An **id** that contains the ID of the invoice that was paid.
|
|
81
|
-
* - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`.
|
|
743
|
+
* ### Integration-specific details
|
|
82
744
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment.
|
|
93
|
-
*
|
|
94
|
-
* ## Payments and refunds on account
|
|
95
|
-
*
|
|
96
|
-
* A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties:
|
|
97
|
-
*
|
|
98
|
-
* - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive.
|
|
99
|
-
* - A **links** array containing one element with the following properties:
|
|
100
|
-
* - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`.
|
|
101
|
-
* - The **id** containing the ID of the customer.
|
|
102
|
-
* - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund.
|
|
103
|
-
*
|
|
104
|
-
* It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above.
|
|
105
|
-
*
|
|
106
|
-
* ## Using a credit note to pay an invoice
|
|
107
|
-
*
|
|
108
|
-
* The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties:
|
|
109
|
-
*
|
|
110
|
-
* - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other.
|
|
111
|
-
* - A **links** array containing two elements:
|
|
112
|
-
* - The first **link** has:
|
|
113
|
-
* - A **type** that indicates the type of **link**, in this case an `Invoice`.
|
|
114
|
-
* - An **id** that contains the ID of the invoice that was paid.
|
|
115
|
-
* - The second **link** has:
|
|
116
|
-
* - A **type** that indicates the type of **link**, in this case a `CreditNote`.
|
|
117
|
-
* - An **id** that contains the ID of the credit note used by this payment.
|
|
118
|
-
*
|
|
119
|
-
* The **amount** field on the **line** equals the **totalAmount** on the payment.
|
|
120
|
-
*
|
|
121
|
-
* ## Refunding a credit note
|
|
122
|
-
*
|
|
123
|
-
* A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties:
|
|
124
|
-
*
|
|
125
|
-
* - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund.
|
|
126
|
-
* - A **links** array that contains one element with the following properties:
|
|
127
|
-
* - A **type** that indicates the type of **link**, in this case a `CreditNote`.
|
|
128
|
-
* - An **id** that contains the ID of the credit note that was refunded.
|
|
129
|
-
*
|
|
130
|
-
* The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable.
|
|
131
|
-
*
|
|
132
|
-
* ## Refunding a payment
|
|
133
|
-
*
|
|
134
|
-
* If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records:
|
|
135
|
-
*
|
|
136
|
-
* - One for the incoming over payment.
|
|
137
|
-
* - Another for the outgoing refund.
|
|
138
|
-
*
|
|
139
|
-
* The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties:
|
|
140
|
-
*
|
|
141
|
-
* - An **amount** that indicates the amount that was refunded. This is always negative.
|
|
142
|
-
* - A **links** array that contains one element with the following properties:
|
|
143
|
-
* - A **type** that indicates the type of **link**, in this case a `Payment`.
|
|
144
|
-
* - An **id** that contains the ID of the payment that was refunded.
|
|
745
|
+
* | Integration | Scenario | System behavior |
|
|
746
|
+
* |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
747
|
+
* | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. |
|
|
748
|
+
*/
|
|
749
|
+
currencyRate?: number;
|
|
750
|
+
customerRef?: AccountingCustomerRef;
|
|
751
|
+
/**
|
|
752
|
+
* In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example:
|
|
145
753
|
*
|
|
146
|
-
*
|
|
754
|
+
* @remarks
|
|
147
755
|
*
|
|
148
|
-
*
|
|
756
|
+
* ```
|
|
757
|
+
* 2020-10-08T22:40:50Z
|
|
758
|
+
* 2021-01-01T00:00:00
|
|
759
|
+
* ```
|
|
149
760
|
*
|
|
150
|
-
* For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines:
|
|
151
761
|
*
|
|
152
|
-
* - One for £1,000 linked to the invoice that was paid.
|
|
153
|
-
* - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment.
|
|
154
762
|
*
|
|
155
|
-
*
|
|
763
|
+
* When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:
|
|
156
764
|
*
|
|
157
|
-
* -
|
|
158
|
-
* -
|
|
159
|
-
*
|
|
160
|
-
* - An **id** that contains the ID of the payment that refunded this line.
|
|
765
|
+
* - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
|
|
766
|
+
* - Unqualified local time: `2021-11-15T01:00:00`
|
|
767
|
+
* - UTC time offsets: `2021-11-15T01:00:00-05:00`
|
|
161
768
|
*
|
|
162
|
-
* >
|
|
769
|
+
* > Time zones
|
|
163
770
|
* >
|
|
164
|
-
* > Not all
|
|
165
|
-
*
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
*
|
|
771
|
+
* > Not all dates from Codat will contain information about time zones.
|
|
772
|
+
* > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
|
|
773
|
+
*/
|
|
774
|
+
date: string;
|
|
775
|
+
/**
|
|
776
|
+
* Identifier for the payment, unique to the company in the accounting platform.
|
|
777
|
+
*/
|
|
778
|
+
id?: string;
|
|
779
|
+
/**
|
|
780
|
+
* An array of payment lines.
|
|
781
|
+
*/
|
|
782
|
+
lines?: PaymentLine[];
|
|
783
|
+
metadata?: Metadata;
|
|
784
|
+
modifiedDate?: string;
|
|
785
|
+
/**
|
|
786
|
+
* Any additional information associated with the payment.
|
|
787
|
+
*/
|
|
788
|
+
note?: string;
|
|
789
|
+
/**
|
|
790
|
+
* The payment method the record is linked to in the accounting or commerce platform.
|
|
791
|
+
*/
|
|
792
|
+
paymentMethodRef?: PaymentMethodRef;
|
|
793
|
+
/**
|
|
794
|
+
* Friendly reference for the payment.
|
|
795
|
+
*/
|
|
796
|
+
reference?: string;
|
|
797
|
+
sourceModifiedDate?: string;
|
|
798
|
+
/**
|
|
799
|
+
* Supplemental data is additional data you can include in our standard data types.
|
|
174
800
|
*
|
|
175
|
-
*
|
|
801
|
+
* @remarks
|
|
176
802
|
*
|
|
177
|
-
*
|
|
178
|
-
|
|
803
|
+
* It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data.
|
|
804
|
+
*/
|
|
805
|
+
supplementalData?: SupplementalData;
|
|
806
|
+
/**
|
|
807
|
+
* Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account.
|
|
808
|
+
*/
|
|
809
|
+
totalAmount?: number;
|
|
810
|
+
}
|
|
811
|
+
export declare class AccountingCreatePaymentResponse extends SpeakeasyBase {
|
|
812
|
+
/**
|
|
813
|
+
* Contains a single entry that communicates which record has changed and the manner in which it changed.
|
|
814
|
+
*/
|
|
815
|
+
changes?: PushOperationChange[];
|
|
816
|
+
/**
|
|
817
|
+
* Unique identifier for your SMB in Codat.
|
|
818
|
+
*/
|
|
819
|
+
companyId: string;
|
|
820
|
+
/**
|
|
821
|
+
* In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example:
|
|
179
822
|
*
|
|
180
|
-
*
|
|
823
|
+
* @remarks
|
|
181
824
|
*
|
|
182
|
-
*
|
|
183
|
-
* -
|
|
825
|
+
* ```
|
|
826
|
+
* 2020-10-08T22:40:50Z
|
|
827
|
+
* 2021-01-01T00:00:00
|
|
828
|
+
* ```
|
|
184
829
|
*
|
|
185
|
-
* ```json title="Currency rate example"
|
|
186
|
-
* {
|
|
187
|
-
* "id": "123",
|
|
188
|
-
* "note": "",
|
|
189
|
-
* "totalAmount": 99.99,
|
|
190
|
-
* "currency": "GBP",
|
|
191
|
-
* "lines": [
|
|
192
|
-
* {
|
|
193
|
-
* "amount": 99.99,
|
|
194
|
-
* "links": [
|
|
195
|
-
* {
|
|
196
|
-
* "type": "Invoice",
|
|
197
|
-
* "id": "178",
|
|
198
|
-
* "amount": -50,
|
|
199
|
-
* "currencyRate": 1.9998
|
|
200
|
-
* }
|
|
201
|
-
* ]
|
|
202
|
-
* }
|
|
203
|
-
* ]
|
|
204
|
-
* }
|
|
205
|
-
* ```
|
|
206
830
|
*
|
|
207
831
|
*
|
|
832
|
+
* When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information:
|
|
208
833
|
*
|
|
209
|
-
*
|
|
834
|
+
* - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z`
|
|
835
|
+
* - Unqualified local time: `2021-11-15T01:00:00`
|
|
836
|
+
* - UTC time offsets: `2021-11-15T01:00:00-05:00`
|
|
210
837
|
*
|
|
211
|
-
* >
|
|
838
|
+
* > Time zones
|
|
212
839
|
* >
|
|
213
|
-
* >
|
|
214
|
-
*
|
|
215
|
-
* ## Simple examples
|
|
216
|
-
*
|
|
217
|
-
* ```json title="Payment for invoice"
|
|
218
|
-
* {
|
|
219
|
-
* "totalAmount": 1000,
|
|
220
|
-
* "lines": [
|
|
221
|
-
* {
|
|
222
|
-
* "amount" : 1000,
|
|
223
|
-
* "links" : [
|
|
224
|
-
* {
|
|
225
|
-
* "type" : "Invoice",
|
|
226
|
-
* "id" : "x",
|
|
227
|
-
* "amount" : -1000
|
|
228
|
-
* }
|
|
229
|
-
* ]
|
|
230
|
-
* }
|
|
231
|
-
* ]
|
|
232
|
-
* }
|
|
233
|
-
* ```
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* ```json title="Allocation of credit note"
|
|
238
|
-
* {
|
|
239
|
-
* "totalAmount": 0,
|
|
240
|
-
* "lines": [
|
|
241
|
-
* {
|
|
242
|
-
* "amount" : 0,
|
|
243
|
-
* "links" : [
|
|
244
|
-
* {
|
|
245
|
-
* "type" : "Invoice",
|
|
246
|
-
* "id" : "x",
|
|
247
|
-
* "amount" : -1000
|
|
248
|
-
* },
|
|
249
|
-
* {
|
|
250
|
-
* "type" : "CreditNote",
|
|
251
|
-
* "id" : "y",
|
|
252
|
-
* "amount" : 1000
|
|
253
|
-
* }
|
|
254
|
-
* ]
|
|
255
|
-
* }
|
|
256
|
-
* ]
|
|
257
|
-
* }
|
|
258
|
-
* ```
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* ```json title="Payment of invoice and payment on account"
|
|
263
|
-
* {
|
|
264
|
-
* "totalAmount": 2000,
|
|
265
|
-
* "lines": [
|
|
266
|
-
* {
|
|
267
|
-
* "amount" : 1000,
|
|
268
|
-
* "links" : [
|
|
269
|
-
* {
|
|
270
|
-
* "type" : "Invoice",
|
|
271
|
-
* "id" : "x",
|
|
272
|
-
* "amount" : -1000
|
|
273
|
-
* }
|
|
274
|
-
* ]
|
|
275
|
-
* },
|
|
276
|
-
* {
|
|
277
|
-
* "amount" : 1000,
|
|
278
|
-
* "links" : [
|
|
279
|
-
* {
|
|
280
|
-
* "type" : "PaymentOnAccount",
|
|
281
|
-
* "id" : "y",
|
|
282
|
-
* "amount" : -1000
|
|
283
|
-
* }
|
|
284
|
-
* ]
|
|
285
|
-
* }
|
|
286
|
-
* ]
|
|
287
|
-
* }
|
|
288
|
-
* ```
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
* ```json title="Refund of credit note"
|
|
293
|
-
* {
|
|
294
|
-
* "totalAmount": -1000,
|
|
295
|
-
* "lines": [
|
|
296
|
-
* {
|
|
297
|
-
* "amount" : -1000,
|
|
298
|
-
* "links" : [
|
|
299
|
-
* {
|
|
300
|
-
* "type" : "CreditNote",
|
|
301
|
-
* "id" : "y",
|
|
302
|
-
* "amount" : 1000
|
|
303
|
-
* }
|
|
304
|
-
* ]
|
|
305
|
-
* }
|
|
306
|
-
* ]
|
|
307
|
-
* }
|
|
308
|
-
* ```
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* ```json title="Refund on accounts receivable account"
|
|
313
|
-
* {
|
|
314
|
-
* "totalAmount": -1000,
|
|
315
|
-
* "lines": [
|
|
316
|
-
* {
|
|
317
|
-
* "amount" : -1000,
|
|
318
|
-
* "links" : [
|
|
319
|
-
* {
|
|
320
|
-
* "type" : "PaymentOnAccount",
|
|
321
|
-
* "id" : "y",
|
|
322
|
-
* "amount" : 1000
|
|
323
|
-
* }
|
|
324
|
-
* ]
|
|
325
|
-
* }
|
|
326
|
-
* ]
|
|
327
|
-
* }
|
|
328
|
-
* ```
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* ```json title="Linked refund on accounts receivable account"
|
|
333
|
-
* {
|
|
334
|
-
* "id" : "payment-001",
|
|
335
|
-
* "totalAmount": 1000,
|
|
336
|
-
* "lines": [
|
|
337
|
-
* {
|
|
338
|
-
* "amount" : 1000,
|
|
339
|
-
* "links" : [
|
|
340
|
-
* {
|
|
341
|
-
* "type" : "Refund",
|
|
342
|
-
* "id" : "refund-001",
|
|
343
|
-
* "amount" : -1000
|
|
344
|
-
* }
|
|
345
|
-
* ]
|
|
346
|
-
* }
|
|
347
|
-
* ]
|
|
348
|
-
* }
|
|
349
|
-
* {
|
|
350
|
-
* "id" : "refund-001",
|
|
351
|
-
* "totalAmount": -1000,
|
|
352
|
-
* "lines": [
|
|
353
|
-
* {
|
|
354
|
-
* "amount" : -1000,
|
|
355
|
-
* "links" : [
|
|
356
|
-
* {
|
|
357
|
-
* "type" : "Payment",
|
|
358
|
-
* "id" : "payment-001",
|
|
359
|
-
* "amount" : 1000
|
|
360
|
-
* }
|
|
361
|
-
* ]
|
|
362
|
-
* }
|
|
363
|
-
* ]
|
|
364
|
-
* }
|
|
365
|
-
* ```
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
* ```json title="Using a credit note and cash to pay an invoice"
|
|
370
|
-
* {
|
|
371
|
-
* "totalAmount": 250,
|
|
372
|
-
* "lines": [
|
|
373
|
-
* {
|
|
374
|
-
* "amount": 0,
|
|
375
|
-
* "links": [
|
|
376
|
-
* {
|
|
377
|
-
* "type": "Invoice",
|
|
378
|
-
* "id": "x",
|
|
379
|
-
* "amount": -750
|
|
380
|
-
* },
|
|
381
|
-
* {
|
|
382
|
-
* "type": "CreditNote",
|
|
383
|
-
* "id": "y",
|
|
384
|
-
* "amount": 750
|
|
385
|
-
* }
|
|
386
|
-
* ]
|
|
387
|
-
* },
|
|
388
|
-
* {
|
|
389
|
-
* "amount": 250,
|
|
390
|
-
* "links": [
|
|
391
|
-
* {
|
|
392
|
-
* "type": "Invoice",
|
|
393
|
-
* "id": "x",
|
|
394
|
-
* "amount": -250
|
|
395
|
-
* }
|
|
396
|
-
* ]
|
|
397
|
-
* }
|
|
398
|
-
* ]
|
|
399
|
-
* }
|
|
400
|
-
* ```
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
* ## Complex examples
|
|
405
|
-
*
|
|
406
|
-
* ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice"
|
|
407
|
-
* {
|
|
408
|
-
* "totalAmount": 1000,
|
|
409
|
-
* "lines": [
|
|
410
|
-
* {
|
|
411
|
-
* "amount" : 0,
|
|
412
|
-
* "links" : [
|
|
413
|
-
* {
|
|
414
|
-
* "type" : "Invoice",
|
|
415
|
-
* "id" : "x",
|
|
416
|
-
* "amount" : -1000
|
|
417
|
-
* },
|
|
418
|
-
* {
|
|
419
|
-
* "type" : "CreditNote",
|
|
420
|
-
* "id" : "y",
|
|
421
|
-
* "amount" : 1000
|
|
422
|
-
* }
|
|
423
|
-
* ]
|
|
424
|
-
* },
|
|
425
|
-
* {
|
|
426
|
-
* "amount" : 0,
|
|
427
|
-
* "links" : [
|
|
428
|
-
* {
|
|
429
|
-
* "type" : "Invoice",
|
|
430
|
-
* "id" : "x",
|
|
431
|
-
* "amount" : -1000
|
|
432
|
-
* },
|
|
433
|
-
* {
|
|
434
|
-
* "type" : "CreditNote",
|
|
435
|
-
* "id" : "z",
|
|
436
|
-
* "amount" : 1000
|
|
437
|
-
* }
|
|
438
|
-
* ]
|
|
439
|
-
* },
|
|
440
|
-
* {
|
|
441
|
-
* "amount" : 1000,
|
|
442
|
-
* "links" : [
|
|
443
|
-
* {
|
|
444
|
-
* "type" : "Invoice",
|
|
445
|
-
* "id" : "x",
|
|
446
|
-
* "amount" : -1000
|
|
447
|
-
* }
|
|
448
|
-
* ]
|
|
449
|
-
* }
|
|
450
|
-
* ]
|
|
451
|
-
* }
|
|
452
|
-
* ```
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
* ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'"
|
|
457
|
-
* {
|
|
458
|
-
* "totalAmount": 2000,
|
|
459
|
-
* "lines": [
|
|
460
|
-
* {
|
|
461
|
-
* "amount" : 0,
|
|
462
|
-
* "links" : [
|
|
463
|
-
* {
|
|
464
|
-
* "type" : "Invoice",
|
|
465
|
-
* "id" : "x",
|
|
466
|
-
* "amount" : -1000
|
|
467
|
-
* },
|
|
468
|
-
* {
|
|
469
|
-
* "type" : "CreditNote",
|
|
470
|
-
* "id" : "y",
|
|
471
|
-
* "amount" : 1000
|
|
472
|
-
* }
|
|
473
|
-
* ]
|
|
474
|
-
* },
|
|
475
|
-
* {
|
|
476
|
-
* "amount" : 0,
|
|
477
|
-
* "links" : [
|
|
478
|
-
* {
|
|
479
|
-
* "type" : "Invoice",
|
|
480
|
-
* "id" : "x",
|
|
481
|
-
* "amount" : -1000
|
|
482
|
-
* },
|
|
483
|
-
* {
|
|
484
|
-
* "type" : "CreditNote",
|
|
485
|
-
* "id" : "z",
|
|
486
|
-
* "amount" : 1000
|
|
487
|
-
* }
|
|
488
|
-
* ]
|
|
489
|
-
* },
|
|
490
|
-
* {
|
|
491
|
-
* "amount" : 1000,
|
|
492
|
-
* "links" : [
|
|
493
|
-
* {
|
|
494
|
-
* "type" : "Invoice",
|
|
495
|
-
* "id" : "x",
|
|
496
|
-
* "amount" : -1000
|
|
497
|
-
* }
|
|
498
|
-
* ]
|
|
499
|
-
* },
|
|
500
|
-
* {
|
|
501
|
-
* "amount" : 1000,
|
|
502
|
-
* "links" : [
|
|
503
|
-
* {
|
|
504
|
-
* "type" : "PaymentOnAccount",
|
|
505
|
-
* "id" : "customer-001",
|
|
506
|
-
* "amount" : -1000
|
|
507
|
-
* }
|
|
508
|
-
* ]
|
|
509
|
-
* }
|
|
510
|
-
* ]
|
|
511
|
-
* }
|
|
512
|
-
* ```
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
* ```json title="Two credit notes pay two invoices with no allocation amount specified"
|
|
517
|
-
* {
|
|
518
|
-
* "totalAmount": 0,
|
|
519
|
-
* "lines": [
|
|
520
|
-
* {
|
|
521
|
-
* "amount" : 0,
|
|
522
|
-
* "links" : [
|
|
523
|
-
* {
|
|
524
|
-
* "type" : "Invoice",
|
|
525
|
-
* "id" : "w",
|
|
526
|
-
* "amount" : -1000
|
|
527
|
-
* },
|
|
528
|
-
* {
|
|
529
|
-
* "type" : "Invoice",
|
|
530
|
-
* "id" : "x",
|
|
531
|
-
* "amount" : -1000
|
|
532
|
-
* },
|
|
533
|
-
* {
|
|
534
|
-
* "type" : "CreditNote",
|
|
535
|
-
* "id" : "y",
|
|
536
|
-
* "amount" : 1000
|
|
537
|
-
* },
|
|
538
|
-
* {
|
|
539
|
-
* "type" : "CreditNote",
|
|
540
|
-
* "id" : "z",
|
|
541
|
-
* "amount" : 1000
|
|
542
|
-
* }
|
|
543
|
-
* ]
|
|
544
|
-
* }
|
|
545
|
-
* ]
|
|
546
|
-
* }
|
|
547
|
-
* ```
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
* ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash"
|
|
552
|
-
* {
|
|
553
|
-
* "totalAmount": 2000,
|
|
554
|
-
* "lines": [
|
|
555
|
-
* {
|
|
556
|
-
* "amount" : 1000,
|
|
557
|
-
* "links" : [
|
|
558
|
-
* {
|
|
559
|
-
* "type" : "Invoice",
|
|
560
|
-
* "id" : "w",
|
|
561
|
-
* "amount" : -1000
|
|
562
|
-
* },
|
|
563
|
-
* {
|
|
564
|
-
* "type" : "Invoice",
|
|
565
|
-
* "id" : "x",
|
|
566
|
-
* "amount" : -1000
|
|
567
|
-
* },
|
|
568
|
-
* {
|
|
569
|
-
* "type" : "Invoice",
|
|
570
|
-
* "id" : "u",
|
|
571
|
-
* "amount" : -1000
|
|
572
|
-
* },
|
|
573
|
-
* {
|
|
574
|
-
* "type" : "CreditNote",
|
|
575
|
-
* "id" : "y",
|
|
576
|
-
* "amount" : 1000
|
|
577
|
-
* },
|
|
578
|
-
* {
|
|
579
|
-
* "type" : "CreditNote",
|
|
580
|
-
* "id" : "z",
|
|
581
|
-
* "amount" : 1000
|
|
582
|
-
* }
|
|
583
|
-
* ]
|
|
584
|
-
* },
|
|
585
|
-
* {
|
|
586
|
-
* "amount" : 1000,
|
|
587
|
-
* "links" : [
|
|
588
|
-
* {
|
|
589
|
-
* "type" : "Refund",
|
|
590
|
-
* "id" : "refund-001",
|
|
591
|
-
* "amount" : -1000
|
|
592
|
-
* }
|
|
593
|
-
* ]
|
|
594
|
-
* }
|
|
595
|
-
* ]
|
|
596
|
-
* }
|
|
597
|
-
* {
|
|
598
|
-
* "id" : "refund-001",
|
|
599
|
-
* "totalAmount": -1000,
|
|
600
|
-
* "lines": [
|
|
601
|
-
* {
|
|
602
|
-
* "amount" : -1000,
|
|
603
|
-
* "links" : [
|
|
604
|
-
* {
|
|
605
|
-
* "type" : "Payment",
|
|
606
|
-
* "id" : "payment-001",
|
|
607
|
-
* "amount" : 1000
|
|
608
|
-
* }
|
|
609
|
-
* ]
|
|
610
|
-
* }
|
|
611
|
-
* ]
|
|
612
|
-
* }
|
|
613
|
-
* ```
|
|
614
|
-
*
|
|
615
|
-
*
|
|
616
|
-
*
|
|
617
|
-
* In this example, a payment on account is used to pay the same invoice in January and again in February.
|
|
618
|
-
*
|
|
619
|
-
* ```json title="January"
|
|
620
|
-
* {
|
|
621
|
-
* "id": "001",
|
|
622
|
-
* "totalAmount": 5000,
|
|
623
|
-
* "date" : "1901-01-01",
|
|
624
|
-
* "lines": [
|
|
625
|
-
* {
|
|
626
|
-
* "amount" : 1000,
|
|
627
|
-
* "links" : [
|
|
628
|
-
* {
|
|
629
|
-
* "type" : "Invoice",
|
|
630
|
-
* "id" : "Invoice-x",
|
|
631
|
-
* "amount" : -1000
|
|
632
|
-
* }
|
|
633
|
-
* ]
|
|
634
|
-
* },
|
|
635
|
-
* {
|
|
636
|
-
* "amount" : 4000,
|
|
637
|
-
* "links" : [
|
|
638
|
-
* {
|
|
639
|
-
* "type" : "PaymentOnAccount",
|
|
640
|
-
* "id" : "PaymentOnAccount-y",
|
|
641
|
-
* "amount" : -4000
|
|
642
|
-
* }
|
|
643
|
-
* ]
|
|
644
|
-
* }
|
|
645
|
-
* ]
|
|
646
|
-
* }
|
|
647
|
-
* ```
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
* ```json title="February"
|
|
652
|
-
* {
|
|
653
|
-
* "id": "001",
|
|
654
|
-
* "totalAmount": 5000,
|
|
655
|
-
* "date" : "1901-02-01",
|
|
656
|
-
* "lines": [
|
|
657
|
-
* {
|
|
658
|
-
* "amount" : 1000,
|
|
659
|
-
* "links" : [
|
|
660
|
-
* {
|
|
661
|
-
* "type" : "Invoice",
|
|
662
|
-
* "id" : "Invoice-x",
|
|
663
|
-
* "amount" : -1000
|
|
664
|
-
* }
|
|
665
|
-
* ]
|
|
666
|
-
* },
|
|
667
|
-
* {
|
|
668
|
-
* "amount" : 1000,
|
|
669
|
-
* "links" : [
|
|
670
|
-
* {
|
|
671
|
-
* "type" : "Invoice",
|
|
672
|
-
* "id" : "Invoice-y",
|
|
673
|
-
* "amount" : -1000
|
|
674
|
-
* }
|
|
675
|
-
* ]
|
|
676
|
-
* },
|
|
677
|
-
* {
|
|
678
|
-
* "amount" : 3000,
|
|
679
|
-
* "links" : [
|
|
680
|
-
* {
|
|
681
|
-
* "type" : "PaymentOnAccount",
|
|
682
|
-
* "id" : "PaymentOnAccount-y",
|
|
683
|
-
* "amount" : -3000
|
|
684
|
-
* }
|
|
685
|
-
* ]
|
|
686
|
-
* }
|
|
687
|
-
* ]
|
|
688
|
-
* }
|
|
689
|
-
* ```
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
* ```json title="Two credit notes and some cash pay two invoices with no allocations specified"
|
|
694
|
-
* {
|
|
695
|
-
* "totalAmount": 500,
|
|
696
|
-
* "lines": [
|
|
697
|
-
* {
|
|
698
|
-
* "amount": 500,
|
|
699
|
-
* "links": [{
|
|
700
|
-
* "type": "Invoice",
|
|
701
|
-
* "id": "a",
|
|
702
|
-
* "amount": -1000
|
|
703
|
-
* }, {
|
|
704
|
-
* "type": "Invoice",
|
|
705
|
-
* "id": "b",
|
|
706
|
-
* "amount": -1000
|
|
707
|
-
* }, {
|
|
708
|
-
* "type": "CreditNote",
|
|
709
|
-
* "id": "y",
|
|
710
|
-
* "amount": 750
|
|
711
|
-
* },{
|
|
712
|
-
* "type": "CreditNote",
|
|
713
|
-
* "id": "z",
|
|
714
|
-
* "amount": 750
|
|
715
|
-
* }
|
|
716
|
-
* ]
|
|
717
|
-
* }
|
|
718
|
-
* ]
|
|
719
|
-
* }
|
|
720
|
-
* ```
|
|
840
|
+
* > Not all dates from Codat will contain information about time zones.
|
|
841
|
+
* > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced.
|
|
721
842
|
*/
|
|
722
|
-
|
|
843
|
+
completedOnUtc?: string;
|
|
844
|
+
data?: AccountingCreatePaymentResponseAccountingPayment;
|
|
723
845
|
/**
|
|
724
846
|
* Unique identifier for a company's data connection.
|
|
725
847
|
*/
|