Skip to main content

Transactions API

Process and manage cryptocurrency transactions programmatically.

Create Payment

Initiate a new payment request.

Endpoint

POST /v1/payments

Request

{
"amount": 50.00,
"currency": "USD",
"cryptocurrency": "BTC",
"description": "Order #12345",
"customer": {
"email": "customer@example.com",
"name": "John Doe"
},
"metadata": {
"order_id": "12345"
}
}

Response

{
"id": "pay_1234567890",
"amount": 50.00,
"currency": "USD",
"cryptocurrency": "BTC",
"crypto_amount": "0.00123456",
"status": "pending",
"payment_url": "https://pay.safebank.io/pay_1234567890",
"qr_code": "data:image/png;base64,...",
"expires_at": "2024-01-01T12:00:00Z"
}

Retrieve Payment

Get details of a specific payment.

Endpoint

GET /v1/payments/:id

Response

{
"id": "pay_1234567890",
"amount": 50.00,
"status": "completed",
"transaction_hash": "0x...",
"confirmations": 12,
"created_at": "2024-01-01T11:00:00Z",
"completed_at": "2024-01-01T11:05:00Z"
}

List Transactions

Retrieve a list of all transactions.

Endpoint

GET /v1/transactions

Query Parameters

  • limit - Number of results (default: 100)
  • offset - Pagination offset
  • status - Filter by status
  • from_date - Start date
  • to_date - End date

Response

{
"data": [
{
"id": "txn_1234567890",
"type": "payment",
"amount": 50.00,
"status": "completed",
"created_at": "2024-01-01T11:00:00Z"
}
],
"total": 150,
"has_more": true
}

Webhooks

Receive real-time notifications for transaction events.

Setup

  1. Dashboard → Settings → Webhooks
  2. Add endpoint URL
  3. Select events to receive
  4. Save

Event Types

  • payment.created - New payment initiated
  • payment.pending - Awaiting confirmation
  • payment.completed - Payment confirmed
  • payment.failed - Payment failed
  • refund.processed - Refund completed

Webhook Payload

{
"event": "payment.completed",
"data": {
"id": "pay_1234567890",
"amount": 50.00,
"status": "completed"
},
"created_at": "2024-01-01T11:05:00Z"
}

Next: Wallet Operations →