Skip to main content
POST
/
transactions
Create transaction
curl --request POST \
  --url http://localhost:3002/api/v1/transactions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "items": [
    {
      "product_id": "<string>",
      "quantity": 123,
      "price": 123
    }
  ],
  "payment_method": "cash",
  "customer_id": "<string>"
}
'
{
  "id": "trx_123",
  "transaction_code": "TRX-20240101-001",
  "total_amount": 250000,
  "status": "completed",
  "payment_method": "cash",
  "created_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

JWT Bearer token authentication

Body

application/json
items
object[]
required
payment_method
string
required
Example:

"cash"

customer_id
string

Response

201 - application/json

Transaction created

id
string
Example:

"trx_123"

transaction_code
string
Example:

"TRX-20240101-001"

total_amount
number<double>
Example:

250000

status
enum<string>
Available options:
pending,
completed,
cancelled
Example:

"completed"

payment_method
string
Example:

"cash"

created_at
string<date-time>