Skip to main content
DELETE
/
v1
/
transactions
/
{transactionId}
curl -X DELETE "https://api.unipay.com/v1/transactions/tx_abcdef1234567890" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "transactionId": "tx_abcdef1234567890",
  "status": "cancelled",
  "cancelledAt": "2026-04-22T12:35:00Z"
}
Cancel a pending transaction that hasn’t been processed yet. Only works for transactions in pending status.

Path Parameters

transactionId
string
required
The unique transaction identifier returned from transaction creation

Response

transactionId
string
The cancelled transaction identifier
status
string
New status: cancelled
cancelledAt
string
Cancellation timestamp (ISO 8601)
curl -X DELETE "https://api.unipay.com/v1/transactions/tx_abcdef1234567890" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "transactionId": "tx_abcdef1234567890",
  "status": "cancelled",
  "cancelledAt": "2026-04-22T12:35:00Z"
}

Cancellation Rules

When You Can Cancel

StatusCan CancelReason
pending✅ YesTransaction not yet processed
processing❌ NoAlready being processed
completed❌ NoTransaction confirmed on-chain
failed❌ NoTransaction already failed

Mode-Specific Behavior

Wallet Mode:
  • Can cancel before transaction is broadcast to network
  • Once broadcast, cancellation is not possible
  • Network fees may still apply if partially processed
Private Mode:
  • Can cancel before funds are sent to ephemeral address
  • Cannot cancel after deposit is detected
  • Routing fees are not charged for cancelled transactions

Refund Policy

Automatic Refunds

Cancelled transactions receive automatic refunds:
  • Wallet Mode: No funds were deducted (transaction never broadcast)
  • Private Mode: No deposit made, no refund needed

Partial Processing

If cancellation occurs during processing:
  • Network fees may be non-refundable
  • Routing fees are refunded for private mode
  • Original assets remain in sender wallet

Error Responses

error.code
string
Error code identifier
error.message
string
Human-readable error message
error.details
object
Additional error context

Common Errors

CodeDescription
TRANSACTION_NOT_FOUNDTransaction ID doesn’t exist
CANNOT_CANCELTransaction status doesn’t allow cancellation
ALREADY_PROCESSEDTransaction has been processed
UNAUTHORIZEDNot authorized to cancel this transaction
{
  "error": {
    "code": "CANNOT_CANCEL",
    "message": "Transaction is already being processed and cannot be cancelled",
    "details": {
      "transactionId": "tx_abcdef1234567890",
      "currentStatus": "processing",
      "allowedStatuses": ["pending"]
    }
  }
}

Best Practices

When to Cancel

  • Quote Expiration: Cancel if quote expires before signing
  • Price Changes: Cancel if market conditions change significantly
  • User Error: Cancel if wrong recipient or amount entered
  • Network Issues: Cancel if experiencing connectivity problems

Monitoring Cancellations

// Check if cancellation is possible
const transaction = await getTransactionStatus(transactionId);

if (transaction.status === 'pending') {
  // Safe to cancel
  await cancelTransaction(transactionId);
} else {
  console.log('Cannot cancel - status:', transaction.status);
}

Alternative Actions

If cancellation isn’t possible:
  • Monitor Status: Track transaction to completion
  • Contact Support: For urgent issues, contact support
  • Future Prevention: Use shorter quote expiration times

Rate Limits

Cancellation requests are subject to the same rate limits as other API endpoints:
TierCancellations/Minute
Free10
Pro50
Enterprise200

Next Steps

Get Transaction Status

Check the current status of your transactions

Webhook Notifications

Get real-time updates on transaction status changes