curl -X POST https://api.vaniykempire.com/api/payments/admin/refund/65f1a2b3c4d5e6f7g8h9i0j1 \
-H "Authorization: Bearer ADMIN_JWT_TOKEN"
{
"message": "Refund successful",
"purchase": {
"_id": "65f1a2b3c4d5e6f7g8h9i0j1",
"user": "507f1f77bcf86cd799439011",
"content": "507f191e810c19729de860ea",
"amount": 29.99,
"stripePaymentIntentId": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
"status": "refunded",
"purchasedAt": "2024-03-15T10:30:00.000Z"
}
}
Admin endpoint to process refunds for completed purchases
curl -X POST https://api.vaniykempire.com/api/payments/admin/refund/65f1a2b3c4d5e6f7g8h9i0j1 \
-H "Authorization: Bearer ADMIN_JWT_TOKEN"
{
"message": "Refund successful",
"purchase": {
"_id": "65f1a2b3c4d5e6f7g8h9i0j1",
"user": "507f1f77bcf86cd799439011",
"content": "507f191e810c19729de860ea",
"amount": 29.99,
"stripePaymentIntentId": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
"status": "refunded",
"purchasedAt": "2024-03-15T10:30:00.000Z"
}
}
Administrator endpoint for issuing refunds on completed purchases. Creates a refund in Stripe and updates the purchase status toDocumentation 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.
refunded.
completed can be refundedpending, failed, or already refundedrefunded upon successrefunded statusShow purchase properties
refunded after successful refundpurchaseIdcompletedstripe.refunds.create({ payment_intent: stripePaymentIntentId })refundedsucceeded for purchase to be marked as refundedcurl -X POST https://api.vaniykempire.com/api/payments/admin/refund/65f1a2b3c4d5e6f7g8h9i0j1 \
-H "Authorization: Bearer ADMIN_JWT_TOKEN"
{
"message": "Refund successful",
"purchase": {
"_id": "65f1a2b3c4d5e6f7g8h9i0j1",
"user": "507f1f77bcf86cd799439011",
"content": "507f191e810c19729de860ea",
"amount": 29.99,
"stripePaymentIntentId": "pi_3MtwBwLkdIwHu7ix28a3tqPa",
"status": "refunded",
"purchasedAt": "2024-03-15T10:30:00.000Z"
}
}
| Scenario | Status Code | Error Message |
|---|---|---|
| Purchase not found | 404 | ”Purchase not found” |
| Purchase is pending | 400 | ”Only completed purchases can be refunded” |
| Purchase is failed | 400 | ”Only completed purchases can be refunded” |
| Already refunded | 400 | ”Only completed purchases can be refunded” |
| Stripe refund fails | 400 | ”Refund failed” |
| Not authenticated | 401 | ”Not authenticated” |
| Not admin | 403 | ”Admin access required” |
| Server error | 500 | Error message details |
refunded, returns successauthenticate and requireAdmin middlewaresucceeded for purchase updatesrc/controllers/paymentController.js:182-217// Use test API keys
const stripe = require('stripe')('sk_test_...');
// Create test payment
// Issue refund using test purchase ID
// Verify refund in Stripe test dashboard
4242 4242 4242 4242 - Successful refunds4000 0000 0000 0259 - Successful charges with dispute risk