Skip to content

Update Transaction

Update a transaction (issue refund).

Endpoint

INFO

PUT /api/v1/dashboard/transactions/{transaction}

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
AuthorizationBearer {token}Yes

Path Parameters

ParameterTypeDescription
transactionintegerTransaction ID

Request Body

ParameterTypeRequiredDescription
actionstringYesAction: refund
amountdecimalNoRefund amount (full if not specified)
reasonstringYesRefund 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"
}

Daakey Car Sharing Platform