---
title: "SQL-020: clsPaymentReturn insert"
summary: Inserts a returned/failed EFT payment record into PAYMENT_RETURN.
status: draft
owner: SAIF
last_reviewed: 2026-07-24
library: SAIF.Business.Payment.EFT
reference_type: package
---

# SQL-020: clsPaymentReturn insert

Inserts a returned/failed EFT payment record into PAYMENT_RETURN.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-020 |
| **Operation type** | Create |
| **Execution method** | Inline SQL |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | `clsPaymentReturn` |
| **Criteria property** | `InsertSQL` |
| **Lifecycle method** | `BeforeInsert / AfterInsert` |


## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| :CreateDate | Input | Date | — | Binds `CreateDate`* |
| :CreateUser | Input | String | 30 | Binds `CreateUser`* |
| :CreditDebitCode | Input | String | 5 | Binds `CreditDebitCode` |
| :CustomerID | Input | String | 20 | Binds `CustomerID` |
| :CustomerName | Input | String | 22 | Binds `CustomerName` |
| :PaymentAmt | Input | Decimal | — | Binds `PaymentAmt` |
| :PaymentReturnReasonCode | Input | String | 5 | Binds `PaymentReturnReasonCode` |
| :PaymentReturnSeqNum | Input | Decimal | — | Binds `PaymentReturnSeqNum` |
| :PaymentSourceSystemCode | Input | String | 5 | Binds `PaymentSourceSystemCode` |
| :ReturnAddendaLine | Input | String | 255 | Binds `ReturnAddendaLine` |
| :ReturnDate | Input | Date | — | Binds `ReturnDate` |
| :ReturnDetailLine | Input | String | 255 | Binds `ReturnDetailLine` |
| :ReturnStatusCode | Input | String | 5 | Binds `ReturnStatusCode` |
| :ReturnTypeCode | Input | String | 5 | Binds `ReturnTypeCode` |
| :TraceNum | Input | String | 20 | Binds `TraceNum` |
| :PaymentDetailSeqNum | Input | Decimal | — | Binds `m_PaymentDetailSeqNum`* |
| :UpdateDate | Input | Date | — | Binds `m_UpdateDate`* |
| :UpdateUser | Input | String | 30 | Binds `m_UpdateUser`* |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PAYMENT_RETURN](../database-tables.md#payment_return) | — | — |

## Sample SQL

```sql
Insert into PAYMENT_RETURN (
  CREATE_DATE, CREATE_USER, CREDIT_DEBIT_CODE, CUSTOMER_ID, CUSTOMER_NAME,
  PAYMENT_AMT, PAYMENT_DETAIL_SEQ_NUM, PAYMENT_RETURN_REASON_CODE,
  PAYMENT_RETURN_SEQ_NUM, PAYMENT_SOURCE_SYSTEM_CODE, RETURN_ADDENDA_LINE,
  RETURN_DATE, RETURN_DETAIL_LINE, RETURN_STATUS_CODE, RETURN_TYPE_CODE,
  TRACE_NUM, UPDATE_DATE, UPDATE_USER
)
Values (
  :CreateDate, :CreateUser, :CreditDebitCode, :CustomerID, :CustomerName,
  :PaymentAmt, :PaymentDetailSeqNum, :PaymentReturnReasonCode,
  :PaymentReturnSeqNum, :PaymentSourceSystemCode, :ReturnAddendaLine,
  :ReturnDate, :ReturnDetailLine, :ReturnStatusCode, :ReturnTypeCode,
  :TraceNum, :UpdateDate, :UpdateUser
)
```

## Operations and processes
- [Payment return handling](../operations/payment-return-handling.md)*

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Business rules
- [BR-EFT-03: Returned EFT payment classified by NACHA return reason code](../business-rules.md#br-eft-03-returned-eft-payment-classified-by-nacha-return-reason-code)
- [BR-EFT-05: Insert/update operations require exactly one affected row](../business-rules.md#br-eft-05-insertupdate-operations-require-exactly-one-affected-row)*

## Sources
- `Business\SAIF.Business.Payment.EFT\clsPaymentReturn.vb`
