Get All Payment Methods
This API endpoint retrieves a list of payment methods with optional filtering by IDs. The endpoint returns basic payment method information including name and active status.
HTTP Request
- URL:
/paymentMethods - Method:
GET
Authentication
To access this endpoint, you must include a valid access token in the request header.
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Query Parameters
To filter your API requests, include the following query parameters:
| Parameter | Type | Description |
|---|---|---|
ids | String | Comma-separated list of payment method IDs to retrieve. |
Sample Request
Here's a sample cURL command to demonstrate how to make a request to this API endpoint:
curl --location '<BASE_URL>/paymentMethods' \
--header 'accessToken: <ACCESS_TOKEN>'
Sample Request with Filters
Retrieve specific payment methods by IDs:
curl --location '<BASE_URL>/paymentMethods?ids=507f1f77bcf86cd799439011,507f1f77bcf86cd799439012' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
Success Response
| Status Code | Description |
|---|---|
| 200 OK | The request was successful, and the server returned a list of payment methods. |
Response Structure
When successfully retrieving payment methods, the response will include the following structure:
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful. |
data | array | An array of payment method objects containing detailed information. |
total | integer | The total number of payment methods returned. |
Payment Method Object Structure
Each object in the data array contains the following fields:
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier for the payment method. |
name | String | Name of the payment method. |
active | Boolean | Indicates if the payment method is active. |
Sample JSON Response
Here's an example of the JSON response you might receive from this endpoint:
{
"success": true,
"data": [
{
"name": "stripe",
"active": false,
"id": "67644189a909f37370551d41"
},
{
"name": "authorizeNet",
"active": false,
"id": "67644189a909f37370551d42"
},
{
"name": "cashOnDelivery",
"active": true,
"id": "67644189a909f37370551d43"
},
{
"name": "poNumber",
"active": true,
"id": "67644189a909f37370551d44"
}
],
"total": 4
}
Error Responses
| Status Code | Description |
|---|---|
| 400 Bad Request | The request was malformed or invalid. |
| 401 Unauthorized | The access token is invalid or missing. |
| 403 Forbidden | You do not have permission to access this resource. |
| 404 Not Found | The requested resource could not be found. |
| 500 Internal Server Error | An error occurred on the server. |
Notes
- Ensure the access token is valid and active to authenticate the request successfully.
- The
idsparameter is optional. If not provided, all payment methods will be returned. - Only the
nameandactivefields are returned for security concerns. - The response includes a
totalfield indicating the number of payment methods returned.