//Create a Map to store all the data of a Payment
Map<String, Object> nsCustomerPayment = new Map<String, Object>();
nsCustomerPayment.put('internalId', '97006');
nsCustomerPayment.put('classification', new Map<String, Object>{'internalId'=>'2'});
nsCustomerPayment.put('department', new Map<String, Object>{'internalId'=>'1'});
nsCustomerPayment.put('memo', 'Payment 25 update');
nsCustomerPayment.put('tranDate', DateTime.newInstance(2020, 11, 07).getTime()/1000);
nsCustomerPayment.put('payment', '91000');
// apply only to Approved status containing invoices and having same customer as payment
List<Object> paymentApplyList = new List<Object>();
Map<String,Object> apply = new Map<String,Object>();
apply.put('doc', '97807');
apply.put('line', '0');
apply.put('apply',true);
paymentApplyList.add(apply);
nsCustomerPayment.put('applyList', new Map<String,Object>{'apply'=>paymentApplyList,'replaceAll'=>false});
// Initializing the Payment Custom Fields
List<Object> paymentCustomFieldList = new List<Object>();
Map<String,Object> paymentCustomField = new Map<String,Object>();
paymentCustomField.put('fieldType', 'select');
paymentCustomField.put('scriptId', 'custbody_customlist');
paymentCustomField.put('valueLookup', new Map<String,Object>{'internalId'=>'1'});
paymentCustomFieldList.add(paymentCustomField);
// Adding the Payment Custom Fields
nsCustomerPayment.put('customFieldList', new Map<String,Object>{'customField'=>paymentCustomFieldList});
// Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('customerPayments', new List<Object>{nsCustomerPayment});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'updateCustomerPayment');
reqObj.put('requestJSON', reqJSON);
// Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);