Payment Events API
The Payment Events API allows you to interact with financial transactions. This API is generated by PayloadCMS and uses cookie-based authentication.
Authentication
All endpoints require authentication via cookies. You must be logged in to access these endpoints.
Access Rules
As a regular user, you can:
- View your own transactions
- View any fund_bounty or pay_contributor transactions
- Create new transactions
- Cannot update or delete any transactions (they are immutable)
Endpoints
List Payment Events
http
GET /api/payment-events
Retrieve a list of payment events you have access to.
Query Parameters
Parameter | Type | Description |
---|---|---|
page | number | Page number for pagination |
limit | number | Number of items per page |
where | object | Filter criteria |
sort | string | Sort field and direction |
Example Request
http
GET /api/payment-events?where[type][equals]=fund_bounty
Response
json
{
"docs": [{
"id": "event_123",
"type": "fund_bounty",
"status": "completed",
"amount": 5000,
"fromAccount": {
"id": "account_123",
"type": "user_wallet"
},
"toAccount": {
"id": "account_456",
"type": "platform_escrow"
},
"processedAt": "2024-01-15T00:00:00Z"
}],
"totalDocs": 50,
"page": 1,
"totalPages": 5,
"hasNextPage": true,
"hasPrevPage": false
}
Create Payment Event
http
POST /api/payment-events
Create a new payment event. Note that the actual processing will be handled by the platform.
Request Body
json
{
"type": "fund_bounty",
"amount": 5000,
"fromAccount": "account_123",
"toAccount": "account_456"
}
Error Responses
json
{
"errors": [{
"message": "Insufficient funds",
"field": "amount"
}]
}
Common error codes:
401
- Not authenticated403
- Not authorized to perform the action422
- Invalid input data