Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fzakaria/chargehound-stripe
A sample app demonstrating chargehound & stripe integration
https://github.com/fzakaria/chargehound-stripe
chargeback chargehound flask python stripe
Last synced: 29 days ago
JSON representation
A sample app demonstrating chargehound & stripe integration
- Host: GitHub
- URL: https://github.com/fzakaria/chargehound-stripe
- Owner: fzakaria
- Created: 2018-02-27T06:16:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T00:54:55.000Z (about 2 years ago)
- Last Synced: 2024-11-13T23:23:34.644Z (2 months ago)
- Topics: chargeback, chargehound, flask, python, stripe
- Language: Python
- Homepage: https://chargehound-demo-fzakaria.herokuapp.com/
- Size: 165 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ChargeHound <3 Stripe
This is a sample application showing integration of [Stripe](https://stripe.com) with
[ChargeHound](https://www.chargehound.com).> You can view a live version of this site running https://chargehound-demo-fzakaria.herokuapp.com. Please note however that it uses an in-memory database.
This is a very minimal [flask](flask.pocoo.org) application. There are many production best practices that have been ommitted in order to provide clarity and simplicity in demonstrating the integration.
To get started all you have to do is `make run`.
This will start a *development server* running on your local host on port *5000*.```
export STRIPE_PUBLISHABLE_KEY=pk_test_yoursecret
export STRIPE_SECRET_KEY=sk_test_yoursecret
export CHARGEHOUND_SECRET_KEY=test_yoursecret
make run
```The following routes are expose:
**/** The base path, where you can see some albums and purchase them.
**/charge/** The callback/webhook for stripe to initiate the charge after they've validated the credit card.
**/chargehound/dispute** The callback/webhook for chargehound after they've discovered a dispute from their Stripe integration.
**/admin/charges** An admin view that just returns the current in-memory charges processed.
## Stripe Information
The integration with stripe is using the test keys -- they therefore accept the following test credit card values.
*valid cc* 242 4242 4242 4242
*disupte cc* 4000 0000 0000 0259
*disputed cc as inquiry* 4000 0000 0000 1976
For more information on these test cards please see: https://stripe.com/docs/testing#disputes & https://stripe.com/docs/testing#cards.
You can read also about more about the [ChargeHound+Stripe Integration](https://testing-chargehound-pr-1027.herokuapp.com/docs?template=song-purchase&processor=stripe).
## Heroku Setup
In order to run on heroku the following were set:
```
CHARGEHOUND_SECRET_KEY: test_your_key
CHARGE_HOUND_HOST: test-api.chargehound.com
FLASK_APP: chargehound-demo.py
FLASK_DEBUG: 1
PREFERRED_URL_SCHEME: https
SERVER_NAME: chargehound-demo-fzakaria.herokuapp.com
STRIPE_PUBLISHABLE_KEY: pk_test_your_key
STRIPE_SECRET_KEY: sk_test_your_key
WEB_CONCURRENCY: 1
```The one *gotcha* is that **WEB_CONCURRENCY** should be 1 since we are storing data in memory only -- otherwise gunicorn spawns multiple processes and they don't share data. This not a problem when storing data in a separate process like a database.