Orders
Loading orders...
All Orders
All
⏳ Pending
💳 Paid
🚚 Shipped
❌ Cancelled
0 selected
| # | Date | Order # | Customer | Items | Total | Payment | Tracking | Status | Actions |
|---|
Affiliate Orders
| Date | Customer | Items | Revenue | Product Cost | Net | Affiliate | Commission % | Commission $ | Status |
|---|
Top Products
Code Usage
Your Profit per Order =
Order Total
−
Product Cost
−
Affiliate Commission
−
Shipping Cost
Revenue Over Time
Profit Breakdown
Product Cost Tracker
Edit "Your Cost / unit" for each product. These feed directly into profit calculations across all tabs.
| Product | Sale Price | Your Cost / unit | Units Sold | Revenue | COGS | Gross Profit | Margin |
|---|
📦 Inventory Batches
Track upfront purchases → break-even → profit per batch
Total Inventory Spent: $0.00
Revenue Recouped: $0.00
Still Owed to Break Even: $0.00
| Date | Product | Units Bought | Cost Paid | Units Sold | Revenue Recouped | Still to Break Even | Progress | Status |
|---|
💸 Business Expenses
Deducted from net profit to show true P&L
Total Expenses: $0.00
True Profit (after expenses): —
| Date | Description | Category | Amount | Action |
|---|
Order-by-Order Profit Detail
| Date | Customer | Revenue | Product Cost | Commission | Shipping Cost | Net Profit | Status |
|---|
🧪 Storefront Products
Add, edit, delete, and toggle stock for live storefront products. Changes go live on the storefront instantly.
➕ Add New Product
Available tags: fat_loss · metabolic · muscle · recovery · sleep · gh · skin · hair · cognitive · focus · neuro · anxiety · stress · hormonal · testosterone · libido · longevity · anti_aging · cellular · energy · supplies
Live Products
Changes are reflected on the storefront immediately
| Order | Name | Cat | Price | Cost | Reward Pts | Variants | Popular | Stock | Actions |
|---|---|---|---|---|---|---|---|---|---|
| Loading products… | |||||||||
Active Affiliates
| Name | Code | Venmo | Commission % | Customer Discount % | Orders | Commission Owed | Password | Actions |
|---|
Pending Applications
| Name | Code | Platform | Actions |
|---|
⏳ Pending Requests
| Date | Affiliate | Reward | Points | Details | Actions |
|---|
History
| Date | Affiliate | Reward | Points | Status |
|---|
🎉 Welcome CodeGiven on first login
% off
➕ Create Custom Code
% off
All Active Codes
All codes sync live to the website via admin.php
Registered Users
| # | Name | Company / Lab | Joined | Verified | Last Login | Actions | |
|---|---|---|---|---|---|---|---|
👥 Click Refresh to load users | |||||||
Change Password
Changing password for
Select a user above
Connect Google Sheets
Paste your Google Apps Script Web App URL to sync orders into the dashboard.
Apps Script Code
Paste this into Google Apps Script (Extensions → Apps Script in your Sheet).
// BD Peptides — Google Apps Script v3 (secured)
// Must match SHEET_API_SECRET in the dashboard HTML.
const API_SECRET = 'bdp_k7Qx92mLnR4vTz';
// Fields customers are allowed to see via public order lookup.
// Deliberately excludes: Name, Venmo, Address, Zip, affiliate + commission data.
const PUBLIC_FIELDS = ['Order Number', 'Timestamp', 'Items', 'Total', 'Status', 'Tracking', 'Shipping'];
function doPost(e) {
// Lock prevents two simultaneous requests from double-appending
const lock = LockService.getScriptLock();
lock.waitLock(10000);
try {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const d = JSON.parse(e.postData.contents);
const rows = sheet.getDataRange().getValues();
const headers = rows[0].map(function(h){ return String(h).trim(); });
const onCol = headers.indexOf('Order Number');
// ── STATUS / TRACKING / NOTES UPDATE (dashboard only — requires secret) ──
if (d.action === 'update_order') {
if (d.secret !== API_SECRET) {
return ContentService.createTextOutput("FORBIDDEN").setMimeType(ContentService.MimeType.TEXT);
}
if (!d.orderNumber) {
return ContentService.createTextOutput("MISSING_ORDER").setMimeType(ContentService.MimeType.TEXT);
}
const sCol = headers.indexOf('Status');
const nCol = headers.indexOf('Notes');
const tCol = headers.indexOf('Tracking');
for (var i = 1; i < rows.length; i++) {
if (String(rows[i][onCol]).trim().toUpperCase() === String(d.orderNumber).trim().toUpperCase()) {
if (d.status !== undefined && sCol > -1) sheet.getRange(i+1, sCol+1).setValue(String(d.status).toUpperCase());
if (d.notes !== undefined && nCol > -1) sheet.getRange(i+1, nCol+1).setValue(d.notes);
if (d.tracking !== undefined && tCol > -1) sheet.getRange(i+1, tCol+1).setValue(d.tracking);
return ContentService.createTextOutput("UPDATED").setMimeType(ContentService.MimeType.TEXT);
}
}
return ContentService.createTextOutput("NOT_FOUND").setMimeType(ContentService.MimeType.TEXT);
}
// ── NEW ORDER (public — storefront checkout logs here) ──
// Idempotent: same order number never logs twice.
if (d.orderNumber && onCol > -1) {
for (var j = 1; j < rows.length; j++) {
if (String(rows[j][onCol]).trim() === String(d.orderNumber).trim()) {
return ContentService.createTextOutput("DUPLICATE").setMimeType(ContentService.MimeType.TEXT);
}
}
}
sheet.appendRow([
d.timestamp, d.orderNumber||'', d.name, d.venmo, d.address, d.zip,
d.items, d.subtotal, d.shipping, d.total,
d.discountCode, d.affiliateCode, d.affiliateName,
d.affiliateVenmo, d.commissionOwed, 'PENDING', '', d.tracking||'',
d.paymentMethod||''
]);
return ContentService.createTextOutput("OK").setMimeType(ContentService.MimeType.TEXT);
} finally {
lock.releaseLock();
}
}
function doGet(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const rows = sheet.getDataRange().getValues();
const headers = rows[0].map(function(h){ return String(h).trim(); });
const p = (e && e.parameter) ? e.parameter : {};
// ── PUBLIC: single-order lookup for the customer tracking page ──
// Returns ONLY safe fields for the one matching order. No key needed.
if (p.orderNumber) {
const onCol = headers.indexOf('Order Number');
const want = String(p.orderNumber).trim().toUpperCase();
for (var i = 1; i < rows.length; i++) {
if (String(rows[i][onCol]).trim().toUpperCase() === want) {
const obj = {};
PUBLIC_FIELDS.forEach(function(f) {
const c = headers.indexOf(f);
if (c > -1) obj[f] = rows[i][c];
});
// tracking page expects an array it can .find() on
return ContentService.createTextOutput(JSON.stringify([obj]))
.setMimeType(ContentService.MimeType.JSON);
}
}
return ContentService.createTextOutput(JSON.stringify([]))
.setMimeType(ContentService.MimeType.JSON);
}
// ── PRIVATE: full dump for the dashboard — requires key ──
if (p.key !== API_SECRET) {
return ContentService.createTextOutput(JSON.stringify({error:'forbidden'}))
.setMimeType(ContentService.MimeType.JSON);
}
const data = rows.slice(1).map(function(r) {
const obj = {};
headers.forEach(function(h, i) { obj[h] = r[i]; });
return obj;
});
return ContentService.createTextOutput(JSON.stringify(data))
.setMimeType(ContentService.MimeType.JSON);
}
Sheet Headers
Row 1 of your Google Sheet must have exactly these headers:
Timestamp | Order Number | Name | Venmo | Address | Zip | Items | Subtotal | Shipping | Total | Discount Code | Affiliate Code | Affiliate Name | Affiliate Venmo | Commission Owed | Status | Notes | Tracking | Payment
If your sheet already has data: just type Payment in the next empty header cell (column S). Old orders keep working — Payment just shows blank for them.