Przejdź do głównej zawartości

List Payments

GET
/payments/

Returns a paginated list of all payments for your merchant account with filtering and sorting options.

Authentication

Requires OAuth 2.0 authentication with read scope.

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number (default: 1)
page_sizeintegerNoResults per page (1-100, default: 30)
statusstringNoFilter by status: waiting, confirming, completed, expired, failed
pay_currencystringNoFilter by currency code (e.g., "USDTERC20")
order_idstringNoFilter by your order ID
created_afterdatetimeNoFilter payments created after this date (ISO 8601)
created_beforedatetimeNoFilter payments created before this date (ISO 8601)
amount_mindecimalNoMinimum payment amount in USD
amount_maxdecimalNoMaximum payment amount in USD
orderingstringNoSort order: created_at, -created_at, amount, -amount (default: -created_at)

Example Request

curl -X GET "https://api.cryptofuse.io/payments/?page=1&page_size=20&status=completed&pay_currency=USDTERC20" \
-H "Authorization: Bearer your_access_token"

Response

Success Response (200 OK)

{
"count": 156,
"next": "https://api.cryptofuse.io/payments/?page=2&page_size=20",
"previous": null,
"results": [
{
"transaction_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"payment_type": "full",
"provider": "transaction_manager",
"price_amount": "100.00",
"price_currency": "USD",
"pay_amount": "100.050000",
"pay_currency": "USDTERC20",
"blockchain_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f8b8E0",
"blockchain_network": "ETH",
"token": "USDT",
"transaction_hash": "0x123abc456def789...",
"confirmations": 12,
"order_id": "ORDER-12345",
"order_description": "Premium subscription",
"merchant_received_usd": "99.00",
"payment_history": [
{
"deposit_id": "dep_123",
"amount": "100.050000",
"transaction_hash": "0x123abc456def789...",
"confirmations": 12,
"timestamp": "2025-01-15T10:15:00Z"
}
],
"expiry_time": "2025-01-15T10:30:00Z",
"created_at": "2025-01-15T10:00:00Z",
"updated_at": "2025-01-15T10:20:00Z"
},
{
"transaction_id": "660e8400-e29b-41d4-a716-446655440001",
"status": "waiting",
"payment_type": null,
"provider": "transaction_manager",
"price_amount": "50.00",
"price_currency": "USD",
"pay_amount": "50.025000",
"pay_currency": "USDCERC20",
"blockchain_address": "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE",
"blockchain_network": "ETH",
"token": "USDC",
"transaction_hash": null,
"confirmations": 0,
"order_id": "ORDER-12346",
"order_description": "Monthly subscription",
"merchant_received_usd": null,
"payment_history": [],
"expiry_time": "2025-01-15T11:30:00Z",
"created_at": "2025-01-15T11:00:00Z",
"updated_at": "2025-01-15T11:00:00Z"
}
]
}

Response Fields

FieldTypeDescription
countintegerTotal number of payments
nextstringURL for next page (null if last page)
previousstringURL for previous page (null if first page)
resultsarrayArray of payment objects

Filtering Examples

Get payments from last 24 hours

curl -X GET "https://api.cryptofuse.io/payments/?created_after=2025-01-14T00:00:00Z" \
-H "Authorization: Bearer your_access_token"

Get high-value completed payments

curl -X GET "https://api.cryptofuse.io/payments/?status=completed&amount_min=1000&ordering=-amount" \
-H "Authorization: Bearer your_access_token"

Get payments for specific order

curl -X GET "https://api.cryptofuse.io/payments/?order_id=ORDER-12345" \
-H "Authorization: Bearer your_access_token"

Pagination

The API uses page-based pagination:

  • Use page parameter to navigate pages
  • Use page_size to control results per page (max 100)
  • Total count is provided in the count field
  • Use next and previous URLs for navigation

Pagination Example

import requests

def get_all_payments(access_token):
"""Fetch all payments using pagination."""
payments = []
url = "https://api.cryptofuse.io/payments/"

while url:
response = requests.get(url, headers={
"Authorization": f"Bearer {access_token}"
})
data = response.json()

payments.extend(data['results'])
url = data['next'] # Will be None on last page

print(f"Fetched {len(data['results'])} payments, total so far: {len(payments)}")

return payments

Error Responses

400 Bad Request

{
"error": {
"code": "invalid_request",
"message": "Invalid filter parameters",
"details": {
"created_after": ["Enter a valid date/time."]
}
}
}

Performance Tips

  • Use filters to reduce result set size
  • Cache results when appropriate (payments don't change after completion)
  • Use created_after for incremental syncing
  • Request only needed fields if your integration supports field filtering

Export Considerations

For bulk exports or reporting:

  • Use date range filters to export specific periods
  • Process in batches using pagination
  • Consider using webhooks for real-time updates instead of polling
  • Store transaction_id to avoid duplicate processing

Common Use Cases

Daily Reconciliation

async function dailyReconciliation(date) {
const startOfDay = new Date(date);
startOfDay.setHours(0, 0, 0, 0);

const endOfDay = new Date(date);
endOfDay.setHours(23, 59, 59, 999);

const response = await fetch(
`https://api.cryptofuse.io/payments/?` +
`created_after=${startOfDay.toISOString()}&` +
`created_before=${endOfDay.toISOString()}&` +
`status=completed&` +
`page_size=100`,
{
headers: {
'Authorization': `Bearer ${accessToken}`
}
}
);

const data = await response.json();

const totalUSD = data.results.reduce(
(sum, payment) => sum + parseFloat(payment.merchant_received_usd || 0),
0
);

console.log(`Total received on ${date}: $${totalUSD.toFixed(2)}`);
console.log(`Number of payments: ${data.count}`);

return data.results;
}

Monitor Pending Payments

def get_pending_payments():
"""Get all payments awaiting customer action."""

response = requests.get(
"https://api.cryptofuse.io/payments/",
params={
"status": "waiting",
"ordering": "created_at", # Oldest first
"page_size": 50
},
headers={"Authorization": f"Bearer {access_token}"}
)

if response.status_code == 200:
data = response.json()

for payment in data['results']:
expiry = datetime.fromisoformat(payment['expiry_time'].replace('Z', '+00:00'))
remaining = expiry - datetime.now(timezone.utc)

if remaining.total_seconds() > 0:
print(f"Payment {payment['order_id']} expires in {remaining}")
else:
print(f"Payment {payment['order_id']} has expired")

return response.json()

Next Steps