Skip to main content

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

HeaderTypeDescription
accessTokenstringAccess token for authentication. (required)

Query Parameters

To filter your API requests, include the following query parameters:

ParameterTypeDescription
idsStringComma-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 CodeDescription
200 OKThe 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:

FieldTypeDescription
successbooleanIndicates whether the request was successful.
dataarrayAn array of payment method objects containing detailed information.
totalintegerThe total number of payment methods returned.

Payment Method Object Structure

Each object in the data array contains the following fields:

FieldTypeDescription
idStringUnique identifier for the payment method.
nameStringName of the payment method.
activeBooleanIndicates 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 CodeDescription
400 Bad RequestThe request was malformed or invalid.
401 UnauthorizedThe access token is invalid or missing.
403 ForbiddenYou do not have permission to access this resource.
404 Not FoundThe requested resource could not be found.
500 Internal Server ErrorAn error occurred on the server.

Notes

  • Ensure the access token is valid and active to authenticate the request successfully.
  • The ids parameter is optional. If not provided, all payment methods will be returned.
  • Only the name and active fields are returned for security concerns.
  • The response includes a total field indicating the number of payment methods returned.