VoucherHub API Documentation

VoucherHub API

REST API documentation for VoucherHub. The API provides authentication, product management, transactions, and payment integration.

Base URL

https://www.be-voucherhub.andreka.dev/api

Authentication

POST /auth/login

Authenticate a user and receive an access token.

Request

{
  "email": "admin@example.com",
  "password": "password123"
}

Response

{
  "success": true,
  "message": "Login successful",
  "data": {
    "access_token": "eyJhbGciOi...",
    "token_type": "bearer"
  }
}
POST /auth/register

Create a new user account.

Categories

GET /category

Get all available categories.

GET /category/{id}

Get category details.

POST /category Admin

Create a new category.

Products

GET /products

Get all available voucher products.

GET /products/{id}

Get product details including variants.

Transactions

POST /transactions

Create a transaction. Guest checkout is supported.

Request

{
  "product_id": 1,
  "variant_id": 1,
  "quantity": 1,
  "buyer_email": "buyer@example.com",
  "buyer_phone": "081234567890",
  "customer_data": {
    "user_id": "12345678"
  }
}

Payments

POST /midtrans/notification

Endpoint used by Midtrans to send payment notifications.