Cryptofuse Webhook Flow Guide
This guide explains the complete webhook flow for payments and withdrawals, including all possible statuses and transitions.
Payment Webhook Flow
Payment Status Progression
graph TD
A[waiting] -->|Payment received| B[confirming]
A -->|Time expired| E[expired]
B -->|Confirmations complete| C[completed]
B -->|Partial & expired| D[partially_completed]
B -->|Payment failed| F[failed]
style C fill:#90EE90
style D fill:#FFE4B5
style E fill:#FFB6C1
style F fill:#FFB6C1
Webhook Events by Status
1. Payment Created (waiting)
When: After successful payment creation
Webhook: None (you already have the response)
2. Payment Received (confirming)
When: Customer sends cryptocurrency to the payment address
Webhook Event: payment_status_update
{
"transaction_id": "550e8400-e29b-41d4-a456-426614174000",
"event": "payment_status_update",
"status": "confirming",
"timestamp": "2024-12-27T10:05:00Z",
"data": {
"transaction_id": "550e8400-e89b-12d3-a456-426614174000",
"status": "confirming",
"amount_usd": "100.00",
"amount_crypto": "100.00000000",
"blockchain": "TRX",
"token": "USDT",
"currency": "USDTTRC20",
"address": "TXYZabc123...",
"transaction_hash": "0xabc123...",
"confirmations": 1,
"payment_history": [
{
"deposit_id": "dep_123",
"amount": "100.00000000",
"transaction_hash": "0xabc123...",
"confirmations": 1,
"timestamp": "2024-12-27T10:05:00Z"
}
],
"total_paid_amount": "100.00000000"
}
}
Key Fields:
confirmations: Current number of blockchain confirmationspayment_history: Array of all deposits (important for multiple payments)total_paid_amount: Sum of all deposits received
3. Payment Completed (completed)
When: Required confirmations reached and full amount received
Webhook Event: payment_status_update
{
"transaction_id": "550e8400-e89b-12d3-a456-426614174000",
"event": "payment_status_update",
"status": "completed",
"timestamp": "2024-12-27T10:10:00Z",
"data": {
"transaction_id": "550e8400-e89b-12d3-a456-426614174000",
"status": "completed",
"amount_usd": "100.00",
"amount_crypto": "100.00000000",
"payment_type": "full",
"final_usd_value": 99.50,
"transaction_hash": "0xabc123...",
"confirmations": 20,
"payment_history": [...],
"total_paid_amount": "100.00000000"
}
}
Additional Fields:
payment_type: "full", "partial", or "overpayment"final_usd_value: Actual USD value merchant receives after conversion
4. Partial Payment Completed (partially_completed)
When: Payment expires but received amount is above threshold
Webhook Event: payment_status_update
{
"status": "partially_completed",
"payment_type": "partial",
"total_paid_amount": "50.00000000",
"final_usd_value": 49.50,
"data": {
"metadata": {
"partial_conversion": {
"paid_percentage": 50,
"paid_amount": "50.00000000",
"converted_to": "USDT",
"reason": "Partial payment above threshold"
}
}
}
}
5. Overpayment (completed with overpayment)
When: Customer sends more than requested amount
Webhook Event: payment_status_update
{
"status": "completed",
"payment_type": "overpayment",
"amount_crypto": "100.00000000",
"total_paid_amount": "150.00000000",
"overpayment_amount": "50.00000000",
"overpayment_usd_value": "49.75",
"amount_limited": true,
"rejected_amount": "30.00000000",
"rejected_usd_value": "29.85"
}
Overpayment Fields:
overpayment_amount: Excess amount receivedamount_limited: true if system capped the accepted amountrejected_amount: Amount over the limit that was not credited
6. Payment Expired
When: Payment time limit reached without payment
Webhook Event: payment_status_update
{
"transaction_id": "550e8400-e89b-12d3-a456-426614174000",
"event": "payment_status_update",
"status": "expired",
"timestamp": "2024-12-27T10:30:00Z",
"data": {
"status": "expired",
"metadata": {
"expiry_details": {
"reason": "No payment received within time limit",
"expired_at": "2024-12-27T10:30:00Z",
"received_amount": "0"
}
}
}
}
Multiple Deposits Scenario
Some customers may send multiple transactions to pay:
{
"status": "completed",
"payment_history": [
{
"deposit_id": "dep_123",
"amount": "60.00000000",
"transaction_hash": "0xabc123...",
"confirmations": 20,
"timestamp": "2024-12-27T10:05:00Z"
},
{
"deposit_id": "dep_124",
"amount": "40.00000000",
"transaction_hash": "0xdef456...",
"confirmations": 15,
"timestamp": "2024-12-27T10:08:00Z"
}
],
"total_paid_amount": "100.00000000"
}
Withdrawal Webhook Flow
Withdrawal Status Progression
graph TD
A[pending] -->|Processing started| B[processing]
B -->|Blockchain broadcast| C[confirming]
C -->|Confirmations complete| D[completed]
A -->|Validation failed| E[failed]
B -->|Processing failed| E[failed]
style D fill:#90EE90
style E fill:#FFB6C1