List Payments
Retrieve a list of payments with optional filtering.
GET
https://api.uprails.com/payments/listReturns a list of payments. The payments are returned sorted by creation date, with the most recently created payments appearing first. You can filter by various parameters to narrow down the results.
Request Example
List Payments
# List all payments
curl "https://api.uprails.com/payments/list" \
-H "api-key: snd_YOUR_API_KEY"
# List with filters
curl "https://api.uprails.com/payments/list?status=succeeded&limit=20&created_gte=2024-01-01" \
-H "api-key: snd_YOUR_API_KEY"
# List payments for a specific customer
curl "https://api.uprails.com/payments/list?customer_id=cus_xyz789" \
-H "api-key: snd_YOUR_API_KEY"Query Parameters
limitintegerdefault: 10Number of payments to return (1-100)
offsetintegerdefault: 0Number of payments to skip
statusstringFilter by payment status
Enum:
succeededfailedprocessingrequires_capturecancelledcustomer_idstringFilter by customer ID
created_gtestringFilter payments created on or after this date (ISO 8601)
created_ltestringFilter payments created on or before this date (ISO 8601)
currencystringFilter by currency code
Response
200OK
{
"data": [
{
"payment_id": "pay_1234567890abcdef",
"merchant_id": "mer_abcdef123456",
"status": "succeeded",
"amount": 5000,
"amount_received": 5000,
"currency": "USD",
"payment_method": "card",
"customer_id": "cus_xyz789",
"created": "2024-01-15T10:30:00Z"
},
{
"payment_id": "pay_0987654321fedcba",
"merchant_id": "mer_abcdef123456",
"status": "succeeded",
"amount": 2500,
"amount_received": 2500,
"currency": "USD",
"payment_method": "card",
"customer_id": "cus_abc123",
"created": "2024-01-14T15:00:00Z"
}
],
"total_count": 150,
"has_more": true
}Pagination
Use limit and offset to paginate through results. The response includes total_count and has_more to help with pagination logic.
Pagination Examplejavascript
// Example pagination logic
let offset = 0;
const limit = 20;
do {
const response = await fetch(
`https://api.uprails.com/payments/list?limit=${limit}&offset=${offset}`,
{ headers: { 'api-key': 'snd_YOUR_API_KEY' } }
);
const data = await response.json();
// Process payments
data.data.forEach(payment => {
console.log(payment.payment_id, payment.status);
});
offset += limit;
} while (data.has_more);Filtering Examples
By Date Range
/payments/list?created_gte=2024-01-01T00:00:00Z&created_lte=2024-01-31T23:59:59ZBy Status
/payments/list?status=succeededBy Customer
/payments/list?customer_id=cus_xyz789Combined Filters
/payments/list?status=succeeded&customer_id=cus_xyz789¤cy=USD&limit=50