Update Payment sale.payment.update
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
Scope:
saleWho can execute the method: administrator
The method sale.payment.update is used to update fields of the payment collection item.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
Payment identifier |
|
|
fields* |
Field values (detailed description provided below) for creating a payment in the form of a structure:
|
Parameter fields
Required parameters are marked with *
|
Name |
Description |
|
paySystemId* |
Payment system identifier |
|
paid |
Payment status:
Defaults to |
|
datePaid |
Payment date |
|
empPaidId |
Identifier of the user who made the payment |
|
psStatus |
Payment system status flag — whether the payment was successful. Options:
Defaults to |
|
psStatusCode |
Payment system status code |
|
psStatusDescription |
Description of the payment system's operation result |
|
psStatusMessage |
Message from the payment system |
|
psSum |
Payment system amount |
|
psCurrency |
Payment system currency |
|
psResponseDate |
Payment system response date |
|
payVoucherNum |
Payment document number |
|
payVoucherDate |
Payment document date |
|
datePayBefore |
Deprecated. Date by which the invoice must be paid |
|
dateBill |
Invoice date |
|
xmlId |
External identifier |
|
sum |
Payment amount |
|
companyId |
Identifier of the company that will receive the payment Currently not used |
|
payReturnNum |
Return document number |
|
priceCod |
Relevant only for on-premise version |
|
payReturnDate |
Return document date |
|
empReturnId |
Identifier of the user who processed the return |
|
payReturnComment |
Comment on the return |
|
responsibleId |
Identifier of the user responsible for the payment |
|
empResponsibleId |
Identifier of the user who assigned the responsible person |
|
isReturn |
Was the return processed:
Defaults to N |
|
comments |
Comments on the payment |
|
updated1c |
Payment updated via QuickBooks and other similar platforms:
Defaults to N |
|
id1c |
Identifier in QuickBooks and other similar platforms |
|
version1c |
Payment document version from QuickBooks and other similar platforms |
|
externalPayment |
Relevant only for on-premise version
Defaults to |
|
psInvoiceId |
Payment identifier in the payment system |
|
marked |
Marking flag. Indicates whether the payment is marked as problematic:
Defaults to |
|
reasonMarked |
Reason for marking |
|
empMarkedId |
Identifier of the user who marked the payment |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":144,"fields":{"paySystemId":1,"paid":"Y","datePaid":"2024-04-10T10:00:00","empPaidId":1,"psStatus":"Y","psSum":100,"psCurrency":"USD","psResponseDate":"2024-04-10T10:00:00","sum":100,"companyId":1,"responsibleId":1,"empResponsibleId":1,"isReturn":"N","externalPayment":"N","psInvoiceId":1,"marked":"N"}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/sale.payment.update
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":144,"fields":{"paySystemId":1,"paid":"Y","datePaid":"2024-04-10T10:00:00","empPaidId":1,"psStatus":"Y","psSum":100,"psCurrency":"USD","psResponseDate":"2024-04-10T10:00:00","sum":100,"companyId":1,"responsibleId":1,"empResponsibleId":1,"isReturn":"N","externalPayment":"N","psInvoiceId":1,"marked":"N"},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/sale.payment.update
try
{
const response = await $b24.callMethod(
'sale.payment.update',
{
id: 144,
fields: {
paySystemId: 1,
paid: 'Y',
datePaid: '2024-04-10T10:00:00',
empPaidId: 1,
psStatus: 'Y',
psStatusCode: '',
psStatusDescription: '',
psStatusMessage: '',
psSum: 100,
psCurrency: 'USD',
psResponseDate: '2024-04-10T10:00:00',
payVoucherNum: '',
payVoucherDate: '2024-04-10T10:00:00',
datePayBefore: '2024-04-10T10:00:00',
dateBill: '2024-04-10T10:00:00',
xmlId: '',
sum: 100,
companyId: 1,
payReturnNum: '',
priceCod: 100,
payReturnDate: '2024-04-10T10:00:00',
empReturnId: 1,
payReturnComment: '',
responsibleId: 1,
empResponsibleId: 1,
isReturn: 'N',
comments: '',
updated1c: 'N',
id1c: '',
version1c: '',
externalPayment: 'N',
psInvoiceId: 1,
marked: 'N',
reasonMarked: '',
empMarkedId: 1,
}
}
);
const result = response.getData().result;
console.info(result);
}
catch( error )
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'sale.payment.update',
[
'id' => 144,
'fields' => [
'paySystemId' => 1,
'paid' => 'Y',
'datePaid' => '2024-04-10T10:00:00',
'empPaidId' => 1,
'psStatus' => 'Y',
'psStatusCode' => '',
'psStatusDescription' => '',
'psStatusMessage' => '',
'psSum' => 100,
'psCurrency' => 'USD',
'psResponseDate' => '2024-04-10T10:00:00',
'payVoucherNum' => '',
'payVoucherDate' => '2024-04-10T10:00:00',
'datePayBefore' => '2024-04-10T10:00:00',
'dateBill' => '2024-04-10T10:00:00',
'xmlId' => '',
'sum' => 100,
'companyId' => 1,
'payReturnNum' => '',
'priceCod' => 100,
'payReturnDate' => '2024-04-10T10:00:00',
'empReturnId' => 1,
'payReturnComment' => '',
'responsibleId' => 1,
'empResponsibleId' => 1,
'isReturn' => 'N',
'comments' => '',
'updated1c' => 'N',
'id1c' => '',
'version1c' => '',
'externalPayment' => 'N',
'psInvoiceId' => 1,
'marked' => 'N',
'reasonMarked' => '',
'empMarkedId' => 1,
],
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error updating payment: ' . $e->getMessage();
}
BX24.callMethod(
'sale.payment.update',
{
id: 144,
fields: {
paySystemId: 1,
paid: 'Y',
datePaid: '2024-04-10T10:00:00',
empPaidId: 1,
psStatus: 'Y',
psStatusCode: '',
psStatusDescription: '',
psStatusMessage: '',
psSum: 100,
psCurrency: 'USD',
psResponseDate: '2024-04-10T10:00:00',
payVoucherNum: '',
payVoucherDate: '2024-04-10T10:00:00',
datePayBefore: '2024-04-10T10:00:00',
dateBill: '2024-04-10T10:00:00',
xmlId: '',
sum: 100,
companyId: 1,
payReturnNum: '',
priceCod: 100,
payReturnDate: '2024-04-10T10:00:00',
empReturnId: 1,
payReturnComment: '',
responsibleId: 1,
empResponsibleId: 1,
isReturn: 'N',
comments: '',
updated1c: 'N',
id1c: '',
version1c: '',
externalPayment: 'N',
psInvoiceId: 1,
marked: 'N',
reasonMarked: '',
empMarkedId: 1,
}
},
function(result) {
if (result.error()) {
console.error(result.error());
} else {
console.info(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'sale.payment.update',
[
'id' => 144,
'fields' => [
'paySystemId' => 1,
'paid' => 'Y',
'datePaid' => '2024-04-10T10:00:00',
'empPaidId' => 1,
'psStatus' => 'Y',
'psStatusCode' => '',
'psStatusDescription' => '',
'psStatusMessage' => '',
'psSum' => 100,
'psCurrency' => 'USD',
'psResponseDate' => '2024-04-10T10:00:00',
'payVoucherNum' => '',
'payVoucherDate' => '2024-04-10T10:00:00',
'datePayBefore' => '2024-04-10T10:00:00',
'dateBill' => '2024-04-10T10:00:00',
'xmlId' => '',
'sum' => 100,
'companyId' => 1,
'payReturnNum' => '',
'priceCod' => 100,
'payReturnDate' => '2024-04-10T10:00:00',
'empReturnId' => 1,
'payReturnComment' => '',
'responsibleId' => 1,
'empResponsibleId' => 1,
'isReturn' => 'N',
'comments' => '',
'updated1c' => 'N',
'id1c' => '',
'version1c' => '',
'externalPayment' => 'N',
'psInvoiceId' => 1,
'marked' => 'N',
'reasonMarked' => '',
'empMarkedId' => 1,
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP status: 200
{
"result": {
"payment": {
"accountNumber": "356\/1",
"comments": "",
"companyId": 1,
"currency": "USD",
"dateBill": "2024-04-10T09:00:00+02:00",
"dateMarked": "2024-04-16T16:32:49+02:00",
"datePaid": "2024-04-10T09:00:00+02:00",
"datePayBefore": "2024-04-10T09:00:00+02:00",
"dateResponsibleId": "2024-04-16T16:32:49+02:00",
"empMarkedId": 1,
"empPaidId": 1,
"empResponsibleId": 1,
"empReturnId": 1,
"externalPayment": "N",
"id": 144,
"id1c": "",
"isReturn": "N",
"marked": "N",
"orderId": 200,
"paid": "Y",
"payReturnComment": "",
"payReturnDate": "2024-04-10T09:00:00+02:00",
"payReturnNum": "",
"paySystemId": 1,
"paySystemIsCash": "N",
"paySystemName": "Bank Transfer (Company)",
"paySystemXmlId": "",
"payVoucherDate": "2024-04-10T09:00:00+02:00",
"payVoucherNum": "",
"priceCod": "100",
"psCurrency": "USD",
"psInvoiceId": 1,
"psResponseDate": "2024-04-10T09:00:00+02:00",
"psStatus": "Y",
"psStatusCode": "",
"psStatusDescription": "",
"psStatusMessage": "",
"psSum": 100,
"reasonMarked": "",
"responsibleId": 1,
"sum": 100,
"updated1c": "N",
"version1c": "",
"xmlId": ""
}
},
"time": {
"start": 1713454774.293692,
"finish": 1713454778.895877,
"duration": 4.602184772491455,
"processing": 4.142766952514648,
"date_start": "2024-04-18T18:39:34+02:00",
"date_finish": "2024-04-18T18:39:38+02:00"
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response |
|
payment |
Object with information about the updated payment |
|
time |
Information about the request processing time |
Error Handling
HTTP status: 400
{
"error":200640400001,
"error_description":"payment does not exist"
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Error Codes
|
Code |
Description |
|
|
The payment being updated was not found |
|
|
Insufficient permissions to update the payment |
|
|
Parameter |
|
|
Parameter |
|
|
Other errors (e.g., fatal errors) |
Statuses and System Error Codes
HTTP Status: 20x, 40x, 50x
The errors described below may occur when calling any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred. Please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not permitted for calls using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The HTTPS protocol is required for method calls |
|
|
|
The REST API is blocked due to overload. This is a manual individual block; please contact Bitrix24 technical support to lift it |
|
|
|
The REST API is only available on commercial plans |
|
|
|
The user associated with the access token or webhook used to call the method lacks the necessary permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
The user does not have access to the application. This means that the application is installed, but the portal administrator has restricted access to this application to specific users only |
|
|
|
The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |
Continue Learning
- Payments in the Online Store: Overview of Methods
- Add Payment sale.payment.add
- Get Payment by Id sale.payment.get
- Get the list of payments sale.payment.list
- Delete Payment sale.payment.delete
- Get Payment Fields sale.payment.getFields