curl -X GET "https://api.vaniykempire.com/api/payments/admin/all?page=1&limit=20" \
-H "Authorization: Bearer ADMIN_JWT_TOKEN"
{
"purchases": [
{
"_id": "65f1a2b3c4d5e6f7g8h9i0j1",
"user": {
"_id": "507f1f77bcf86cd799439011",
"name": "John Doe",
"email": "john.doe@example.com"
},
"content": {
"_id": "507f191e810c19729de860ea",
"title": "Advanced React Patterns",
"type": "course"
},
"amount": 29.99,
"stripePaymentIntentId": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
"status": "completed",
"purchasedAt": "2024-03-15T10:30:00.000Z"
},
{
"_id": "65f1a2b3c4d5e6f7g8h9i0j2",
"user": {
"_id": "507f1f77bcf86cd799439012",
"name": "Jane Smith",
"email": "jane.smith@example.com"
},
"content": {
"_id": "507f191e810c19729de860eb",
"title": "Node.js Masterclass",
"type": "course"
},
"amount": 39.99,
"stripePaymentIntentId": "pi_3MtwCxLkdIwHu7ix29b4urQb",
"status": "completed",
"purchasedAt": "2024-03-15T09:15:00.000Z"
}
],
"totalPages": 5,
"currentPage": 1,
"totalPurchases": 87
}
Admin endpoint to retrieve all payments with pagination and filtering
curl -X GET "https://api.vaniykempire.com/api/payments/admin/all?page=1&limit=20" \
-H "Authorization: Bearer ADMIN_JWT_TOKEN"
{
"purchases": [
{
"_id": "65f1a2b3c4d5e6f7g8h9i0j1",
"user": {
"_id": "507f1f77bcf86cd799439011",
"name": "John Doe",
"email": "john.doe@example.com"
},
"content": {
"_id": "507f191e810c19729de860ea",
"title": "Advanced React Patterns",
"type": "course"
},
"amount": 29.99,
"stripePaymentIntentId": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
"status": "completed",
"purchasedAt": "2024-03-15T10:30:00.000Z"
},
{
"_id": "65f1a2b3c4d5e6f7g8h9i0j2",
"user": {
"_id": "507f1f77bcf86cd799439012",
"name": "Jane Smith",
"email": "jane.smith@example.com"
},
"content": {
"_id": "507f191e810c19729de860eb",
"title": "Node.js Masterclass",
"type": "course"
},
"amount": 39.99,
"stripePaymentIntentId": "pi_3MtwCxLkdIwHu7ix29b4urQb",
"status": "completed",
"purchasedAt": "2024-03-15T09:15:00.000Z"
}
],
"totalPages": 5,
"currentPage": 1,
"totalPurchases": 87
}
Administrator endpoint for viewing all payment transactions across the platform. Supports pagination and filtering by payment status.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/PhemiT/vaniykeempire-api/llms.txt
Use this file to discover all available pages before exploring further.
pending - Payment intent created but not completedcompleted - Successfully processed paymentfailed - Payment failedrefunded - Payment refunded by adminShow Purchase object properties
pending, completed, failed, or refundedpurchasedAt in descending order (newest first).
curl -X GET "https://api.vaniykempire.com/api/payments/admin/all?page=1&limit=20" \
-H "Authorization: Bearer ADMIN_JWT_TOKEN"
{
"purchases": [
{
"_id": "65f1a2b3c4d5e6f7g8h9i0j1",
"user": {
"_id": "507f1f77bcf86cd799439011",
"name": "John Doe",
"email": "john.doe@example.com"
},
"content": {
"_id": "507f191e810c19729de860ea",
"title": "Advanced React Patterns",
"type": "course"
},
"amount": 29.99,
"stripePaymentIntentId": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
"status": "completed",
"purchasedAt": "2024-03-15T10:30:00.000Z"
},
{
"_id": "65f1a2b3c4d5e6f7g8h9i0j2",
"user": {
"_id": "507f1f77bcf86cd799439012",
"name": "Jane Smith",
"email": "jane.smith@example.com"
},
"content": {
"_id": "507f191e810c19729de860eb",
"title": "Node.js Masterclass",
"type": "course"
},
"amount": 39.99,
"stripePaymentIntentId": "pi_3MtwCxLkdIwHu7ix29b4urQb",
"status": "completed",
"purchasedAt": "2024-03-15T09:15:00.000Z"
}
],
"totalPages": 5,
"currentPage": 1,
"totalPurchases": 87
}
| Query | Description |
|---|---|
?status=completed | Only successful payments |
?status=pending | Payments awaiting completion |
?status=failed | Failed payment attempts |
?status=refunded | Refunded transactions |
| No status parameter | All payments regardless of status |
let page = 1;
let hasMore = true;
while (hasMore) {
const response = await fetch(
`/api/payments/admin/all?page=${page}&limit=20`,
{ headers: { 'Authorization': `Bearer ${token}` } }
);
const data = await response.json();
// Process purchases
data.purchases.forEach(purchase => {
console.log(purchase);
});
// Check if there are more pages
hasMore = page < data.totalPages;
page++;
}
status and purchasedAt fields for faster filtering and sortingauthenticate and requireAdmin middlewarename and email fields onlytitle and type fields onlypurchasedAt descending (newest first)src/controllers/paymentController.js:154-179