Customer Payments
Reference for the customer_payments resource. Requests follow the conventions in
Requests and Responses; fields you
receive and may write are filtered by your user's permissions, so responses can
contain a subset of the fields below.
Operations
| Operation | Request |
|---|---|
| List | GET /{profile}/user/v4/customer_payments |
| Fetch | GET /{profile}/user/v4/customer_payments/{id} |
| Create | POST /{profile}/user/v4/customer_payments |
| Update | PATCH /{profile}/user/v4/customer_payments/{id} |
| Delete | DELETE /{profile}/user/v4/customer_payments/{id} |
| Charge a recorded payment through the gateway | POST /{profile}/user/v4/customer_payments/{id}/process |
| Void a same-day, unsettled, un-applied gateway charge | POST /{profile}/user/v4/customer_payments/{id}/void |
| Refund a settled charge (full or partial) | POST /{profile}/user/v4/customer_payments/{id}/refund |
Required on create: link customer under data.relationships — a create that omits it is rejected with 422 naming the relationship.
How it works
customer_payments are the payments recorded against a customer — cash, check, or a
card/bank charge run through the payment gateway. Gated by Customer Payments at the
customer's location.
Recording a payment is not the same as charging one
Creating a customer_payments row records a payment — it never contacts the payment
gateway. POST to record, PATCH to edit, DELETE to remove. Actually charging a
card/bank (and later voiding or refunding it) runs through the separate
process/void/refund action, which is the only path that touches the gateway.
curl -X POST "https://portal.securitytrax.com/acme/user/v4/customer_payments" \
-H "Authorization: Bearer stx_acme_..." \
-H "Content-Type: application/json" \
-d '{"data":{"attributes":{"amount":"49.99","payment_date":"2026-07-15","customer_payment_type_id":3,"notes":"July check"},"relationships":{"customer":{"data":{"type":"customers","id":100}}}}}'
| Field | Required | Notes |
|---|---|---|
customer_id |
Yes | The customer the payment is recorded against (the permission context). |
amount |
Yes | Non-zero. A positive amount requires payment_date. |
customer_payment_type_id |
Yes | The payment type (cash, check, …) for a recorded payment. |
payment_date |
Conditional | Required when amount is greater than 0. |
customer_billing_id |
No | The stored billing method a gateway charge would use — must belong to the same customer as the payment (422 otherwise). |
notes |
No | Free text, ≤ 2040 chars. Must not contain card data. |
receipt_emails |
No | Comma-separated list of valid email addresses. |
cleared, cleared_date |
No | Mark a payment cleared and when. |
Processing, voiding, and refunding
Charging the gateway is a set of action endpoints — the only path that writes the gateway result fields. Each requires the Process Payment permission and returns the updated payment.
| Action | Endpoint | Notes |
|---|---|---|
| Process | POST /customer_payments/{id}/process |
Charge the recorded payment. Body: {"data":{"attributes":{"type":"sale","cvv":"123"}}} — type is sale (default) or credit (needs Process Payment Credit); cvv is optional and never stored. Requires a card/bank billing method and a company gateway. |
| Void | POST /customer_payments/{id}/void |
Reverse a same-day, unsettled, un-applied charge. |
| Refund | POST /customer_payments/{id}/refund |
Refund a settled charge. Body: {"data":{"attributes":{"amount":25.00}}} — omit amount to refund the full refundable balance. |
curl -X POST "https://portal.securitytrax.com/acme/user/v4/customer_payments/42/process" \
-H "Authorization: Bearer stx_acme_..." \
-H "Content-Type: application/json" \
-d '{"data":{"attributes":{"type":"sale","cvv":"123"}}}'
On success the response is the updated payment plus meta.auth_code and any gateway
meta.messages. A gateway decline returns 422 with the reason (the payment stays
unprocessed and can be retried). An action that isn't possible for the payment's current state —
already processed, nothing refundable, no gateway enabled — returns 409; a permission failure
returns 403. A recorded payment is charged at most once: re-processing an already-processed
payment is a 409, so a retried request can never double-charge.
Read-only fields
The gateway result — transaction_id, authcode, processing_status, processed_at,
is_refunded, is_voided, and the rest of the gateway_processing block — is read-only
and visible only with the Process Payment permission. These are written by the gateway when
a payment is processed, never by a client: a payment is "paid" only because it was actually
charged, so you cannot set these on create/update to fake a paid payment. The system columns
(tax, sale_type, check_number, posting dates, audit stamps) are read-only too.
Reading a customer's payments
The simplest read is on the parent: GET /customers/{id}?include=payments. You can also list
directly: GET /customer_payments?customer_id={customerId} (filters: customer_id,
customer_payment_type_id, customer_billing_id, cleared, payment_date/created_at
ranges; sort: id, customer_id, payment_date, amount, created_at; ?count_only=true
for the total).
Fields
Fields are grouped by the permission that gates them. A group you may not view
is absent from responses; a group you may not write is rejected with 422 when
sent in a write.
Payment
View: Customer Payments at the record's location. Create: Customer Payments at the record's location. Update: Customer Payments at the record's location.
| Field | Type | Writable | Validation |
|---|---|---|---|
customer_id |
integer (nullable) | Create, update | min 0 |
amount |
string (nullable) | Create, update | Required on create; not 0 |
payment_date |
string (nullable) | Create, update | — |
notes |
string (nullable) | Create, update | max length 2040 |
customer_payment_type_id |
integer (nullable) | Create, update | Required on create; min 0 |
customer_billing_id |
integer (nullable) | Create, update | min 0 |
cleared |
boolean (nullable) | Create, update | — |
cleared_date |
string (nullable) | Create, update | — |
receipt_emails |
string (nullable) | Create, update | max length 1024 |
status |
string (nullable) | Read-only | one of: active, deleted |
Payment Meta
View: Customer Payments at the record's location.
| Field | Type | Writable | Validation |
|---|---|---|---|
tax |
string (nullable) | Read-only | — |
check_number |
string (nullable) | Read-only | max length 255 |
sale_type |
string (nullable) | Read-only | one of: sale, credit, refund |
expected_clearing_date |
string (nullable) | Read-only | — |
posted_date |
string (nullable) | Read-only | — |
desired_posting_date |
string (nullable) | Read-only | — |
email_when_processed |
boolean (nullable) | Read-only | — |
external_source |
string (nullable) | Read-only | one of: payment_portal, adc_partner_services |
parent_entity_payment_id |
integer (nullable) | Read-only | min 0 |
created_at |
string (nullable) | Read-only | — |
created_by |
integer (nullable) | Read-only | — |
updated_at |
string (nullable) | Read-only | — |
updated_by |
integer (nullable) | Read-only | — |
Gateway Processing
View: Process Payment at the record's location.
| Field | Type | Writable | Validation |
|---|---|---|---|
transaction_id |
string (nullable) | Read-only | min length 0 |
authcode |
string (nullable) | Read-only | max length 255 |
is_refunded |
string (nullable) | Read-only | — |
is_voided |
string (nullable) | Read-only | — |
processed_at |
string (nullable) | Read-only | — |
processed_by |
integer (nullable) | Read-only | min 0 |
processing_status |
string (nullable) | Read-only | max length 25 |
processing_status_submitted |
string (nullable) | Read-only | — |
processing_gateway_id |
integer (nullable) | Read-only | min 0 |
Pagination
The list endpoint uses client-controlled offset pagination: ?page= (1-based) and
?per_page= (default 25, max 100). The response mirrors
meta.pagination (page, per_page, total, last_page) and sends an RFC5988
Link header; follow rel="next" to walk pages. See
Pagination.
Filters
The list endpoint accepts these query-param filters: customer_id, customer_payment_type_id, customer_billing_id, cleared, payment_date_from, payment_date_to, created_at_from, created_at_to.
An unsupported filter parameter returns 422. See
Filtering collections
for matching semantics.
Sorting
GET .../customer_payments?sort= orders the list by: id, customer_id, payment_date, amount, created_at.
Prefix a field with - for descending; comma-separate for tie-breakers. An
unsupported field returns 422. See
Sorting collections.
Related
- Requests and Responses — envelope, errors, pagination, and rate limits.
- Authentication — tokens and the
Authorizationheader.