NetSuite exposes the customer payment record to REST web services. A customer payment transaction records a customer payment and applies it to the appropriate invoice or cash sale, decreasing the amount due, and tracking revenue.
The customer payment record has no subrecords.
Record ID
The record ID for the customer payment REST record is customerpayment.
Creating a Customer Payment Record
{
"account": {
"id": "1"
},
"apply": {
"items": [
{
"amount": 200.0,
"apply": true,
"doc": {
"id": "104"
},
"line": 0
}
]
},
"currency": {
"id": "1"
},
"customer": {
"id": "4"
},
"memo": "10",
"payment": 250,
"toBeEmailed": false
}
Getting an Existing Customer Payment by ID
HTTP method: GET
URL: {{COMPANY_URL}}/services/rest/record/v1/customerpayment/{{customerPaymentId}}
Changing the Applied Invoice Amount by Updating an Existing Customer Payment by ID
HTTP method: PATCH
URL: {{COMPANY_URL}}/services/rest/record/v1/customerpayment/{{customerPaymentId}}
Request body: { "apply": { "items": [ { "doc": { "id": "4" }, "amount": 200 } ] }, "customer": { "id": "4" }
}
Adding an Invoice to Apply by Updating an Existing Customer Payment by ID
HTTP method: PATCH
URL: {{COMPANY_URL}}/services/rest/record/v1/customerpayment/{{customerPaymentId}}
Request body: { "apply": { "items": [ { "doc": { "id": "104" }, "amount": 10 } ] }, "customer": { "id": "4" }
}
Unapply an Invoice by Updating an Existing Customer Payment by ID
{ "apply": { "items": [ { "doc": { "id": "104" }, "apply": false } ] }, "customer": { "id": "4" }
}
Copy
{ "apply": { "items": [ { "doc": { "id": "104" }, "amount": 0 } ] }, "customer": { "id": "4" }
}
Note:
In customer payment REST API, the payment method cannot be set on create or update as there is no similar key is not available in the endpoint. So currently there will be only option to suggest a customized solution from the NetSuite side.
POSTMAN details:
curl –location –request PATCH ‘https://1162153-sb1.suitetalk.api.netsuite.com/services/rest/record/v1/customerpayment/78883’
–header ‘Content-Type: application/json’
–header ‘Authorization: OAuth realm=”1162153_SB1″,oauth_consumer_key=”967009b38bf269fb1d382259b99cebfb3435a43277f8cb6f2e60598d10c293da”,oauth_token=”816e7d4b77ede36344fa2a455b9585ffa6842e7adbb9ae5b13eafc1ccc30d467″,oauth_signature_method=”HMAC-SHA256″,oauth_timestamp=”1720429330″,oauth_nonce=”CMiplBWvKZG”,oauth_version=”1.0″,oauth_signature=”qez5dV565nHv6dgVvdDNSyps17P7ZfH64P0hvAHoD1o%3D”‘
–data ‘{
“account”: {
“id”: “1318”
},
“apply”: {
“items”: [
{
“amount”: 10.0,
“apply”: true,
“doc”: {
“id”: “78882”
}
},
{
“amount”: 10.0,
“apply”: true,
“doc”: {
“id”: “78783”
}
}
]
},
“customer”: {
“id”: “9851”
},
“memo”: “1009”,
“payment”: 20.0,
“toBeEmailed”: false,
“paymentMethod”: {
“id”: 2
}
}’