List Payment Methods
Retrieves a list of payment methods with optional filtering and pagination.
HTTP Request
GET/api/payment/methods
Authorization
Authorization
- Required: Yes
- Permission: Admin or Staff
- Authentication: Token-based (Authorization: Token <your_api_key>)
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 10 | Number of results per page |
| offset | integer | 0 | Number of results to skip |
| ordering | string | order | Sort order (`id`, `name`, `order`, `active`, `created_at`, `updated_at`) |
| search | string | — | Search in (`id`, `name`, `description`) |
| backend | string | — | Filter by backend type (`zarinpal`, `pay-on-delivery`) |
| active | boolean | — | Filter by active status |
| has_image | boolean | — | Filter payment methods with/without an associated image |
| order_min | integer | — | Minimum order value filter |
| order_max | integer | — | Maximum order value filter |
| id_min | integer | — | Minimum ID filter |
| id_max | integer | — | Maximum ID filter |
| created_date | string | — | Filter by creation date (e.g., 2023-01-01) |
| updated_date | string | — | Filter by last updated date (e.g., 2023-01-01) |
| created_from | string | — | Filter by creation date range start |
| created_to | string | — | Filter by creation date range end |
| updated_from | string | — | Filter by last updated date range start |
| updated_to | string | — | Filter by last updated date range end |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# List all payment methods
4response = requests.get('http://www.example.com/api/payment/methods',
5 headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())
8
9# List active payment methods only
10response = requests.get('http://www.example.com/api/payment/methods', params={
11 'active': True,
12 'ordering': 'order'
13}, headers={'Authorization': 'Token <your_api_key>'})
14print(response.json())
15
16# Filter by backend type
17response = requests.get('http://www.example.com/api/payment/methods', params={
18 'backend': 'zarinpal',
19 'active': True
20}, headers={'Authorization': 'Token <your_api_key>'})
21print(response.json())1# List all payment methods
2curl "http://www.example.com/api/payment/methods" \
3-H "Authorization: Token <your_api_key>"
4
5# List active payment methods only
6curl "http://www.example.com/api/payment/methods?active=true&ordering=order" \
7-H "Authorization: Token <your_api_key>"
8
9# Filter by backend type
10curl "http://www.example.com/api/payment/methods?backend=zarinpal&active=true" \
11-H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Payment methods 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 payment method |
| backend | String | Backend identifier for the payment method |
| active | Boolean | Whether the payment method is active |
| order | Integer | Order of the payment method in the list |
| name | String | Name of the payment method |
| image_data | Object | Image details (read-only) |
| description | String | Description of the payment method |
| settings | Object | Additional settings for the payment method |
| created_at | String (ISO 8601) | Timestamp when the payment method was created |
| updated_at | String (ISO 8601) | Timestamp when the payment method was last updated |
Image Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the image |
| type | String | File type (e.g., image/jpeg) |
| name | String | Original file name |
| size | Integer | File size in bytes |
| human_readable_size | String | Human readable file size (e.g., 2.5 MB) |
| f | String | URL to access the image file |
| width | Integer | Image width in pixels |
| height | Integer | Image height in pixels |
| mode | String | Color mode (e.g., RGB, CMYK) |
Settings Structure
this response field depends on the payment method backend type and may include fields such as:
| Field | Type | Description |
|---|---|---|
| merchant_id | String | Merchant ID for payment gateway (e.g., Zarinpal) |
| api_key | String | API key for authenticating requests to the payment gateway |