From 7b99195e02f078c249e855305864cc8403f3fd66 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Wed, 2 Nov 2022 11:03:06 -0400 Subject: [PATCH] Set up an after-completion redirect for the checkout workflow --- admin/create-payment-link.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/admin/create-payment-link.sh b/admin/create-payment-link.sh index abd8f529..394bda70 100644 --- a/admin/create-payment-link.sh +++ b/admin/create-payment-link.sh @@ -1,18 +1,20 @@ #!/usr/bin/env bash -set -x set -euo pipefail KEY=$1 shift +DOMAIN=$1 +shift + PRODUCT_ID=$( 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 "statement_descriptor=PRIVATE STORAGE" \ - -d "url=https://private.storage/" | + -d "url=https://${DOMAIN}/" | jp --unquoted id ) @@ -34,8 +36,10 @@ LINK_URL=$( curl https://api.stripe.com/v1/payment_links \ -u "${KEY}:" \ -d "line_items[0][price]=${PRICE_ID}" \ - -d "line_items[0][quantity]=1" | + -d "line_items[0][quantity]=1" \ + -d "after_completion[type]"=redirect \ + -d "after_completion[redirect][url]"="https://${DOMAIN}/payment/success" | jp --unquoted url - ) + ) echo "Payment link: $LINK_URL" -- GitLab