In this guide, we're going to take you through how you can list payments via the Kodaris API.
Video overview:
Example
// Login to our account
var loginRes = kd.http.fetch({
method: 'POST',
url: 'https://commerce.kodaris.com/api/user/employee/apiKeyLogin',
version: 2,
body: {
apiKey: 'xxxx'
},
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
});
// keep our session token for future requests
var userSessionApiKey = loginRes.body.data.userSessionApiKey;
// get CRSF token for requests
var tokenRes = kd.http.fetch({
method: 'GET',
url: 'https://commerce.kodaris.com/api/user/employee/authToken',
version: 2,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'userSessionApiKey': userSessionApiKey
}
});
// keep our token for future requests
var token = tokenRes.body.data;
// get specific payment
var paymentRes = kd.http.fetch({
method: 'POST',
url: 'https://commerce.kodaris.com/api/system/payment/list',
version: 2,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'userSessionApiKey': userSessionApiKey,
'X-CSRF-TOKEN': token
},
body: {
// if you'd like to list specific payments,
// you can send in filter fields to the API
filterFields: [
{
name: 'externalOrderNumber', // filter on your order number
operation: 'IS',
value: '1143-00' // your order number
}
]
}
});
kd.log('paymentRes', paymentRes);
-> response ->
{
"status" : 200,
"errors" : null,
"body" : {
"success" : true,
"code" : 200,
"messages" : { },
"errors" : { },
"data" : {
"size" : 10,
"number" : 0,
"totalElements" : 1,
"isLast" : true,
"totalPages" : 1,
"isFirst" : true,
"hasPrevious" : false,
"hasNext" : false,
"numberOfElements" : 1,
"offset" : null,
"content" : {
"0" : {
"code" : null,
"status" : "Received",
"processorClassName" : "xxxx",
"valueFieldLabels" : "xxxx",
"creditCardName" : "Company Payment Method",
"creditCardType" : "Visa",
"creditCardDate" : "1225",
"creditCardNumber" : null,
"creditCardNumberDisplay" : "XXXX XXXX XXXX 4242",
"value1" : "cardAccount",
"value2" : "Sale",
"value3" : null,
"value4" : "0",
"value5" : "X",
"value6" : "xxxx",
"value7" : "xxxx",
"value8" : "Approved",
"value9" : "xxxx",
"amount" : 45.36,
"amountToPay" : null,
"paymentReason" : null,
"extra1" : "0",
"extra2" : null,
"extra3" : null,
"paymentProfileID" : "xxxx",
"paymentDate" : null,
"scheduledDate" : null,
"discountAmount" : 0,
"discountDate" : null,
"invoiceAmount" : 0,
"invoiceDate" : null,
"dueDate" : null,
"checkNumber" : null,
"sequenceNumber" : null,
"sourceCode" : null,
"transactionType" : "CompanyPayment",
"transactionTypeLabel" : null,
"shipto" : null,
"journalNumber" : null,
"setNumber" : null,
"active" : true,
"companyID" : 1171,
"externalOrderNumber" : "1143-00",
"jsonPaymentDetails" : null,
"originalDiscountAmount" : null,
"sourceModifiedTime" : null,
"batchDate" : null,
"reconciledDate" : null,
"warehouseCode" : null,
"merchantAccountID" : "xxxx",
"terminalID" : 28,
"paymentTransactionNumber" : null,
"webPaymentID" : null,
"state" : null,
"ipAddress" : null,
"cardName" : null,
"cardZipCode" : null,
"cardAddress" : null,
"cardCity" : null,
"hostCode" : null,
"paymentMethodExternalToken" : "xxxx",
"paymentMethodCardType" : "CREDIT",
"paymentID" : 1723,
"companyName" : null,
"companyCode" : null,
"paymentType" : "SALE",
"created" : "2025-07-23 12:08:49:427",
"autotimestamp" : "2025-07-23 12:08:49.0",
"feeAmount" : 1.59,
"feeLabel" : "Non-cash adjustment",
"feeRate" : 0.035,
"paymentReceiptEmail" : null,
"generatedReceipt" : null,
"lastIndexed" : "2025-07-23 12:15:01",
"needsIndexing" : false
}
},
... omitted for brevity