Skip to main content

Create Manual Payment (v1)

Method & Path

POST /api/v1/admin/payments

Description

Create a new manual payment record for a workspace. Manual payments are payments added by administrators for offline payments (e.g., cash, bank transfer) or to record payments that were processed outside the system.

Authentication

Required: Admin authentication with payments.manage permission.

Headers

Authorization: Bearer <admin_token>
Content-Type: application/json

Request Body

{
"workspaceId": "507f1f77bcf86cd799439012",
"paymentType": "subscription",
"amount": 100.00,
"paymentMethod": "cash",
"paymentDate": "2025-01-15T10:30:00.000Z",
"description": "Monthly subscription payment",
"notes": "Payment received in cash",
"receiptImage": {
"url": "https://example.com/receipt.jpg",
"path": "/uploads/receipts/receipt.jpg",
"width": 1000,
"height": 1000,
"sizeBytes": 50000,
"contentType": "image/jpeg"
}
}

Request Body Schema

FieldTypeRequiredDescription
workspaceIdstringYesWorkspace ID to associate payment with
paymentTypestringYesPayment type: ai-tools, sms, storage, or subscription
amountnumberYesPayment amount in USD (must be > 0)
paymentMethodstringYesPayment method: cash, bank-transfer, card, or other
paymentDatedateNoPayment date (defaults to current date/time)
descriptionstringNoPayment description
notesstringNoAdditional notes about the payment
receiptImageobjectNoReceipt image information

Receipt Image Schema

FieldTypeRequiredDescription
urlstringYesPublic URL to the receipt image
pathstringYesServer path to the receipt image
widthnumberNoImage width in pixels
heightnumberNoImage height in pixels
sizeBytesnumberNoImage file size in bytes
contentTypestringYesMIME type of the image (e.g., image/jpeg)

Response 201 Created

{
"id": "507f1f77bcf86cd799439011",
"workspaceId": "507f1f77bcf86cd799439012",
"paymentType": "subscription",
"amount": 100.00,
"paymentMethod": "cash",
"paymentDate": "2025-01-15T10:30:00.000Z",
"description": "Monthly subscription payment",
"notes": "Payment received in cash",
"isManual": true,
"createdBy": "507f1f77bcf86cd799439014",
"receiptImage": {
"url": "https://example.com/receipt.jpg",
"path": "/uploads/receipts/receipt.jpg",
"width": 1000,
"height": 1000,
"sizeBytes": 50000,
"contentType": "image/jpeg"
},
"metadata": {},
"createdAt": "2025-01-15T10:30:00.000Z",
"updatedAt": "2025-01-15T10:30:00.000Z"
}

Common Errors

400 Bad Request:

  • Invalid workspace ID
  • Invalid payment type
  • Invalid payment method
  • Amount must be greater than 0
  • Missing required fields

401 Unauthorized: Missing or invalid authentication token

403 Forbidden: Admin does not have payments.manage permission

404 Not Found: Workspace not found

500 Internal Server Error: Server error occurred while creating the payment