Demo of creating a 5 year subscription using Stripe Subscriptions.

Scheduled subscription demo

This simple demo shows how to create a subscription in Stripe with a 5 year duration. This is accomplished by charging the full amount in year 1; and then scheduling 4 1-year phases at $0 per year after year 1.

The demo also shows how the duration of the subscription can be shortened.

Demo instructions

Prerequisites: install the Go compiler (https://go.dev/dl/).

  1. Create a Stripe account, and log into the Dashboard.
  2. Create a Customer with a saved payment method (use one of the test cards here: https://stripe.com/docs/testing#cards).
  3. Create a Product.
  4. In the Product object, create two prices: one with a price of $100, recurring yearly; and one with a price of $0, recurring yearly.
  5. In main.go, update the first four var values with your Stripe secret key, the customer ID, and the two price ID's.
  6. Open a terminal and type: go run main.go. Verify that the subscription was successfully created in the Stripe Dashboard. Note the subscription end date of January 2027.
  7. From the output in the terminal, copy the ID value, and paste it into the var SCHEDULED_SUBSCRIPTION_ID parameter in main.go.
  8. Comment out createNewFiveYearSubscription, and uncomment shortenSubscriptionByEighteenMonths.
  9. In the terminal, type go run main.go again.
  10. Verify that the subscription end date has been changed to July 2025.
Owner
Mike Graboski
Solutions Architect at Stripe
Mike Graboski
Similar Resources

Docker-NodeJS - Creating a CI/CD Environment for Serverless Containers on Google Cloud Run

Docker-NodeJS - Creating a CI/CD Environment for Serverless Containers on Google Cloud Run

Creating a CI/CD Environment for Serverless Containers on Google Cloud Run Archi

Jan 8, 2022

Evidently-sushi - Sample for creating a CloudWatch Evidently project

evidently-sushi This is a sample for creating a CloudWatch Evidently project. Pr

Jan 8, 2022

Tool for creating identical machine images for multiple platforms from a single source configuration.

Packer Packer is a tool for building identical machine images for multiple platforms from a single source configuration. Packer is lightweight, runs o

Jan 18, 2022

Go-backend-test - Creating backend stuff & openid connect authentication stuff in golang

Go Backend Coding Practice This is my practice repo to learn about creating back

Feb 5, 2022

Automating Kubernetes Rollouts with Argo and Prometheus. Checkout the demo URL below

Automating Kubernetes Rollouts with Argo and Prometheus. Checkout the demo URL below

observe-argo-rollout Demo for Automating and Monitoring Kubernetes Rollouts with Argo and Prometheus Performing Demo The demo can be found on Katacoda

Nov 16, 2022

A super simple demo to document my journey to reasonably sized docker containers.

hello-docker A super simple demo to document my journey to reasonably sized docker containers. Task at Hand Build a docker container as small as possi

Nov 30, 2021

IP Counter Demo

IP Counter Demo This is a demo of maintaining counts of IP hits and a top 100 list of the IPs with the most hits. How to Run $ go build # macOS or Lin

Nov 25, 2021

Demo of schema change failures with SQLite INTEGERs.

SQLite Schema Migration Bug This is a repository to reproduce a bug with Ent and the modernc.org/sqlite (non-CGO) SQLite 3 driver. Reproduce Simply ru

Dec 9, 2021

A simple application, demo at this point, on how to pull a backup from Collibra on prem (say for Cohesity backup)

A simple application, demo at this point, on how to pull a backup from Collibra on prem (say for Cohesity backup)

go-get-collibra-backup Introduction This repository is a very simple go application that's intended, at this point, more of a demonstration about how

Dec 10, 2021
False-sharing-demo - Demo for performance effects of CPU cache false-sharing

Example of CPU cache false-sharing in Go. A simple example where 2 integer varia

Aug 28, 2022
Litestream-read-replica-demo - A demo application for running live read replication on fly.io with Litestream

Litestream Read Replica Demo A demo application for running live read replicatio

Oct 18, 2022
Quick start repository for creating a Terraform provider using terraform-plugin-framework

Terraform Provider Scaffolding (Terraform Plugin Framework) This template repository is built on the Terraform Plugin Framework. The template reposito

Dec 15, 2022
A demo repository that shows CI/CD integration using DroneCI + ArgoCD + Kubernetes.
A demo repository that shows CI/CD integration using DroneCI + ArgoCD + Kubernetes.

CI/CD Demo This is the demo repo for my blog post. This tutorial shows how to build CI/CD pipeline with DroneCI and ArgoCD. In this demo, we use Drone

Oct 18, 2022
Small demo of using physac 2d physics engine in golang

Physac-go 2D physics engine in golang For now this is just a small demo. Maybe later I'll convert it into a proper module. References Original Physac

Jul 26, 2022
Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.

Packer Website: https://www.packer.io IRC: #packer-tool on Freenode Mailing list: Google Groups Packer is a tool for building identical machine images

Jan 8, 2023
Learning about containers and how they work by creating them the hard way
Learning about containers and how they work by creating them the hard way

Containers the hard way: Gocker: A mini Docker written in Go It is a set of Linux's operating system primitives that provide the illusion of a contain

Jan 7, 2023
Traefik-redirect-operator is created to substitute manual effort of creating an ingress and service type External.
Traefik-redirect-operator is created to substitute manual effort of creating an ingress and service type External.

Overview Traefik Redirect Operator is used to help creating a combination of Ingress of Traefik controller along with Service's ExternalName type. The

Sep 22, 2021
An extensible tool for creating your own in cluster health endpoints

healthyk8s an extensible tool for creating your own "in cluster" health endpoints Why? allows for creating a health endpoint for anything - external r

Oct 26, 2021
Package create provides a generic option pattern for creating new values of any type

create Package create provides a generic option pattern for creating new values

Dec 30, 2021