Overview
This endpoint retrieves all payment methods associated with the authenticated user’s account. Payment methods can include bank transfers, mobile payments, and other payment options configured by the user.Authentication
This endpoint requires authentication via theverifyToken middleware. Include a valid JWT token in the Authorization header.
Endpoint
/api/payments-methods
Request
Headers
Bearer token for authentication
Example Request
Response
Success Response (200 OK)
Returns an array of payment method objects associated with the authenticated user.Unique identifier for the payment method
ID of the user who owns this payment method
Type of payment method (e.g., “bank_transfer”, “mobile_payment”, “email_payment”)
National identification number (CI - Cédula de Identidad) associated with the payment method
Bank name for bank transfer payment methods
Phone number for mobile payment methods
Name of the payment method owner
Email address for email-based payment methods
Example Response
Error Responses
Implementation Details
- Controller:
paymentsController.allPaymentMethods - Middleware:
verifyToken(authentication required) - Database Query: Retrieves all records from
payment_methodstable filtered by authenticated user’s ID - User Context: The user ID is extracted from the JWT token via
req.user.id
Use Cases
- Display all payment methods in user profile settings
- Allow users to select a payment method for currency exchange transactions
- Manage and review configured payment options
- Validate available payment methods before initiating a transaction