Skip to content

/admin/invoices/:id/invoice_payments

Path: /admin/invoices/:id/invoice_payments

Namespace: admin

Parent Resource: invoices

Overview

Invoice payments represent payment records associated with an invoice. Each payment record tracks payment amount, method, date, and accounting status.

Available Operations

List Invoice Payments (GET)

Endpoint: GET /admin/invoices/:id/invoice_payments.json

Description: Retrieve all payment records for a specific invoice.

Request Example:

bash
GET /admin/invoices/123/invoice_payments.json

Response (200 OK):

json
{
  "invoice_payments": [
    {
      "id": 1,
      "invoice_id": 123,
      "amount_cents": 100000,
      "payment_method_id": 1,
      "date": "2024-01-15",
      "accounted": true
    }
  ]
}

Show Invoice Payment (GET /:id)

Endpoint: GET /admin/invoices/:id/invoice_payments/:id.json

Description: Retrieve a specific invoice payment record.

Request Example:

bash
GET /admin/invoices/123/invoice_payments/1.json

Response (200 OK):

json
{
  "invoice_payment": {
    "id": 1,
    "invoice_id": 123,
    "amount_cents": 100000,
    "payment_method_id": 1,
    "date": "2024-01-15",
    "accounted": true
  }
}

Create Invoice Payment (POST)

Endpoint: POST /admin/invoices/:id/invoice_payments.json

Description: Create a new payment record for an invoice.

Request Example:

bash
POST /admin/invoices/123/invoice_payments.json
Content-Type: application/json

{
  "invoice_payment": {
    "amount_cents": 100000,
    "payment_method_id": 1,
    "date": "2024-01-15"
  }
}

Response (201 Created):

json
{
  "invoice_payment": {
    "id": 1,
    "invoice_id": 123,
    "amount_cents": 100000,
    "payment_method_id": 1,
    "date": "2024-01-15"
  }
}

Update Invoice Payment (PATCH /:id)

Endpoint: PATCH /admin/invoices/:id/invoice_payments/:id.json

Description: Update an existing invoice payment record.

Request Example:

bash
PATCH /admin/invoices/123/invoice_payments/1.json
Content-Type: application/json

{
  "invoice_payment": {
    "amount_cents": 120000,
    "date": "2024-01-20"
  }
}

Response (200 OK):

json
{
  "invoice_payment": {
    "id": 1,
    "amount_cents": 120000,
    "date": "2024-01-20"
  }
}

Delete Invoice Payment (DELETE /:id)

Endpoint: DELETE /admin/invoices/:id/invoice_payments/:id.json

Description: Delete an invoice payment record.

Request Example:

bash
DELETE /admin/invoices/123/invoice_payments/1.json

Response (204 No Content)

Batch Actions (POST /batch_action)

Endpoint: POST /admin/invoices/:id/invoice_payments/batch_action.json

Description: Perform batch operations on selected invoice payments.

Request Example:

bash
POST /admin/invoices/123/invoice_payments/batch_action.json
Content-Type: application/json

{
  "batch_action": "update",
  "collection_selection": [1, 2, 3],
  "batch_action_inputs": {
    "date": "2024-01-15"
  }
}

Response (200 OK):

json
{
  "message": "Batch action completed",
  "affected_count": 3
}

Released under an open source license.