Payments
Get Payment Status
Retrieve the status and details of a payment by Stripe payment intent ID
GET
Retrieves the purchase record and status for a specific Stripe payment intent. This endpoint is used to check whether a payment has been completed, is still pending, has failed, or has been refunded.
Authentication
Requires authentication. Users can only view their own payment status.Path Parameters
The Stripe payment intent ID (starts with
pi_). This is returned when creating a payment intent or can be obtained from Stripe webhooks.Response
The purchase record with populated content details
Purchase Status Values
| Status | Description |
|---|---|
pending | Payment intent created, waiting for payment completion |
completed | Payment successfully processed by Stripe |
failed | Payment failed (card declined, insufficient funds, etc.) |
refunded | Payment was refunded by an administrator |
Error Codes
| Status Code | Description |
|---|---|
| 200 | Payment status retrieved successfully |
| 401 | Not authenticated |
| 404 | Payment intent not found or doesn’t belong to user |
| 500 | Server error |
Security
- Users can only view payment status for their own purchases
- The query filters by both
paymentIntentIdand authenticateduserId - Payment intents from other users will return 404
Use Cases
- Poll this endpoint after payment to check if webhook processed successfully
- Display payment history to users
- Verify purchase before granting content access
- Show refund status to users
Related Endpoints
- Create Payment Intent - Start a new payment
- Webhook - How payment status gets updated
- List Payments - Admin endpoint to view all payments
Implementation Notes
- Content is populated with
title,description,type, andthumbnailUrlfields - User field is not populated in the response (only the ObjectId is returned)
- Source:
src/controllers/paymentController.js:133-151