Skip to main content

Create Order Payment

Create a new order payment.

HTTP Request

POST/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 create a payment for

Request Body

FieldTypeRequiredDescription
payment_methodIntegerYesID of the payment method
amountIntegerYesPayment amount (in smallest currency unit)
approvedBooleanNoWhether the payment is approved (default: false)
transaction_idStringNoExternal transaction identifier
notesStringNoAdditional notes about the payment

Example Requests

1import requests
2
3# Create a new order payment
4response = requests.post('http://www.example.com/api/orders/123/payments', 
5  json={
6      'payment_method': 5,
7      'amount': 5000,
8      'approved': True,
9      'transaction_id': 'TXN_ABC123',
10      'notes': 'Credit card payment processed successfully'
11  },
12  headers={'Authorization': 'Token <your_api_key>'}
13)
14print(response.json())
15
16# Create minimal payment
17response = requests.post('http://www.example.com/api/orders/123/payments', 
18  json={
19      'payment_method': 2,
20      'amount': 2500
21  },
22  headers={'Authorization': 'Token <your_api_key>'}
23)
24print(response.json())

Status Codes

CodeDescription
201Order payment created successfully
400Bad request — invalid input
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)