Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Files

Latest commit

 

History

History

2020-04-02-pausing-subscriptions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Pausing Subscriptions - Office Hours 2020-04-03

Walk through the basics of Subscription pausing using Ruby and Sinatra.

🎬 Watch on YouTube

Getting Started

Follow these instructions to spin-up a copy of this demo project up on your local machine for development and testing purposes. This is meant to be a guide to show you how to go about pausing Subscriptions.

Prerequisites

Step by step

  1. Configure your keys

Copy the example .env file and update those values with your Stripe keys.

cp .env.example server/.env

Then, be sure to update the publishable key (pk_xxx) in client/manual.html.

  1. Start the server
ruby server.rb
  1. Run the demo

Create a customer with Stripe CLI:

stripe customers create \
  --description="Pausing Test Customer" \
  -d payment_method=pm_card_visa \
  -d invoice_settings[default_payment_method]=pm_card_visa

Create a subscription with Stripe CLI with the billing_cycle_anchor set to a few min from now:

stripe subscriptions create \
  --customer={ID_FROM_PREV} \
  -d "items[0][plan]"=plan_xxx \
  -d billing_cycle_anchor={UNIX_TIMESTAMP_60_SECONDS_FROM_NOW}

Pause a Subscription and review in your Stripe dashboard.

More Resources

Demo