Skip to content

Latest commit

 

History

History
69 lines (47 loc) · 1.79 KB

File metadata and controls

69 lines (47 loc) · 1.79 KB

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