Skip to main content

Update Order Payment

Update an existing order payment.

HTTP Request

PATCH/api/orders/:id/payments/:payment_id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the order to update
order_payment_idIntegerYesUnique ID of the order payment to update

Request Body

FieldTypeRequiredDescription
payment_methodIntegerNoID of the payment method
amountIntegerNoPayment amount (in smallest currency unit)
approvedBooleanNoWhether the payment is approved
transaction_idStringNoExternal transaction identifier
notesStringNoAdditional notes about the payment

Example Requests

1import requests
2
3# Partial update (PATCH)
4response = requests.patch('http://www.example.com/api/orders/123/payments/456', 
5  json={
6      'approved': True,
7      'transaction_id': 'TXN_UPDATED_789',
8      'notes': 'Payment approved after verification'
9  },
10  headers={'Authorization': 'Token <your_api_key>'}
11)
12print(response.json())
13
14# Update payment status only
15response = requests.patch('http://www.example.com/api/orders/123/payments/456', 
16  json={
17      'approved': False
18  },
19  headers={'Authorization': 'Token <your_api_key>'}
20)
21print(response.json())
22
23# Update amount and payment method
24response = requests.patch('http://www.example.com/api/orders/123/payments/456', 
25  json={
26      'amount': 7500,
27      'payment_method': 3
28  },
29  headers={'Authorization': 'Token <your_api_key>'}
30)
31print(response.json())

Status Codes

CodeDescription
200Order payment updated successfully
400Bad request — invalid input
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Not found — order payment does not exist
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)