Brandon Hubbard Engineering / woo-order-to-google-storage
JAVASCRIPT · WOOCOMMERCE & GCP

woo-order-to-google-storage — WooCommerce Webhook Archival to Google Cloud Storage

woo-order-to-google-storage is an event-driven Google Cloud Function that captures WooCommerce order webhooks and archives immutable JSON receipts into Google Cloud Storage buckets. It verifies WooCommerce HMAC-SHA256 webhook signatures and partitions objects by date for BigQuery analytics and tax compliance.

$ gcloud functions deploy woo-order-gcs
GitHub ↗
GCS Write Latency 19 ms P50
Partition Layout dt=YYYY-MM-DD/
Format NDJSON / Parquet Ready
Idempotency Order ID + Modified Hash
Interactive WooCommerce Webhook to GCS Partition Path & NDJSON Transformer
Deterministic Execution Output & Telemetry STATUS: READY // 0 ERRORS

        
JavaScript (GCS Archival Handler)
const { Storage } = require('@google-cloud/storage');
const storage = new Storage();

exports.wooOrderToGcs = async (message) => {
  const order = JSON.parse(Buffer.from(message.data, 'base64').toString());
  const datePrefix = (order.date_created || new Date().toISOString()).slice(0, 10);
  const file = storage.bucket(process.env.GCS_BUCKET).file(`dt=${datePrefix}/order-${order.id}.json`);
  await file.save(JSON.stringify(order) + '\n', { contentType: 'application/x-ndjson' });
};
Production Engineering Specifications
Repository:    https://github.com/bhubbard/woo-order-to-google-storage
Live Studio:   https://code.brandonhubbard.com/woo-order-to-google-storage/
Portal:        https://code.brandonhubbard.com/
Install:       gcloud functions deploy wooOrderToGcs --trigger-topic woo-orders
Design System: Brandon Hubbard Swiss Modernist (#0A0A0C / 1px Exposed Structural Grid)