get__subscription_payments

GET /subscriptions/payments

Get Organization Payments

Retrieve payment history for the authenticated user's organization. Supports optional date filtering to get payments within a specific time range.

Parameters

Name
In
Type
Required
Description

startDate

query

string

false

Start date for filtering payments (ISO 8601 format)

endDate

query

string

false

End date for filtering payments (ISO 8601 format)

TypeScript Client Library

public getPayments = async (params?: PaymentsQueryParams): Promise<PaymentsListResponse> => {
  const queryParams = new URLSearchParams();
  if (params?.startDate) {
    queryParams.append('startDate', params.startDate);
  }
  if (params?.endDate) {
    queryParams.append('endDate', params.endDate);
  }
  return this.makeRequest<PaymentsListResponse>(
    `subscriptions/payments${queryParams.toString() ? `?${queryParams.toString()}` : ''}`,
    'GET',
    null
  );
};

Code Samples

# Get all payments
curl -X GET https://backend.flashback.tech/subscriptions/payments \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

# Get payments with date filter
curl -X GET 'https://backend.flashback.tech/subscriptions/payments?startDate=2024-01-01&endDate=2024-12-31' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

Example responses

200 Response

{
  "success": true,
  "data": [
    {
      "id": "pay_1234567890abcdef",
      "amount": 1999,
      "currency": "usd",
      "status": "COMPLETED",
      "timestamp": "2024-01-15T10:00:00Z"
    },
    {
      "id": "pay_0987654321fedcba",
      "amount": 0,
      "currency": "usd",
      "status": "CANCELLED",
      "timestamp": "2024-01-20T14:30:00Z"
    }
  ]
}

200 Response (Empty)

{
  "success": true,
  "data": []
}

400 Response (No Organization)

{
  "success": false,
  "error_code": "NO_ORGANIZATION",
  "message": "User must belong to an organization"
}

400 Response (Invalid Start Date)

{
  "success": false,
  "error_code": "INVALID_START_DATE",
  "message": "Invalid start date format"
}

400 Response (Invalid End Date)

{
  "success": false,
  "error_code": "INVALID_END_DATE",
  "message": "Invalid end date format"
}

400 Response (Invalid Date Range)

{
  "success": false,
  "error_code": "INVALID_DATE_RANGE",
  "message": "Start date must be before end date"
}

404 Response

{
  "success": false,
  "error_code": "USER_NOT_FOUND",
  "message": "User not found"
}

500 Response

{
  "success": false,
  "error_code": "INTERNAL_ERROR",
  "message": "Failed to retrieve payments"
}

Responses

Status
Meaning
Description
Schema

200

List of payments

Inline

400

Invalid request or date parameters

Inline

404

User not found

Inline

500

Server error

Inline

Response Schema

Status Code 200

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Indicates if the request was successful

» data

[object]

false

none

Array of payment records

»» id

string

false

none

Unique identifier for the payment

»» amount

number

false

none

Payment amount in the smallest currency unit

»» currency

string

false

none

Currency code (e.g., usd, eur)

»» status

string

false

none

Payment status (COMPLETED, PENDING, CANCELLED)

»» timestamp

string(date-time)

false

none

Payment timestamp (paidAt or createdAt)

Status Code 400

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Will be false for error responses

» error_code

string

false

none

Machine-readable error code

» message

string

false

none

Human-readable error message

Status Code 404

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Will be false for error responses

» error_code

string

false

none

Machine-readable error code

» message

string

false

none

Human-readable error message

Status Code 500

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Will be false for error responses

» error_code

string

false

none

Machine-readable error code

» message

string

false

none

Human-readable error message

Last updated

Was this helpful?