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 to 1160px wide) and Height to Fit Content (auto).
  • Set Overflow to Visible on 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

  1. Open Google Docs and create a new blank document (e.g., Website Pre-Orders).
  2. In the top menu, select Extensions → Apps Script.
  3. 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

  1. Click Deploy → New deployment in the top-right corner of the Apps Script editor.
  2. Click the gear icon next to Select type and choose Web app.
  3. Set Execute as to Me (your Google account).
  4. Set Who has access to Anyone so website visitors can submit orders without signing in.
  5. 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

  1. Select the ServicePricingOrder component on your Framer canvas.
  2. Paste your copied https://... Web app URL into the Google Docs URL property field.
  3. 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) without doGet(e), visitors cannot read or list your Google Doc contents through the webhook URL.
  • Client & Server Protection: Enforces strict HTTPS URL validation, honeypot bot filtering, submission cooldowns, LockService concurrency protection, and formula-injection sanitization.

Create a free website with Framer, the website builder loved by startups, designers and agencies.