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
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}'GET https://backend.flashback.tech/subscriptions/payments HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}
# With date filter
GET https://backend.flashback.tech/subscriptions/payments?startDate=2024-01-01&endDate=2024-12-31 HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
// Get all payments
fetch('https://backend.flashback.tech/subscriptions/payments',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
// Get payments with date filter
const params = new URLSearchParams({
startDate: '2024-01-01',
endDate: '2024-12-31'
});
fetch(`https://backend.flashback.tech/subscriptions/payments?${params}`,
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
# Get all payments
result = RestClient.get 'https://backend.flashback.tech/subscriptions/payments',
params: {
}, headers: headers
p JSON.parse(result)
# Get payments with date filter
result = RestClient.get 'https://backend.flashback.tech/subscriptions/payments',
params: {
startDate: '2024-01-01',
endDate: '2024-12-31'
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
# Get all payments
r = requests.get('https://backend.flashback.tech/subscriptions/payments', headers = headers)
print(r.json())
# Get payments with date filter
params = {
'startDate': '2024-01-01',
'endDate': '2024-12-31'
}
r = requests.get('https://backend.flashback.tech/subscriptions/payments',
headers=headers,
params=params)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Get all payments
try {
$response = $client->request('GET','https://backend.flashback.tech/subscriptions/payments', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// Get payments with date filter
try {
$response = $client->request('GET','https://backend.flashback.tech/subscriptions/payments', array(
'headers' => $headers,
'query' => [
'startDate' => '2024-01-01',
'endDate' => '2024-12-31'
]
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...// Get all payments
URL obj = new URL("https://backend.flashback.tech/subscriptions/payments");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
// Get payments with date filter
String url = "https://backend.flashback.tech/subscriptions/payments?startDate=2024-01-01&endDate=2024-12-31";
URL obj2 = new URL(url);
HttpURLConnection con2 = (HttpURLConnection) obj2.openConnection();
con2.setRequestMethod("GET");
// ... rest of the code similar to abovepackage main
import (
"bytes"
"net/http"
"net/url"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
// Get all payments
data := bytes.NewBuffer([]byte{})
req, err := http.NewRequest("GET", "https://backend.flashback.tech/subscriptions/payments", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
// Get payments with date filter
params := url.Values{}
params.Add("startDate", "2024-01-01")
params.Add("endDate", "2024-12-31")
req2, err := http.NewRequest("GET", "https://backend.flashback.tech/subscriptions/payments?"+params.Encode(), data)
req2.Header = headers
resp2, err := client.Do(req2)
// ...
}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
Response Schema
Status Code 200
» 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
» 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
» 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
» 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?