Get All Order Payments
Retrieves a list of all order payments with optional filtering, sorting, and pagination.
HTTP Request
GET/api/orders/:order_id/payments
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| order_id | integer | Yes | Unique ID of the order to retrieve payments for |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | — | Number of results to return per page |
| offset | integer | — | Number of results to skip before returning results |
| search | string | — | Search term to filter results by `id`, `transaction_id`, `payment_method__name` |
| ordering | string | — | Field to order results by (`id`, `transaction_id`, `approved`, `amount`, `payment_method__id`, `payment_method__name`, `order__id`, `order__status`, `created_at`, `updated_at`) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# List all payments for an order
4response = requests.get('http://www.example.com/api/orders/123/payments',
5 headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())
8
9# Search for payments with filters
10response = requests.get('http://www.example.com/api/orders/123/payments', params={
11 'search': 'TXN123',
12 'approved': True,
13 'ordering': '-created_at',
14 'limit': 20
15}, headers={'Authorization': 'Token <your_api_key>'})
16print(response.json())
17
18# Filter by payment amount
19response = requests.get('http://www.example.com/api/orders/123/payments', params={
20 'ordering': 'amount'
21}, headers={'Authorization': 'Token <your_api_key>'})
22print(response.json())1# List all payments for an order
2curl "http://www.example.com/api/orders/123/payments" -H "Authorization: Token <your_api_key>"
3
4# Search with filters
5curl "http://www.example.com/api/orders/123/payments?search=TXN123&approved=true&ordering=-created_at&limit=20" -H "Authorization: Token <your_api_key>"
6
7# Filter by amount
8curl "http://www.example.com/api/orders/123/payments?ordering=amount" -H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Orders retrieved successfully |
| 400 | Bad request — invalid parameters |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the order payment |
| payment_method | Integer | ID of the payment method (write-only) |
| payment_method_data | Object | Payment method details (read-only) |
| approved | Boolean | Whether the payment is approved |
| amount | Integer | Payment amount (in smallest currency unit) |
| transaction_id | String | External transaction identifier |
| notes | String | Additional notes about the payment |
| created_at | String (ISO 8601) | Timestamp when payment was created |
| updated_at | String (ISO 8601) | Timestamp when payment was last updated |
Payment Method Data Fields:
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the payment method |
| name | String | Name of the payment method |
| image | Object | Image details for the payment method |
Image Data Fields:
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the image |
| width | Integer | Width of the image in pixels |
| height | Integer | Height of the image in pixels |
| mode | String | Color mode of the image (e.g., RGB, RGBA) |