Skip to main content

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

ParameterTypeRequiredDescription
order_idintegerYesUnique ID of the order to retrieve payments for

Query Parameters

ParameterTypeDefaultDescription
limitintegerNumber of results to return per page
offsetintegerNumber of results to skip before returning results
searchstringSearch term to filter results by `id`, `transaction_id`, `payment_method__name`
orderingstringField 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

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())

Status Codes

CodeDescription
200Orders retrieved successfully
400Bad request — invalid parameters
401Unauthorized — authentication required
403Forbidden — insufficient permissions
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the order payment
payment_methodIntegerID of the payment method (write-only)
payment_method_dataObjectPayment method details (read-only)
approvedBooleanWhether the payment is approved
amountIntegerPayment amount (in smallest currency unit)
transaction_idStringExternal transaction identifier
notesStringAdditional notes about the payment
created_atString (ISO 8601)Timestamp when payment was created
updated_atString (ISO 8601)Timestamp when payment was last updated

Payment Method Data Fields:

FieldTypeDescription
idIntegerUnique ID of the payment method
nameStringName of the payment method
imageObjectImage details for the payment method

Image Data Fields:

FieldTypeDescription
idIntegerUnique ID of the image
widthIntegerWidth of the image in pixels
heightIntegerHeight of the image in pixels
modeStringColor mode of the image (e.g., RGB, RGBA)