Update Transaction
Update a transaction (issue refund).
Endpoint
INFO
PUT /api/v1/dashboard/transactions/{transaction}
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
Authorization | Bearer {token} | Yes |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
transaction | integer | Transaction ID |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Action: refund |
amount | decimal | No | Refund amount (full if not specified) |
reason | string | Yes | Refund reason |
Example Request
bash
curl -X PUT https://api.daakey.com/api/v1/dashboard/transactions/100 \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"action": "refund",
"amount": 50.00,
"reason": "Partial refund for service issue"
}'Response
Success (200)
json
{
"success": true,
"message": "Refund processed",
"data": {
"original_transaction": {
"id": 100,
"amount": 132.00
},
"refund": {
"id": 101,
"type": "refund",
"amount": 50.00,
"reason": "Partial refund for service issue",
"status": "completed",
"stripe_refund_id": "re_xxxxx",
"created_at": "2024-01-15T14:00:00Z"
},
"remaining": 82.00
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Error (400)
json
{
"success": false,
"message": "Cannot process refund",
"data": {
"reason": "Refund amount exceeds original transaction"
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}