The Merchant Dashboard is a web-based application that provides merchants with tools to manage their products, subscriptions, payments, and invoices. This API allows merchants to perform CRUD operations on their resources in a secure and efficient manner.
- Product Management: Create, update, retrieve, and delete products.
- Payment Processing: Transfer and receive payments.
- Invoice Management: Create, check status, update, and delete invoices.
- Subscription Management: Manage subscription plans.
- Go (version 1.16 or later)
- AWS SDK for Go
- DynamoDB set up in AWS
- Gin Gonic framework
-
Clone the Repository
git clone https://github.com/Utkarsh352/MerchantDashboard cd merchant-dashboard -
Install Dependencies
go mod tidy
-
Set Up AWS Credentials Make sure you have AWS credentials configured on your machine. You can set them up using the AWS CLI:
aws configure
-
Run the Application
go run main.go
-
Access the API The API will be available at
http://localhost:8080.
- Login
- POST
/auth/login - Request Body:
{ "username": "string", "password": "string" } - Response:
200 OK: Login successful400 Bad Request: Invalid credentials
- POST
-
Create Product
- POST
/products - Request Body:
{ "merchant_id": "string", "product_id": "string", "name": "string", "price": number, "quantity": number } - Response:
201 Created: Product created400 Bad Request: Invalid input
- POST
-
Get Products
- GET
/products - Query Parameter:
merchant_id - Response:
200 OK: List of products500 Internal Server Error: Could not retrieve products
- GET
-
Update Product
- PUT
/products/:merchantId/:productId - Request Body:
{ "name": "string", "price": number, "quantity": number } - Response:
200 OK: Product updated400 Bad Request: Invalid input
- PUT
-
Delete Product
- DELETE
/products/:merchantId/:productId - Response:
200 OK: Product deleted500 Internal Server Error: Could not delete product
- DELETE
-
Transfer Money
- POST
/payments/transfer - Request Body:
{ "amount": number, "bank_account": "string" } - Response:
200 OK: Money transferred successfully400 Bad Request: Invalid input
- POST
-
Receive Money
- POST
/payments/receive - Response:
200 OK: Money received successfully400 Bad Request: Invalid input
- POST
-
Create Invoice
- POST
/invoices - Request Body:
{ "invoice_id": "string", "merchant_id": "string", "amount": number, "status": "string" } - Response:
201 Created: Invoice created400 Bad Request: Invalid input
- POST
-
Check Invoice Status
- GET
/invoices/:invoiceId - Response:
200 OK: Invoice details404 Not Found: Invoice not found
- GET
-
Update Invoice
- PUT
/invoices/:invoiceId - Request Body:
{ "amount": number, "status": "string" } - Response:
200 OK: Invoice updated400 Bad Request: Invalid input
- PUT
-
Delete Invoice
- DELETE
/invoices/:invoiceId - Response:
200 OK: Invoice deleted500 Internal Server Error: Could not delete invoice
- DELETE
-
Create Subscription
- POST
/subscriptions - Request Body:
{ "plan_id": "string", "customer_id": "string", "price": number } - Response:
201 Created: Subscription created400 Bad Request: Invalid input
- POST
-
Get Subscription
- GET
/subscriptions/:planId - Response:
200 OK: Subscription details404 Not Found: Subscription not found
- GET
-
Update Subscription
- PUT
/subscriptions/:planId - Request Body:
{ "price": number } - Response:
200 OK: Subscription updated400 Bad Request: Invalid input
- PUT
-
Delete Subscription
- DELETE
/subscriptions/:planId - Response:
200 OK: Subscription cancelled500 Internal Server Error: Could not delete subscription
- DELETE
All API responses include relevant HTTP status codes and error messages to help users identify and resolve issues.
This documentation provides a comprehensive overview of the Merchant Dashboard API. For further assistance or feature requests, please contact me on [Linkedin]