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 offsetstatus- Filter by statusfrom_date- Start dateto_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
- Dashboard → Settings → Webhooks
- Add endpoint URL
- Select events to receive
- Save
Event Types
payment.created- New payment initiatedpayment.pending- Awaiting confirmationpayment.completed- Payment confirmedpayment.failed- Payment failedrefund.processed- Refund completed
Webhook Payload
{
"event": "payment.completed",
"data": {
"id": "pay_1234567890",
"amount": 50.00,
"status": "completed"
},
"created_at": "2024-01-01T11:05:00Z"
}