Handle a returned payment
Follow payment PP-1002 from the statement that returns it to a new payment for the same bill, with the reason the bank gave.
On this page
The payment PP-1002 paid the bill MV-2026-1187 of Moara Vadului SRL, 24102.50 RON. Your bank executed it, and a statement confirmed it. Later the bank returns the money. This guide follows what Treasury does when you import that return and what you do next.
1. Import the statement with the return
The statement file holds a line with the status returned. returnOf is the bankReference of the debit of the payment, and returnReason is what the bank wrote. Send it with `importStatement`, as in Import a statement.
{
"bankReference": "BK26112001",
"bookedOn": "2026-11-20",
"valueOn": "2026-11-20",
"counterparty": "Moara Vadului SRL",
"reference": "RETUR MV-2026-1187 PP-1002",
"amount": "24102.50",
"kind": "transfer",
"status": "returned",
"returnOf": "BK26111802",
"returnReason": "Beneficiary account closed"
} 2. The payment is rejected by the bank
The import changes the payment to rejected_by_bank and writes the reason of the bank in bankReason, as written. The status is final. The debit line it returns gets the status returned.
curl
curl "$RDC_BASE_URL/banking/v1/payment-proposals/cef8de13-2bf6-45ea-954f-036e324a40d5" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/payment-proposals/cef8de13-2bf6-45ea-954f-036e324a40d5`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/payment-proposals/cef8de13-2bf6-45ea-954f-036e324a40d5',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/payment-proposals/cef8de13-2bf6-45ea-954f-036e324a40d5');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/payment-proposals/cef8de13-2bf6-45ea-954f-036e324a40d5");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "cef8de13-2bf6-45ea-954f-036e324a40d5",
"number": "PP-1002",
"companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"billNumber": "MV-2026-1187",
"beneficiary": "Moara Vadului SRL",
"beneficiaryIban": "RO** **** **** **** **** 0000",
"amount": "24102.50",
"currency": "RON",
"dueOn": "2026-11-18",
"executeOn": "2026-11-18",
"status": "rejected_by_bank",
"requiredAuthority": "director",
"preparedBy": "Sorin Avram",
"approvals": [
{
"by": "Ana Rusu",
"at": "2026-11-17T09:30:00Z"
}
],
"declined": null,
"batchId": "00c36023-1b61-400c-80e1-c3a6cc1fec82",
"bankReason": "Beneficiary account closed",
"revision": 6
} 3. The event
If you have a subscription, Treasury sends payment.rejected with the number of the payment, the reason of the bank and the id of the return transaction. See the event catalogue.
{
"specversion": "1.0",
"id": "357624c2-3dac-46c3-a319-4900ec7844e9",
"type": "com.rdcopilot.banking.payment.rejected.v1",
"source": "/banking/v1",
"time": "2026-11-23T07:12:00Z",
"customerOrgId": "cd2cb4c5-1c0b-444a-8406-0f7045c8f12d",
"legalCompanyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
"aggregateType": "payment",
"aggregateId": "cef8de13-2bf6-45ea-954f-036e324a40d5",
"aggregateRevision": 6,
"correlationId": "7cd5439b-9494-49c6-bc36-ab83cbf3df25",
"causationId": "202e914a-22a1-448b-8f98-e27eac7090d5",
"actor": {
"serviceId": "banking-treasury"
},
"data": {
"number": "PP-1002",
"bankReason": "Beneficiary account closed",
"transactionId": "58ba7b3a-6ba5-4483-9611-f93018eca7c9"
}
} 4. The suggestion for the return
The return line is a transaction of its own, with returnOf and returnReason. Its match is suggested by the method rule. The allocation has the kind reversal: it points to the debit that the line reverses.
curl
curl "$RDC_BASE_URL/banking/v1/transactions/58ba7b3a-6ba5-4483-9611-f93018eca7c9" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/transactions/58ba7b3a-6ba5-4483-9611-f93018eca7c9`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/transactions/58ba7b3a-6ba5-4483-9611-f93018eca7c9',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/transactions/58ba7b3a-6ba5-4483-9611-f93018eca7c9');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/transactions/58ba7b3a-6ba5-4483-9611-f93018eca7c9");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "58ba7b3a-6ba5-4483-9611-f93018eca7c9",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"statementId": "f5b1321e-fbb0-4771-8393-9e4090091108",
"bookedOn": "2026-11-20",
"valueOn": "2026-11-20",
"counterparty": "Moara Vadului SRL",
"reference": "RETUR MV-2026-1187 PP-1002",
"amount": "24102.50",
"currency": "RON",
"kind": "transfer",
"status": "returned",
"bankReference": "BK26112001",
"returnOf": "a8359bc8-f9a3-4af7-92ff-ba1394b9a787",
"returnReason": "Beneficiary account closed",
"attachments": [],
"matchState": "suggested",
"matchId": "0b6c6654-3c52-433d-9c1a-9c05716d1f6d",
"revision": 1
} curl
curl "$RDC_BASE_URL/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "0b6c6654-3c52-433d-9c1a-9c05716d1f6d",
"transactionId": "58ba7b3a-6ba5-4483-9611-f93018eca7c9",
"state": "suggested",
"method": "rule",
"reason": {
"code": "rule-return",
"text": "The bank returned the payment MV-2026-1187 PP-1002. This line reverses it."
},
"allocations": [
{
"kind": "reversal",
"transactionId": "a8359bc8-f9a3-4af7-92ff-ba1394b9a787",
"amount": "24102.50"
}
],
"remainder": "0.00",
"note": null,
"revision": 1
} 5. A new payment before the return is matched
Until the return is accepted, the bill still counts the first payment as paid: its open amount is 0.00. A new proposal for the same bill is refused with amount_exceeds_open.
curl
curl -X POST "$RDC_BASE_URL/banking/v1/payment-proposals" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "8fb48b79-ebc6-472a-ad97-91f1e9f69094",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/payment-proposals`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "8fb48b79-ebc6-472a-ad97-91f1e9f69094",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/payment-proposals',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '8fb48b79-ebc6-472a-ad97-91f1e9f69094',
'openItemId': '0e68f20e-f1d1-4124-b772-df4dade386b7',
'accountId': '258f8664-ff43-4e53-b688-ad5a4a97ede6',
'amount': '24102.50',
'preparedById': '5e843f89-6c35-4a03-95a4-9f380ce14cd6',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "8fb48b79-ebc6-472a-ad97-91f1e9f69094",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/payment-proposals');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/payment-proposals");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "8fb48b79-ebc6-472a-ad97-91f1e9f69094",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"code": "amount_exceeds_open",
"message": "The amount is more than the bill still owes.",
"requestId": "5230bc15-93a3-4a2b-afcd-d66c34c7a35a"
} 6. Accept the return
`acceptMatch` on the suggestion makes the reversal final. The bill is open again.
curl
curl -X POST "$RDC_BASE_URL/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d/accept" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "9adffd17-7794-4de4-b5c4-ed802f4980fd",
"expectedRevision": 1
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d/accept`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "9adffd17-7794-4de4-b5c4-ed802f4980fd",
"expectedRevision": 1
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d/accept',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '9adffd17-7794-4de4-b5c4-ed802f4980fd',
'expectedRevision': 1,
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "9adffd17-7794-4de4-b5c4-ed802f4980fd",
"expectedRevision": 1
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d/accept');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/matches/0b6c6654-3c52-433d-9c1a-9c05716d1f6d/accept");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "9adffd17-7794-4de4-b5c4-ed802f4980fd",
"expectedRevision": 1
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "9adffd17-7794-4de4-b5c4-ed802f4980fd",
"status": "accepted",
"aggregateId": "0b6c6654-3c52-433d-9c1a-9c05716d1f6d",
"aggregateRevision": 2
} curl
curl "$RDC_BASE_URL/banking/v1/open-items/0e68f20e-f1d1-4124-b772-df4dade386b7" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/open-items/0e68f20e-f1d1-4124-b772-df4dade386b7`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/open-items/0e68f20e-f1d1-4124-b772-df4dade386b7',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/open-items/0e68f20e-f1d1-4124-b772-df4dade386b7');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/open-items/0e68f20e-f1d1-4124-b772-df4dade386b7");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"companyId": "3e738c06-3df7-4eb7-bfe2-259b8ba481f9",
"side": "payable",
"kind": "bill",
"number": "MV-2026-1187",
"partner": "Moara Vadului SRL",
"issuedOn": "2026-11-02",
"dueOn": "2026-11-18",
"gross": "24102.50",
"open": "24102.50",
"currency": "RON"
} 7. Prepare the payment again
The rejected proposal stays as a record, and the bill can have a new one. Prepare it with `preparePayment` and take it through approval. Read bankReason first and correct what it names.
curl
curl -X POST "$RDC_BASE_URL/banking/v1/payment-proposals" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "f4c1656c-ecf6-4f8f-b489-f83698e2580f",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/banking/v1/payment-proposals`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "f4c1656c-ecf6-4f8f-b489-f83698e2580f",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/banking/v1/payment-proposals',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': 'f4c1656c-ecf6-4f8f-b489-f83698e2580f',
'openItemId': '0e68f20e-f1d1-4124-b772-df4dade386b7',
'accountId': '258f8664-ff43-4e53-b688-ad5a4a97ede6',
'amount': '24102.50',
'preparedById': '5e843f89-6c35-4a03-95a4-9f380ce14cd6',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "f4c1656c-ecf6-4f8f-b489-f83698e2580f",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/banking/v1/payment-proposals');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/banking/v1/payment-proposals");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "f4c1656c-ecf6-4f8f-b489-f83698e2580f",
"openItemId": "0e68f20e-f1d1-4124-b772-df4dade386b7",
"accountId": "258f8664-ff43-4e53-b688-ad5a4a97ede6",
"amount": "24102.50",
"preparedById": "5e843f89-6c35-4a03-95a4-9f380ce14cd6"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "f4c1656c-ecf6-4f8f-b489-f83698e2580f",
"status": "accepted",
"aggregateId": "6baad224-c242-443c-a753-fb096e8c8085",
"aggregateRevision": 1
} What changed in the records
- The payment
PP-1002isrejected_by_bankwith itsbankReason, and it keeps its approvals and its payment file. - The debit line it returns has the status
returned; the return line is matched with the allocationreversal. - The bill is open for its whole amount again, and the new proposal has a new number.
Next: Event catalogue and Error codes.