---
title: Update
slug: netsuite/rv2h-update
description: Learn how to update a customer payment in NetSuite using this comprehensive document. Discover code snippets and a response JSON that illustrate the modified payment information, including fields like internal ID, classification, department, memo, transac
docTags: 
createdAt: 2021-12-14T12:51:12.000Z
---

The following is an example of update Customer Payment where we are changing some of the fields. (See [﻿](https://app.archbee.io/docs/-LIHUUnv_7XNQrtzHsKkC/fgC9EQDMRKFQ6ct2cri5h)[Customer Payment](docId\:L_S8oFAL1497WkaPqKUlH)  for all available fields).  The NetSuite Customer Payment Id (internalId) is required to update the Customer Payment.

:::hint{type="info"}
Note: You can only update one record at a time.
:::

The response returns the complete Customer Payment information, but we have shortened the response in our example for ease of reading.

:::CodeblockTabs
Request

```apex
//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);

```

Response

```json
{
    action=updateCustomerPayment,
    timestamp=1648456133269, 
    validRequest=true, 
    version=1.0,
    responseJSON={
        "errors":[],
        "status":"200",
        "customerPayments":[
            {
                "undepFunds":true,
                "unapplied":0.0,
                "tranId":"117",
                "tranDate":1604638800,
                "subsidiary":{
                    "type":null,
                    "name":"Parent Company",
                    "internalId":"1",
                    "externalId":null
                },
                "status":"Not Deposited",
                "salesforceID":"a0L1m000003Ee6PEAS",
                "payment":91000.0,
                "memo":"Payment 25 update",
                "location":{
                    "type":null,
                    "name":"test : Atlanta west",
                    "internalId":"1",
                    "externalId":null
                },
                "lastModifiedDate":1648456129,
                "internalId":"97006",
                "externalId":null,
                "exchangeRate":1.0,
                "department":{
                    "type":null,
                    "name":"PR Department",
                    "internalId":"1",
                    "externalId":null
                },
                "customForm":{
                    "type":null,
                    "name":"Custom Customer Payment",
                    "internalId":"105",
                    "externalId":null
                },
                "customFieldList":null,
                "customer":{
                    "type":null,
                    "name":"CUST871AT Infosys",
                    "internalId":"63587",
                    "externalId":null
                },
                "currencyName":"US Dollars",
                "createdDate":1648453996,
                "classification":{
                    "type":null,
                    "name":"Individual Partner Class",
                    "internalId":"2",
                    "externalId":null
                },
                "applyList":{
                "apply":[
                    {
                        "type":"Invoice",
                        "total":91000.0,
                        "refNum":"INV454",
                        "line":"0",
                        "due":91000.0,
                        "doc":"97807",
                        "currencyValue":"US Dollars",
                        "applyDate":1648440000,
                        "apply":true,
                        "amount":91000.0
                    }
                ]
                },
                "applied":91000.0
            }
        ]
    }
}
```
:::

