Update Payment Method
Updates an existing payment method. Only provided fields will be updated.
HTTP Request
PATCH/api/payment/methods/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff with PaymentMethodPermission or Admin
- Permission Code: 2403
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the payment method to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| backend | String | No | Backend identifier for the payment method (zarinpal, pay-on-delivery) |
| active | Boolean | No | Whether the payment method is active |
| order | Integer | No | Order of the payment method in the list |
| name | String | No | Name of the payment method |
| image | Integer | No | ID of the payment method's logo image |
| description | String | No | Description of the payment method |
| settings | Object | No | Additional settings for the payment method (merchant_id, api_key, etc.) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Update payment method status and order
4response = requests.patch('http://www.example.com/api/payment/methods/123',
5 json={
6 'active': False,
7 'order': 5,
8 'description': 'Temporarily disabled for maintenance'
9 },
10 headers={'Authorization': 'Token <your_api_key>'}
11)
12print(response.json())
13
14# Update payment method settings
15response = requests.patch('http://www.example.com/api/payment/methods/123',
16 json={
17 'settings': {
18 'merchant_id': 'new_merchant_id',
19 'api_key': 'new_api_key',
20 'sandbox': False
21 }
22 },
23 headers={'Authorization': 'Token <your_api_key>'}
24)
25print(response.json())1# Update payment method status and order
2curl -X PATCH "http://www.example.com/api/payment/methods/123" \
3-H "Authorization: Token <your_api_key>" \
4-H "Content-Type: application/json" \
5-d '{
6 "active": false,
7 "order": 5,
8 "description": "Temporarily disabled for maintenance"
9}'
10
11# Update payment method settings
12curl -X PATCH "http://www.example.com/api/payment/methods/123" \
13-H "Authorization: Token <your_api_key>" \
14-H "Content-Type: application/json" \
15-d '{
16 "settings": {
17 "merchant_id": "new_merchant_id",
18 "api_key": "new_api_key",
19 "sandbox": false
20 }
21}'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) |
| thumbnails | List of thumbnail objects | Imgae thumbnails |
Thumbnail Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the thumbnail (unique) |
| f | String | URL to access the thumbnail file |
| size | Integer | File size in bytes (nullable) |
Example Response
{
"id": 3,
"active": true,
"backend": "zibal",
"order": 10,
"name": "ZibalPayment",
"image_data": {
"id": 2,
"type": "image",
"name": "logitech-mx-1",
"size": 4766,
"human_readable_size": "4.65 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech-mx-1.jpg",
"width": 225,
"height": 225,
"mode": "RGB",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"description": "quia",
"settings": {
"key": "someKey"
},
"auto_approve_payments": false,
"created_at": "2025-12-21T09:47:46.504213Z",
"updated_at": "2025-12-21T09:54:52.358733Z"
}
Notes
- Settings field will be completely overrided if provided
- The
settingsfield must be a valid json