This is the official documentation of the shwid marketplace api
This documentation aims to provide all the information you need to work with our API.
This API is not authenticated.
This endpoint validates the OTP code sent to the user's email and marks their account as verified.
const url = new URL(
"http://127.0.0.1:8000/api/v1/verify-new-account"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"otp": "123456",
"user_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"message": "You have successfully verified your account, welcome!",
"data": {
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"email_verified_at": "2023-09-20T12:00:00.000000Z"
},
"success": true
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/password-email"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "user@example.com"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Password reset link sent successfully",
"data": {
"email": "user@example.com"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/password-otp"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "user@example.com"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "OTP sent successfully",
"data": {
"email": "user@example.com",
"expires_in": "5 minutes"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/password-reset"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "user@example.com",
"password": "newPassword123",
"password_confirmation": "newPassword123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Password has been reset successfully",
"data": {
"email": "user@example.com"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/logout"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json()); {
"message": "Logged out successfully",
"success": true
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/get-profile"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"data": {
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
},
"message": "Authenticated users details fetched successfully",
"success": true
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "user@example.com",
"password": "password123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Login successful",
"data": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"user": {
"id": 1,
"name": "John Doe",
"email": "user@example.com",
"created_at": "2023-01-01T00:00:00.000000Z"
}
}
}
Handles the authentication process for users signing in with Google credentials. Creates a new user account if the email doesn't exist, or updates existing Google ID.
const url = new URL(
"http://127.0.0.1:8000/api/v1/login-with-google"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"id": "\"114252345678912345678\"",
"email": "\"user@example.com\"",
"name": "\"John Doe\"",
"familyName": "\"Doe\"",
"givenName": "\"John\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"token": "2|4HxYP8zrBnH9LQlkrGHk3aYZqXtWVcVyqRQGzLbB",
"user": {
"id": 1,
"email": "user@example.com",
"name": "John Doe",
"role": "CUSTOMER"
},
"token_type": "bearer"
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/banners"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"title": "\"Summer Sale\"",
"slug": "\"summer-sale-2023\"",
"description": "\"Special summer promotion banner\"",
"image": "\"banner.jpg\"",
"type": "\"home\"",
"status": "\"active\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); const url = new URL(
"http://127.0.0.1:8000/api/v1/banners"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); The type of banners to fetch.
const url = new URL(
"http://127.0.0.1:8000/api/v1/banners/filter/home"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); The slug of the banner.
const url = new URL(
"http://127.0.0.1:8000/api/v1/banners/aut"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); The slug of the banner.
const url = new URL(
"http://127.0.0.1:8000/api/v1/banners/tempora"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"title": "\"Updated Summer Sale\"",
"slug": "\"updated-summer-sale-2023\"",
"description": "\"Updated special summer promotion banner\"",
"image": "\"updated-banner.jpg\"",
"type": "\"home\"",
"status": "\"active\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); The slug of the banner.
const url = new URL(
"http://127.0.0.1:8000/api/v1/banners/minima"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); Creates a new category with the provided details
const url = new URL(
"http://127.0.0.1:8000/api/v1/categories"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Category created successfully",
"data": {
"id": 1,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
}
Lists all available categories in the system
const url = new URL(
"http://127.0.0.1:8000/api/v1/categories"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Categories retrieved successfully",
"data": [
{
"id": 1,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
]
}
The unique slug of the category.
const url = new URL(
"http://127.0.0.1:8000/api/v1/categories/electronics"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Category retrieved successfully",
"data": {
"id": 1,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and accessories",
"image": "categories/electronics.jpg",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/categories/filter/search"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "electronics",
"per_page": 10,
"page": 1,
"status": true
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Categories retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic devices and gadgets",
"image": "categories/electronics.jpg",
"status": true,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
],
"first_page_url": "http://example.com/api/categories/search?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://example.com/api/categories/search?page=1",
"per_page": 10,
"to": 1,
"total": 1
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/categories/filter/brand"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"brand_id": 1,
"status": true
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Categories retrieved successfully",
"data": [
{
"id": 1,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic products category",
"image": "categories/electronics.jpg",
"status": true,
"brand_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
]
}
The unique slug of the category to update.
const url = new URL(
"http://127.0.0.1:8000/api/v1/categories/electronics"
);
const headers = {
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('name', 'Electronics & Gadgets');
body.append('description', 'All electronic devices and accessories');
body.append('status', '1');
body.append('image', document.querySelector('input[name="image"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json()); {
"status": true,
"message": "Category updated successfully",
"data": {
"id": 1,
"name": "Electronics & Gadgets",
"slug": "electronics-gadgets",
"description": "All electronic devices and accessories",
"image": "categories/electronics-updated.jpg",
"status": true,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T12:00:00.000000Z"
}
}
The slug of the category.
const url = new URL(
"http://127.0.0.1:8000/api/v1/categories/ut"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Category deleted successfully",
"data": {
"id": 1,
"name": "Electronics",
"slug": "electronics",
"description": "Electronic products category",
"image": "categories/electronics.jpg",
"status": true,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/brands"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "\"Nike\"",
"slug": "\"nike\"",
"description": "\"Sports apparel and equipment manufacturer\"",
"image": "\"brands\/nike-image.png\"",
"status": true
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Brand created successfully",
"data": {
"id": 1,
"name": "Nike",
"slug": "nike",
"description": "Sports apparel and equipment manufacturer",
"image": "brands/nike-image.png",
"status": true,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
Lists all available brands in the system with their details
const url = new URL(
"http://127.0.0.1:8000/api/v1/brands"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Brands retrieved successfully",
"data": [
{
"id": 1,
"name": "Brand Name",
"slug": "brand-name",
"description": "Brand description",
"image": "path/to/image.jpg",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
]
}
Retrieves detailed information for a specific brand using its slug
The slug of the brand.
const url = new URL(
"http://127.0.0.1:8000/api/v1/brands/ut"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Brand retrieved successfully",
"data": {
"id": 1,
"name": "Brand Name",
"slug": "brand-name",
"description": "Brand description",
"image": "path/to/image.jpg",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/brands/filter/search"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "nike",
"status": true,
"category_id": 1,
"per_page": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Brands retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Nike",
"slug": "nike",
"description": "Sports brand",
"image": "path/to/image.jpg",
"status": true,
"category_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
],
"first_page_url": "http://example.com/api/brands/search?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://example.com/api/brands/search?page=1",
"links": [],
"next_page_url": null,
"path": "http://example.com/api/brands/search",
"per_page": 10,
"prev_page_url": null,
"to": 1,
"total": 1
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/brands/filter/category"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"category_id": 1,
"per_page": 10,
"page": 1
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Brands retrieved successfully",
"data": [
{
"id": 1,
"name": "Brand Name",
"slug": "brand-name",
"description": "Brand description",
"image": "path/to/image.jpg",
"status": true,
"category_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
],
"pagination": {
"total": 10,
"per_page": 10,
"current_page": 1,
"last_page": 1
}
}
The slug of the brand to delete
const url = new URL(
"http://127.0.0.1:8000/api/v1/brands/sample-brand"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Brand deleted successfully"
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"password": "password123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Customer account created successfully",
"data": {
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"zip_code": "10001",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"data": [
{
"id": 1,
"email": "customer@example.com",
"role": "customer",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
],
"message": "All users fetched successfully",
"success": true,
"links": {
"first": "http://example.com/api/customers?page=1",
"last": "http://example.com/api/customers?page=5",
"prev": null,
"next": "http://example.com/api/customers?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 5,
"path": "http://example.com/api/customers",
"per_page": 20,
"to": 20,
"total": 100
}
}
Get detailed information about a specific customer
The unique slug identifier of the customer.
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers/14"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"data": {
"id": 1,
"slug": "customer-123",
"email": "customer@example.com",
"name": "John Doe",
"role": "customer",
"status": "active",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
},
"message": "Customer details fetched successfully",
"success": true
}
Retrieves a list of customers who have made significant purchases or have high-value deals
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers/filter/top-deals"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"product_count": 5,
"count": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"total_deals_amount": 50000,
"deals_count": 5,
"latest_deal_date": "2023-12-01T10:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"total": 10,
"per_page": 10
},
"message": "Top customers retrieved successfully",
"success": true
}
Retrieves a filtered list of customers based on their account status
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers/filter/status"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "ACTIVE"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"status": "active",
"created_at": "2023-12-01T10:00:00.000000Z",
"updated_at": "2023-12-01T10:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"total": 10,
"per_page": 10
},
"message": "Customers retrieved successfully",
"success": true
}
Search for customers based on provided criteria
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers/filter/search"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "john",
"status": "active",
"sort": "name",
"order": "asc",
"per_page": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"status": "active",
"created_at": "2023-12-01T10:00:00.000000Z",
"updated_at": "2023-12-01T10:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"total": 10,
"per_page": 10
},
"message": "Customers retrieved successfully",
"success": true
}
Get a list of customers who have made purchases from the authenticated seller
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers/filter/my-customers"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"page": 1,
"per_page": 10,
"search": "john",
"date_from": "2023-01-01",
"date_to": "2023-12-31"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"total_purchases": 1500,
"last_purchase_date": "2023-12-01T10:00:00.000000Z",
"created_at": "2023-12-01T10:00:00.000000Z",
"updated_at": "2023-12-01T10:00:00.000000Z"
}
],
"meta": {
"current_page": 1,
"total": 10,
"per_page": 10
},
"message": "Customers retrieved successfully",
"success": true
}
Change customer account password
const url = new URL(
"http://127.0.0.1:8000/api/v1/change-password"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"current_password": "oldPassword123",
"new_password": "newPassword123",
"new_password_confirmation": "newPassword123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"message": "Password changed successfully",
"success": true
}
Updates the authenticated customer's profile information
const url = new URL(
"http://127.0.0.1:8000/api/v1/update-customers"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"zip_code": "10001"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"message": "Profile updated successfully",
"data": {
"id": 1,
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"zip_code": "10001",
"updated_at": "2023-12-20T12:00:00.000000Z"
},
"success": true
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/toggle-chat-status"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": true
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"message": "Chat status updated successfully",
"data": {
"chat_status": true,
"updated_at": "2023-12-20T12:00:00.000000Z"
},
"success": true
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/delete-account"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json()); {
"message": "Account deleted successfully",
"success": true
}
Update customer account status with reason
The ID of the user.
const url = new URL(
"http://127.0.0.1:8000/api/v1/customers/update-customers-status/et"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "active",
"reason": "Account verified"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"message": "Account status updated successfully",
"success": true,
"data": {
"user_id": 1,
"status": "active",
"updated_at": "2023-12-20T10:00:00Z"
}
}
Adds or updates a billing address for the authenticated customer
const url = new URL(
"http://127.0.0.1:8000/api/v1/add-customers-address"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"address_line_1": "123 Main Street",
"address_line_2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "United States"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"message": "Billing address added successfully",
"data": {
"address_line_1": "123 Main Street",
"address_line_2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "United States"
},
"success": true
}
Store a new feedback entry in the database
const url = new URL(
"http://127.0.0.1:8000/api/v1/feedbacks"
);
const headers = {
"Content-Type": "multipart/form-data",
"Accept": "application/json",
};
const body = new FormData();
body.append('type', '"bug"');
body.append('title', '"App crashes on startup"');
body.append('description', '"When opening the app, it crashes immediately after splash screen"');
body.append('user_id', '1');
body.append('status', '"pending"');
body.append('attachments[]', document.querySelector('input[name="attachments[]"]').files[0]);
fetch(url, {
method: "POST",
headers,
body,
}).then(response => response.json()); {
"status": true,
"message": "Feedback created successfully",
"data": {
"id": 1,
"type": "bug",
"title": "App crashes on startup",
"description": "When opening the app, it crashes immediately after splash screen",
"user_id": 1,
"status": "pending",
"created_at": "2023-12-20T10:00:00.000000Z",
"updated_at": "2023-12-20T10:00:00.000000Z"
}
}
The page number for pagination.
The number of items per page.
Search term to filter feedbacks.
Field to sort by (created_at, title, type).
Sort order (asc, desc).
const url = new URL(
"http://127.0.0.1:8000/api/v1/feedbacks"
);
const params = {
"page": "1",
"per_page": "10",
"search": ""bug"",
"sort": ""created_at"",
"order": ""desc"",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Feedbacks retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"type": "bug",
"title": "App crashes on startup",
"description": "When opening the app, it crashes immediately after splash screen",
"user_id": 1,
"status": "pending",
"created_at": "2023-12-20T10:00:00.000000Z",
"updated_at": "2023-12-20T10:00:00.000000Z"
}
],
"total": 50,
"per_page": 10,
"last_page": 5
}
}
The page number for pagination.
The number of items per page.
The type of feedback to filter by.
Field to sort by (created_at, title).
Sort order (asc, desc).
const url = new URL(
"http://127.0.0.1:8000/api/v1/feedbacks/filter/type"
);
const params = {
"page": "1",
"per_page": "10",
"type": ""bug"",
"sort": ""created_at"",
"order": ""desc"",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Feedbacks retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"type": "bug",
"title": "App crashes on startup",
"description": "When opening the app, it crashes immediately",
"user_id": 1,
"status": "pending",
"created_at": "2023-12-20T10:00:00.000000Z",
"updated_at": "2023-12-20T10:00:00.000000Z"
}
],
"total": 20,
"per_page": 10,
"last_page": 2
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/states"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "States retrieved successfully",
"data": {
"states": [
{
"id": 1,
"name": "Lagos"
},
{
"id": 2,
"name": "Abuja"
}
]
}
}
The ID of the state to fetch LGAs for.
const url = new URL(
"http://127.0.0.1:8000/api/v1/lgas/1"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "LGAs retrieved successfully",
"data": {
"lgas": [
{
"id": 1,
"name": "Alimosho",
"state_id": 1
},
{
"id": 2,
"name": "Ikeja",
"state_id": 1
}
]
}
}
This endpoint retrieves a paginated list of orders with their associated relationships including shipping address, customer details, and product information.
Page number for pagination.
Number of items per page.
Sort orders by field (created_at, order_no).
Sort direction (asc, desc).
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders"
);
const params = {
"page": "1",
"per_page": "10",
"sort": "created_at",
"order": "desc",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "Orders retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"order_no": "ORD-20220101-1",
"status": "completed",
"created_at": "2022-01-01T00:00:00.000000Z",
"updated_at": "2022-01-01T00:00:00.000000Z",
"relationships": {
"shipping_address": {
"id": 1,
"address": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
},
"customer": {
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com"
},
"product": {
"id": 1,
"name": "Product 1",
"price": 10
}
}
}
],
"total": 10,
"per_page": 10
}
}
This endpoint allows users to create a new order by specifying the product and quantity.
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"product": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"message": "Order created successfully",
"success": true,
"data": {
"id": 1,
"order_no": "ORD-20220101-1",
"status": "pending",
"relationships": {
"shipping_address": {
"id": 1,
"address": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345",
"country": "USA",
"created_at": "2022-01-01T00:00:00.000000Z",
"updated_at": "2022-01-01T00:00:00.000000Z",
"deleted_at": null
},
"customer": {
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com",
"phone": "555-555-5555",
"created_at": "2022-01-01T00:00:00.000000Z",
"updated_at": "2022-01-01T00:00:00.000000Z",
"deleted_at": null
},
"product": {
"id": 1,
"name": "Product 1",
"description": "This is product 1",
"price": 10,
"created_at": "2022-01-01T00:00:00.000000Z",
"updated_at": "2022-01-01T00:00:00.000000Z",
"deleted_at": null
}
},
"created_at": "2022-01-01T00:00:00.000000Z",
"updated_at": "2022-01-01T00:00:00.000000Z",
"deleted_at": null
}
}
Retrieves detailed information for a specific order by its ID, including relationships like shipping address, customer details, and product information.
The ID of the order.
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/1"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"success": true,
"message": "Order retrieved successfully",
"data": {
"id": 1,
"order_no": "ORD-20220101-1",
"status": "pending",
"relationships": {
"shipping_address": {
"id": 1,
"address": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345",
"country": "USA"
},
"customer": {
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com",
"phone": "555-555-5555"
},
"product": {
"id": 1,
"name": "Product 1",
"description": "This is product 1",
"price": 10
}
},
"created_at": "2022-01-01T00:00:00.000000Z",
"updated_at": "2022-01-01T00:00:00.000000Z"
}
}
The ID of the order.
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/commodi"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "completed",
"quantity": "100",
"price": "50.00"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Order updated successfully",
"data": {
"id": 1,
"status": "completed",
"quantity": 100,
"price": 50,
"total": 5000,
"created_at": "2023-01-01T12:00:00.000000Z",
"updated_at": "2023-01-01T12:00:00.000000Z"
}
}
The ID of the order.
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/deleniti"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"success": true,
"message": "Order deleted successfully",
"data": null
}
The ID of the cancel order.
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/cancel-order/tempore"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"success": true,
"message": "Order cancelled successfully",
"data": {
"id": 1,
"status": "cancelled",
"cancelled_at": "2023-01-01T12:00:00.000000Z",
"updated_at": "2023-01-01T12:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/filter/date"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"start_date": "2023-01-01",
"end_date": "2023-12-31"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Orders filtered successfully",
"data": [
{
"id": 1,
"order_no": "ORD-20230101-1",
"status": "completed",
"created_at": "2023-01-01T10:00:00.000000Z",
"updated_at": "2023-01-01T10:00:00.000000Z"
}
],
"meta": {
"total": 1,
"per_page": 15,
"current_page": 1,
"last_page": 1
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/filter/status"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "pending"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Orders filtered successfully",
"data": [
{
"id": 1,
"order_no": "ORD-20230101-1",
"status": "pending",
"customer_name": "John Doe",
"total_amount": 150,
"created_at": "2023-01-01T10:00:00.000000Z",
"updated_at": "2023-01-01T10:00:00.000000Z"
}
],
"meta": {
"total": 1,
"per_page": 15,
"current_page": 1,
"last_page": 1
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/filter/customer"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"customer_id": 1,
"status": "pending",
"from_date": "2023-01-01",
"to_date": "2023-12-31",
"sort": "created_at",
"order": "desc"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Orders retrieved successfully",
"data": {
"orders": [
{
"id": 1,
"customer_id": 1,
"order_number": "ORD-2023-001",
"status": "pending",
"total_amount": 150,
"created_at": "2023-01-01T12:00:00.000000Z",
"updated_at": "2023-01-01T12:00:00.000000Z"
}
],
"total": 1,
"page": 1,
"per_page": 10
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/filter/type"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"type": "buy",
"start_date": "2023-01-01",
"end_date": "2023-12-31",
"per_page": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Trade history retrieved successfully",
"data": {
"trades": [
{
"id": 1,
"type": "buy",
"amount": 100,
"price": 50,
"total": 5000,
"created_at": "2023-01-01T12:00:00.000000Z",
"updated_at": "2023-01-01T12:00:00.000000Z"
}
],
"total": 1,
"page": 1,
"per_page": 10
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/couriers/fetch"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_id": 1,
"radius": 5,
"max_couriers": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Available couriers retrieved successfully",
"data": [
{
"id": 1,
"name": "John Smith",
"phone": "+1234567890",
"current_location": {
"latitude": 40.7128,
"longitude": -74.006
},
"distance": 2.5,
"rating": 4.8,
"available": true
}
],
"meta": {
"total_couriers": 1,
"search_radius": 5
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/couriers/alert"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_id": 1,
"radius": 5
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Couriers alerted successfully",
"data": {
"notified_couriers": 5,
"order_id": 1,
"notification_timestamp": "2023-01-01T10:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/couriers/request"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_id": 1,
"pickup_address": "123 Main St",
"delivery_address": "456 Oak Ave",
"notes": "Handle with care"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Shipment request created successfully",
"data": {
"shipment_id": 1,
"order_id": 1,
"status": "pending",
"pickup_address": "123 Main St",
"delivery_address": "456 Oak Ave",
"created_at": "2023-01-01T10:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/orders/couriers/accept"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"applicant_id": 1,
"order_id": 100,
"notes": "Verified credentials"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"success": true,
"message": "Shipment applicant accepted successfully",
"data": {
"order_id": 100,
"applicant_id": 1,
"status": "accepted",
"updated_at": "2023-01-01T12:00:00.000000Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/products"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "\"iPhone 13\"",
"description": "\"Latest iPhone model\"",
"price": "999.99",
"category_id": 1,
"images": [
"image1.jpg",
"image2.jpg"
],
"status": "\"active\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Product created successfully",
"data": {
"id": 1,
"name": "iPhone 13",
"slug": "iphone-13",
"description": "Latest iPhone model",
"price": 999.99,
"category_id": 1,
"status": "active",
"images": [
"image1.jpg",
"image2.jpg"
],
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-01-15T00:00:00Z"
}
}
Returns a paginated list of all available products in the system
Page number for pagination.
Number of items per page.
Sort field (e.g. 'created_at', 'price').
Sort order ('asc' or 'desc').
const url = new URL(
"http://127.0.0.1:8000/api/v1/products"
);
const params = {
"page": "1",
"per_page": "10",
"sort": "created_at",
"order": "desc",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Product Name",
"description": "Product Description",
"price": 99.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"first_page_url": "http://example.com/api/products?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://example.com/api/products?page=1",
"links": [],
"next_page_url": null,
"path": "http://example.com/api/products",
"per_page": 10,
"prev_page_url": null,
"to": 1,
"total": 1
}
}
Get similar products based on the provided product slug
The slug of the product to find similar items for.
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/similar/blue-t-shirt"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "Similar products retrieved successfully",
"data": [
{
"id": 1,
"name": "Similar Product 1",
"slug": "similar-product-1",
"description": "Product Description",
"price": 99.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
]
}
Retrieves a paginated list of the most recently added products. Products can be filtered and sorted based on request parameters.
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/filter/latest"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"page": 1,
"per_page": 10,
"sort_by": "created_at",
"sort_direction": "desc"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Latest products retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Product Name",
"slug": "product-name",
"description": "Product description",
"price": 99.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"first_page_url": "http://example.com/api/products/latest?page=1",
"from": 1,
"last_page": 5,
"last_page_url": "http://example.com/api/products/latest?page=5",
"next_page_url": "http://example.com/api/products/latest?page=2",
"path": "http://example.com/api/products/latest",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 50
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/filter/category"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"category_id": 1,
"per_page": 10,
"page": 1
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Latest products retrieved successfully",
"data": [
{
"id": 1,
"name": "Product Name",
"category_id": 1,
"description": "Product description",
"price": 99.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 10,
"per_page": 10
}
}
Retrieves a paginated list of products associated with a specific customer based on the provided request parameters.
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/filter/seller"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"customer_id": 1,
"per_page": 10,
"page": 1
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"name": "Product Name",
"customer_id": 1,
"category_id": 1,
"description": "Product description",
"price": 99.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 10,
"per_page": 10
}
}
Get all products belonging to the authenticated user
Page number for pagination.
Number of items per page.
const url = new URL(
"http://127.0.0.1:8000/api/v1/my-products"
);
const params = {
"page": "1",
"per_page": "10",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "My products retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"name": "Product Name",
"description": "Product Description",
"price": 99.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"first_page_url": "http://example.com/api/my-products?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://example.com/api/my-products?page=1",
"links": [],
"next_page_url": null,
"path": "http://example.com/api/my-products",
"per_page": 10,
"prev_page_url": null,
"to": 1,
"total": 1
}
}
The status.
const url = new URL(
"http://127.0.0.1:8000/api/v1/my-products/filter/status/aut"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"name": "Product Name",
"description": "Product Description",
"status": "active",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"meta": {
"total": 1
}
}
Search for user's products using simple search criteria
const url = new URL(
"http://127.0.0.1:8000/api/v1/my-products/filter/search"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "\"phone\"",
"sort": "\"desc\"",
"per_page": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": {
"products": [
{
"id": 1,
"name": "iPhone 12",
"description": "Latest smartphone",
"price": 999.99,
"status": "active",
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-01-15T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 1,
"per_page": 10
}
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/my-products/filter/date"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"start_date": "2023-01-01",
"end_date": "2023-12-31"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"name": "Product Name",
"description": "Product Description",
"price": 99.99,
"user_id": 1,
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-01-15T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 1,
"per_page": 10
}
}
The slug of the end.
const url = new URL(
"http://127.0.0.1:8000/api/v1/my-products/end/laudantium"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "Product listing ended successfully",
"data": {
"id": 1,
"slug": "product-slug",
"status": "inactive",
"updated_at": "2024-01-15T12:00:00Z"
}
}
The unique slug of the product.
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/iphone-13"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "Product retrieved successfully",
"data": {
"id": 1,
"name": "iPhone 13",
"slug": "iphone-13",
"description": "Latest iPhone model",
"price": 999.99,
"category_id": 1,
"status": "active",
"images": [
"image1.jpg",
"image2.jpg"
],
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-01-15T00:00:00Z"
}
}
The slug of the product.
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/placeat"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "iPhone 13 Pro",
"description": "Latest iPhone model with advanced features",
"price": "999.99",
"category_id": 1,
"status": "active",
"images": [
"image1.jpg",
"image2.jpg"
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Product updated successfully",
"data": {
"id": 1,
"name": "iPhone 13 Pro",
"slug": "iphone-13-pro",
"description": "Latest iPhone model with advanced features",
"price": 999.99,
"category_id": 1,
"status": "active",
"images": [
"image1.jpg",
"image2.jpg"
],
"updated_at": "2023-01-15T00:00:00Z",
"created_at": "2023-01-15T00:00:00Z"
}
}
The slug of the product.
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/dolores"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"status": "success",
"message": "Product deleted successfully",
"data": {
"slug": "product-slug",
"deleted_at": "2024-01-15T12:00:00Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/filter/search"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "\"laptop\"",
"category": "\"electronics\"",
"min_price": "100",
"max_price": "1000",
"sort": "\"desc\"",
"limit": 10,
"page": 1
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"name": "Gaming Laptop",
"description": "High performance gaming laptop",
"price": 899.99,
"category": "electronics",
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 50,
"per_page": 10,
"last_page": 5
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/filter/status"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "active",
"page": 1,
"per_page": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"name": "Product Name",
"status": "active",
"category_id": 1,
"description": "Product description",
"price": 99.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 10,
"per_page": 10
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/filter/date"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"start_date": "2023-01-01",
"end_date": "2023-12-31",
"per_page": 18,
"page": 5
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"name": "Product Name",
"description": "Product Description",
"price": 99.99,
"created_at": "2023-01-15T00:00:00Z",
"updated_at": "2023-01-15T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 1,
"per_page": 10
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/filter/simple-search"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"search": "\"phone\"",
"limit": 10,
"page": 1
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Products retrieved successfully",
"data": [
{
"id": 1,
"name": "iPhone 13",
"description": "Latest smartphone from Apple",
"price": 999.99,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
],
"meta": {
"current_page": 1,
"total": 1,
"per_page": 10
}
}
The slug of the update status.
const url = new URL(
"http://127.0.0.1:8000/api/v1/products/update-status/unde"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "active",
"reason": "Product back in stock"
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": "success",
"message": "Product listing status updated successfully",
"data": {
"id": 1,
"slug": "iphone-13",
"status": "active",
"updated_at": "2023-01-15T00:00:00Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/saved-items"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Saved items retrieved successfully",
"data": [
{
"id": 1,
"item_id": 1,
"type": "product",
"user_id": 1,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z",
"item": {
"id": 1,
"name": "Sample Item",
"description": "Item description"
}
}
]
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/saved-items/filter"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"type": "product"
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Saved items retrieved successfully",
"data": [
{
"id": 1,
"item_id": 1,
"type": "product",
"user_id": 1,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z",
"item": {
"id": 1,
"name": "Sample Item",
"description": "Item description"
}
}
]
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/saved-items"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"item_id": 1,
"type": "\"product\""
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Item saved successfully",
"data": {
"id": 1,
"item_id": 1,
"type": "product",
"user_id": 1,
"created_at": "2023-01-01T00:00:00Z",
"updated_at": "2023-01-01T00:00:00Z"
}
}
The ID of the saved item.
const url = new URL(
"http://127.0.0.1:8000/api/v1/saved-items/consequatur"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Saved item removed successfully"
}
Lists all shipping addresses associated with the current user's account, including primary/default address status
const url = new URL(
"http://127.0.0.1:8000/api/v1/shipping-addresses"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Shipping addresses retrieved successfully",
"data": [
{
"id": 1,
"user_id": 1,
"name": "John Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"phone": "+1234567890",
"is_primary": true,
"slug": "john-doe-123-main-st"
}
]
}
The ID of the shipping address.
const url = new URL(
"http://127.0.0.1:8000/api/v1/shipping-addresses/velit"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "John Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"phone": "+1234567890",
"is_primary": true
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Shipping address updated successfully",
"data": {
"id": 1,
"user_id": 1,
"name": "John Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"phone": "+1234567890",
"is_primary": true,
"slug": "john-doe-123-main-st"
}
}
Stores a new shipping address with the provided details. The address can optionally be set as the primary/default shipping address.
const url = new URL(
"http://127.0.0.1:8000/api/v1/shipping-addresses"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "John Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"phone": "+1234567890",
"is_primary": true
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Shipping address created successfully",
"data": {
"id": 1,
"user_id": 1,
"name": "John Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"phone": "+1234567890",
"is_primary": true,
"slug": "john-doe-123-main-st"
}
}
The unique identifier of the shipping address.
const url = new URL(
"http://127.0.0.1:8000/api/v1/shipping-addresses/john-doe-123-main-st"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Shipping address retrieved successfully",
"data": {
"id": 1,
"user_id": 1,
"name": "John Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"phone": "+1234567890",
"is_primary": true,
"slug": "john-doe-123-main-st",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
The unique identifier of the shipping address to set as primary.
const url = new URL(
"http://127.0.0.1:8000/api/v1/shipping-addresses/primary/john-doe-123-main-st"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PATCH",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Shipping address set as primary successfully",
"data": {
"id": 1,
"user_id": 1,
"name": "John Doe",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"country": "USA",
"postal_code": "10001",
"phone": "+1234567890",
"is_primary": true,
"slug": "john-doe-123-main-st",
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
The unique identifier of the shipping address to delete.
const url = new URL(
"http://127.0.0.1:8000/api/v1/shipping-addresses/john-doe-123-main-st"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Shipping address removed successfully",
"data": null
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/shopping-cart"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Shopping cart items retrieved successfully",
"data": {
"items": [
{
"id": 1,
"product_id": 1,
"quantity": 2,
"product": {
"id": 1,
"name": "Sample Product",
"price": 99.99,
"image": "product-image.jpg"
}
}
],
"total": 199.98
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/shopping-cart"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"product_id": 1,
"quantity": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Product added to cart successfully",
"data": {
"items": [
{
"id": 1,
"product_id": 1,
"quantity": 1,
"product": {
"id": 1,
"name": "Sample Product",
"price": 99.99,
"image": "product-image.jpg"
}
}
],
"total": 99.99
}
}
The ID of the shopping cart.
const url = new URL(
"http://127.0.0.1:8000/api/v1/shopping-cart/et"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Product removed from cart successfully",
"data": {
"items": [
{
"id": 2,
"product_id": 2,
"quantity": 1,
"product": {
"id": 2,
"name": "Other Product",
"price": 49.99,
"image": "other-product-image.jpg"
}
}
],
"total": 49.99
}
}
The ID of the shopping cart.
const url = new URL(
"http://127.0.0.1:8000/api/v1/shopping-cart/distinctio"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"quantity": 2
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Cart updated successfully",
"data": {
"items": [
{
"id": 1,
"product_id": 1,
"quantity": 2,
"product": {
"id": 1,
"name": "Sample Product",
"price": 29.99,
"image": "product-image.jpg"
}
}
],
"total": 59.98
}
}
Creates a new sub category with the provided details
const url = new URL(
"http://127.0.0.1:8000/api/v1/sub-categories"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Electronics",
"slug": "electronics",
"category_id": 1
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Sub category created successfully",
"data": {
"id": 1,
"name": "Electronics",
"slug": "electronics",
"category_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
Lists all available sub categories in the system
const url = new URL(
"http://127.0.0.1:8000/api/v1/sub-categories"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Sub categories retrieved successfully",
"data": [
{
"id": 1,
"name": "Electronics",
"slug": "electronics",
"category_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
]
}
The ID of the sub category.
const url = new URL(
"http://127.0.0.1:8000/api/v1/sub-categories/mollitia"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Sub categories retrieved successfully",
"data": [
{
"id": 1,
"name": "Electronics",
"slug": "electronics",
"category_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
]
}
The slug of the sub category.
const url = new URL(
"http://127.0.0.1:8000/api/v1/sub-categories/quam"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Sub category retrieved successfully",
"data": {
"id": 1,
"name": "Electronics",
"slug": "electronics",
"category_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T00:00:00.000000Z"
}
}
The slug of the sub category.
const url = new URL(
"http://127.0.0.1:8000/api/v1/sub-categories/et"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Updated Electronics",
"category_id": 1
};
fetch(url, {
method: "PATCH",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Sub category updated successfully",
"data": {
"id": 1,
"name": "Updated Electronics",
"slug": "updated-electronics",
"category_id": 1,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-01T12:00:00.000000Z"
}
}
The slug of the sub category.
const url = new URL(
"http://127.0.0.1:8000/api/v1/sub-categories/dolores"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Sub category deleted successfully",
"data": {
"id": 1,
"name": "Electronics",
"slug": "electronics",
"category_id": 1,
"deleted_at": "2023-01-01T12:00:00.000000Z"
}
}
Lists all transactions with optional filtering parameters
Page number for pagination.
Number of items per page.
Sort field (created_at, amount, etc).
Sort order (asc or desc).
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions"
);
const params = {
"page": "1",
"per_page": "10",
"sort": "created_at",
"order": "desc",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Transactions retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"trans_ref": "TRX-123456",
"amount": 1000,
"status": "completed",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
],
"total": 50,
"per_page": 10
}
}
The transaction reference number.
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/TRX-123456"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Transaction retrieved successfully",
"data": {
"id": 1,
"trans_ref": "TRX-123456",
"amount": 1000,
"status": "completed",
"customer": {
"id": 1,
"name": "John Doe",
"email": "john@example.com"
},
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/fetch/order"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_id": "ORD-123456",
"include_customer": true
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Transaction details retrieved successfully",
"data": {
"id": 1,
"order_id": "ORD-123456",
"trans_ref": "TRX-789012",
"amount": 1500,
"status": "completed",
"payment_method": "card",
"customer": {
"id": 1,
"name": "John Doe",
"email": "john@example.com"
},
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
}
Retrieves a list of transactions filtered by a specified date range
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/filter/date"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"start_date": "2023-01-01",
"end_date": "2023-12-31",
"page": 1,
"per_page": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Transactions retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"transaction_id": "TRX-123456",
"amount": 100,
"status": "completed",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
],
"total": 50,
"per_page": 10,
"last_page": 5
}
}
Retrieves a list of transactions filtered by their status (e.g., pending, completed, failed)
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/filter/status"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"status": "completed",
"page": 1,
"per_page": 10
};
fetch(url, {
method: "GET",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Transactions retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"transaction_id": "TRX-123456",
"amount": 100,
"status": "completed",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
],
"total": 50,
"per_page": 10,
"last_page": 5
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/filter/customer"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json()); {
"status": true,
"message": "Customer transactions retrieved successfully",
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"transaction_id": "TRX-123456",
"customer_id": "CUST-123",
"amount": 100,
"status": "completed",
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-01T12:00:00Z"
}
],
"total": 50,
"per_page": 10,
"last_page": 5
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/payment-request"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": "100.50",
"currency": "USD",
"payment_method": "credit_card",
"customer_id": "CUST-123",
"description": "Payment for order #123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Payment request processed successfully",
"data": {
"transaction_id": "TRX-123456",
"amount": 100.5,
"currency": "USD",
"payment_method": "credit_card",
"status": "pending",
"created_at": "2023-01-01T12:00:00Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/payment-details"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"transaction_id": "TRX-123456",
"customer_id": "CUST-789",
"payment_type": "credit_card"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Payment details generated successfully",
"data": {
"transaction_id": "TRX-123456",
"payment_details": {
"amount": 150,
"currency": "USD",
"payment_method": "credit_card",
"payment_instructions": "Complete payment using provided details",
"expiry_time": "2023-12-31T23:59:59Z"
}
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/payment-refund"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"transaction_id": "TRX-123456",
"amount": "100.50",
"reason": "Customer dissatisfaction"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Refund processed successfully",
"data": {
"refund_id": "REF-123456",
"transaction_id": "TRX-123456",
"amount": 100.5,
"status": "completed",
"processed_at": "2023-12-31T12:00:00Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/store"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": "150.00",
"payment_method": "credit_card",
"currency": "USD",
"customer_id": "CUST-123",
"description": "Purchase of items"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Transaction created successfully",
"data": {
"transaction_id": "TRX-123456",
"amount": 150,
"currency": "USD",
"payment_method": "credit_card",
"customer_id": "CUST-123",
"status": "completed",
"created_at": "2023-12-31T12:00:00Z"
}
}
const url = new URL(
"http://127.0.0.1:8000/api/v1/transactions/validate"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"amount": "100.50",
"currency": "USD",
"payment_method": "credit_card",
"customer_id": "CUST-123"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json()); {
"status": true,
"message": "Transaction validation successful",
"data": {
"amount": 100.5,
"currency": "USD",
"payment_method": "credit_card",
"customer_id": "CUST-123",
"validation_id": "VAL-123456",
"validated_at": "2023-12-31T12:00:00Z"
}
}
The ID of the feedback.
const url = new URL(
"http://127.0.0.1:8000/api/v1/feedbacks/esse"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());