Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
adreyfus-stripe committed Nov 4, 2019
1 parent 9bc9f7c commit d888c16
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
36 changes: 27 additions & 9 deletions README.md
Expand Up @@ -27,32 +27,43 @@ This sample includes 5 server implementations in Node, Ruby, Python, Java, and P

Follow the steps below to run locally.

**1. Clone the repository:**
**1. Clone and configure the sample**

The Stripe CLI is the fastest way to clone and configure a sample to run locally.

**Using the Stripe CLI**

If you haven't already installed the CLI, follow the [installation steps](https://github.com/stripe/stripe-cli#installation) in the project README. The CLI is useful for cloning samples and locally testing webhooks and Stripe integrations.

In your terminal shell, run the Stripe CLI command to clone the sample:

```
git clone https://github.com/stripe-samples/checkout-subscription-and-add-on
stripe samples create checkout-subscription-and-add-on
```

**2. Create Products and Plans on Stripe**
The CLI will walk you through picking your integration type, server and client languages, and configuring your .env config file with your Stripe API keys.

This sample requires a [Plan](https://stripe.com/docs/api/plans/object) ID to create the Checkout page. Products and Plans are objects on Stripe that lets you model a subscription.
**Installing and cloning manually**

You can create Products and Plans [in the dashboard](https://dashboard.stripe.com/products) or via [the API](https://stripe.com/docs/api/plans/create). Create a Plan before running this sample.
If you do not want to use the Stripe CLI, you can manually clone and configure the sample yourself:

**3. Copy the .env.example to a .env file:**
```
git clone https://github.com/stripe-samples/checkout-subscription-and-add-on
```

Copy the .env.example file into a file named .env in the folder of the server you want to use. For example:

```
cp .env.example server/node/.env
cp .env.example client-and-server/server/node/.env
```

You will need a Stripe account in order to run the demo. Once you set up your account, go to the Stripe [developer dashboard](https://stripe.com/docs/development#api-keys) to find your API keys and update your .env file with the keys.
You will need a Stripe account in order to run the demo. Once you set up your account, go to the Stripe [developer dashboard](https://stripe.com/docs/development#api-keys) to find your API keys.

```
STRIPE_PUBLISHABLE_KEY=<replace-with-your-publishable-key>
STRIPE_SECRET_KEY=<replace-with-your-secret-key>
```

The other environment variables are configurable:

`STATIC_DIR` tells the server where to the client files are located and does not need to be modified unless you move the server files.
Expand All @@ -61,7 +72,14 @@ The other environment variables are configurable:

`DOMAIN` is the domain of your website, where Checkout will redirect back to after the customer completes the payment on the Checkout page.

**4. Follow the server instructions on how to run:**
**2. Create Products and Plans on Stripe**

This sample requires a [Plan](https://stripe.com/docs/api/plans/object) ID to create the Checkout page. Products and Plans are objects on Stripe that lets you model a subscription.

You can create Products and Plans [in the dashboard](https://dashboard.stripe.com/products) or via [the API](https://stripe.com/docs/api/plans/create). Create a Plan before running this sample.


**3. Follow the server instructions on how to run:**

Pick the server language you want and follow the instructions in the server folder README on how to run.

Expand Down
2 changes: 1 addition & 1 deletion server/java/src/main/java/com/stripe/sample/Server.java
Expand Up @@ -42,7 +42,7 @@ public Boolean getIsBuyingSticker() {

public static void main(String[] args) {
port(4242);
String ENV_PATH = "../../";

Dotenv dotenv = Dotenv.load();

Stripe.apiKey = dotenv.get("STRIPE_SECRET_KEY");
Expand Down

0 comments on commit d888c16

Please sign in to comment.