curl --request GET \
--url https://api.example.com/api/v1/payments/contract/{contract_id}{
"contract_id": "<string>",
"payments": [
{
"payment_id": 123,
"transaction_id": {},
"status": "<string>",
"amount": 123,
"currency": "<string>",
"created_at": "<string>"
}
]
}Get all payments associated with a specific contract
curl --request GET \
--url https://api.example.com/api/v1/payments/contract/{contract_id}{
"contract_id": "<string>",
"payments": [
{
"payment_id": 123,
"transaction_id": {},
"status": "<string>",
"amount": 123,
"currency": "<string>",
"created_at": "<string>"
}
]
}Show Payment Object
PENDING - Payment initiated, awaiting confirmationLOCKED - Payment completed and locked in escrowRELEASED - Payment released to recipientREFUNDED - Payment refunded to payerFAILED - Payment failedcurl -X GET https://api.voicepact.com/api/v1/payments/contract/contract_123456 \
-H "Content-Type: application/json"
{
"contract_id": "contract_123456",
"payments": [
{
"payment_id": 45,
"transaction_id": "ATXid_xyz789",
"status": "LOCKED",
"amount": 2500.0,
"currency": "KES",
"created_at": "2026-03-06T14:20:00.000000"
},
{
"payment_id": 42,
"transaction_id": "ATXid_sample123456789",
"status": "RELEASED",
"amount": 5000.0,
"currency": "KES",
"created_at": "2026-03-06T10:30:00.000000"
},
{
"payment_id": 38,
"transaction_id": "ATXid_abc123",
"status": "FAILED",
"amount": 5000.0,
"currency": "KES",
"created_at": "2026-03-06T09:15:00.000000"
}
]
}
{
"contract_id": "contract_789012",
"payments": []
}
{
"detail": "Failed to retrieve contract payments"
}
const getPaymentHistory = async (contractId) => {
const response = await fetch(
`https://api.voicepact.com/api/v1/payments/contract/${contractId}`
);
const data = await response.json();
console.log(`Total payments for contract: ${data.payments.length}`);
data.payments.forEach(payment => {
console.log(`Payment ${payment.payment_id}: ${payment.status} - ${payment.amount} ${payment.currency}`);
});
};
import httpx
from typing import Decimal
async def calculate_total_paid(contract_id: str) -> Decimal:
async with httpx.AsyncClient() as client:
response = await client.get(
f"https://api.voicepact.com/api/v1/payments/contract/{contract_id}"
)
data = response.json()
# Sum all locked or released payments
total = sum(
payment["amount"]
for payment in data["payments"]
if payment["status"] in ["LOCKED", "RELEASED"]
)
return Decimal(str(total))
async def has_pending_payment(contract_id: str) -> bool:
async with httpx.AsyncClient() as client:
response = await client.get(
f"https://api.voicepact.com/api/v1/payments/contract/{contract_id}"
)
data = response.json()
return any(
payment["status"] == "PENDING"
for payment in data["payments"]
)