From 131f4e431dfbbd9d436c5b8df6b66ed0c3e2fd52 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Fri, 28 Oct 2022 20:17:16 -0400
Subject: [PATCH] Add the setup helper tools

---
 admin/create-product.sh | 16 ++++++++++++++++
 admin/create-webhook.sh | 15 +++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 admin/create-product.sh
 create mode 100644 admin/create-webhook.sh

diff --git a/admin/create-product.sh b/admin/create-product.sh
new file mode 100644
index 00000000..797e825d
--- /dev/null
+++ b/admin/create-product.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+KEY=$1
+shift
+
+curl https://api.stripe.com/v1/products \
+  -u "${KEY}:" \
+  -d "name=30 GiB-months" \
+  -d "description=30 GiB-months of Private.Storage storage × time" \
+  -d "default_price_data[currency]=USD" \
+  -d "default_price_data[unit_amount]=650" \
+  -d "default_price_data[tax_behavior]=exclusive" \
+  -d "statement_descriptor=PRIVATE STORAGE" \
+  -d "url=https://private.storage/"
diff --git a/admin/create-webhook.sh b/admin/create-webhook.sh
new file mode 100644
index 00000000..eacc3308
--- /dev/null
+++ b/admin/create-webhook.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+KEY=$1
+shift
+
+DOMAIN=$1
+shift
+
+curl \
+    https://api.stripe.com/v1/webhook_endpoints \
+    -u "${KEY}:" \
+    -d url="https://payments.${DOMAIN}/v1/stripe/webhook" \
+    -d "enabled_events[]"="checkout.session.completed"
-- 
GitLab