GithubHelp home page GithubHelp logo

itsderek23 / stripe-mrr-google-sheets Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 24 KB

Generates MRR revenue reports from Stripe invoice data and reports to Google Sheets.

License: MIT License

Python 100.00%
stripe google-sheets

stripe-mrr-google-sheets's Introduction

Stripe Revenue Analysis to Google Sheets

This script runs a series of PetalData Stripe revenue reports, updating a specified Google Sheet with the output.

Configuration

The following environment variables are required:

# Read only access to invoices
STRIPE_API_KEY=""

# Requires S3 read/write access
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
AWS_BUCKET=""

# The contents of the service account creds file provided by Google in JSON format
GOOGLE_SERVICE_ACCOUNT_INFO = {}

# Name of the Google Sheet the script will update.
# The user associated wit the Google auth creds must have read/write access to this sheet.
GOOGLE_SHEET=""

Optional:

SENTRY_DSN=""
SENTRY_ENVIRONMENT=""

Development

pipenv install --dev

To examine output after running the script:

python -i stripe_mrr_google_sheets.py

Setting the env. var DEV=true will:

  • Prevent fetching invoice updates (takes time)
  • Load the petaldata package from disk. I haven't had much luck w/Pipfile [dev-packages].

Deployment

The app can be deployed to Heroku. Follow these steps:

  • Create a Heroku app. Use GitHub for the deployment method and wire up this repo.
  • Provide values for the environment variables as Heroku config vars.
  • Install the Heroku Scheduler addon via heroku addons:create scheduler:standard.
  • Open scheduler via heroku addons:open scheduler.
  • Add a job to run every hour. Enter python stripe_mrr_google_sheets.py for the job.

Debugging

You can run the script via the Heroku CLI:

heroku run "python stripe_mrr_google_sheets.py"

You can also enter interactive mode after running the script via the -i flag:

heroku run "python -i stripe_mrr_google_sheets.py"

CTRL+C to exit.

stripe-mrr-google-sheets's People

Contributors

itsderek23 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.