Service Pricing & Order — Setup Guide
1
Canvas & Layout Configuration
- Place ServicePricingOrder inside a full-width page section.
- Set Width to
Fill(inside a container up to1160pxwide) and Height toFit Content(auto). - Set Overflow to
Visibleon all parent stacks and containers so the Add Extra Services pop-up menu opens cleanly above the bottom bar without clipping. - Customize packages, add-ons, light/dark color tokens, 4 font slots, and localization strings (
System Labels (i18n)) in the right-hand Properties panel.
2
Create Google Doc & Paste Apps Script
- Open Google Docs and create a new blank document (e.g., Website Pre-Orders).
- In the top menu, select Extensions → Apps Script.
- Delete any placeholder code in
Code.gs, copy the script below, and paste it into the editor:
Code.gs — Google Apps Script
function doPost(e) {
const lock = LockService.getScriptLock();
if (!lock.tryLock(10000)) {
return ContentService.createTextOutput(
JSON.stringify({ ok: false, error: "Server busy" })
).setMimeType(ContentService.MimeType.JSON);
}
try {
if (!e || !e.postData || !e.postData.contents) {
throw new Error("Empty request body");
}
const data = JSON.parse(e.postData.contents);
if (!data.orderId || !data.customer || !data.package || !data.pricing) {
throw new Error("Invalid payload structure");
}
const doc = DocumentApp.getActiveDocument();
const body = doc.getBody();
const cur = String(data.pricing.currency || "$");
const title = body.appendParagraph(
"Order " + data.orderId + " — " + (data.serviceCategory || "Service")
);
title.setHeading(DocumentApp.ParagraphHeading.HEADING2);
body.appendParagraph("Date (UTC): " + (data.createdAt || new Date().toISOString()));
body.appendParagraph("Customer: " + (data.customer.name || ""));
body.appendParagraph("Phone: " + (data.customer.phone || ""));
body.appendParagraph("Email: " + (data.customer.email || ""));
body.appendParagraph("Address: " + (data.customer.address || ""));
body.appendParagraph(
"Package: " + data.package.name + " (" + cur + data.package.basePrice + ")"
);
if (Array.isArray(data.addOns) && data.addOns.length > 0) {
body.appendParagraph("Extra Services:");
data.addOns.forEach(function (item) {
const qtyLabel = item.quantity > 1 ? " × " + item.quantity : "";
body.appendListItem(item.title + qtyLabel + " — " + cur + item.lineTotal);
});
}
const totalLine = body.appendParagraph(
"Grand Total: " + cur + data.pricing.grandTotal
);
totalLine.setBold(true);
body.appendHorizontalRule();
doc.saveAndClose();
return ContentService.createTextOutput(
JSON.stringify({ ok: true, orderId: data.orderId })
).setMimeType(ContentService.MimeType.JSON);
} catch (err) {
return ContentService.createTextOutput(
JSON.stringify({ ok: false, error: String(err) })
).setMimeType(ContentService.MimeType.JSON);
} finally {
lock.releaseLock();
}
}3
Deploy as a Private Web App
- Click Deploy → New deployment in the top-right corner of the Apps Script editor.
- Click the gear icon next to Select type and choose Web app.
- Set Execute as to
Me(your Google account). - Set Who has access to
Anyoneso website visitors can submit orders without signing in. - Click Deploy, authorize permissions when prompted, and copy the generated Web app URL (
https://script.google.com/macros/s/.../exec).
4
Connect in Framer & Test
- Select the ServicePricingOrder component on your Framer canvas.
- Paste your copied
https://...Web app URL into the Google Docs URL property field. - Publish your site and submit a test pre-order — a formatted order receipt will appear inside your Google Doc within seconds.
Optional Custom Handler: Leave Google Docs URL empty and attach a Framer Code Override to onOrderSubmit to receive the typed PreOrderPayload object directly in your own logic.
✓
Built-in Security & Privacy
- Write-Only Endpoint: Because the script only implements
doPost(e)withoutdoGet(e), visitors cannot read or list your Google Doc contents through the webhook URL. - Client & Server Protection: Enforces strict
HTTPSURL validation, honeypot bot filtering, submission cooldowns,LockServiceconcurrency protection, and formula-injection sanitization.