Skip to content
Snippets Groups Projects
user avatar
geant-release-service authored
8394eeb7
History

Stripe Checkout Service

Service for adding custom steps for Stipe checkout.

This service acts as glue between Visit(cloud) and Stripe and its main purpose is to be able to customize the checkout process for people registering for TNC2025 and enable the following features:

  • Payment through bank transfer
  • Addition of PO and VAT number in the invoice

These features are not supported by Visit's implementation of the Stripe integration. This service acts as an in-between layer and does support these features

When visitors are registering to TNC2025 in Visit cloud, they are redirected to this service in the final step

Development

Config

This service needs configuation data in the form of a config json file. By default, django look a file called config.json in the current directory. It is possble to override this by setting the environment variable CONFIG_FILENAME to point to a different location. A sample config is given in config-example.json. Make a copy named config.json and fill in the required data such as the STRIPE_API_KEY and the VISIT.api-key variables.

Database

Connecting to a database can be done by setting the DATABASE_URL environment variable to a valid value:

export DATABASE_URL=postgresql://<username>:<password>@<host_address>/<database>

Altenatively, you can set up a local (sqlite) database. This can be done easily from the root of this repository

python manage-dev.py migrate

This will create a database file 'db.sqlite' in the current directory. You can then create a superuser account

python manage-dev.py createsuperuser

And finally you need to populate the database with price information. Sample price information is given in the prices.json file, but this file may not be completely up to date

python manage-dev.py createprices --file prices.json

Development server

You can then run the development server by running

python manage-dev.py runserver

Admin interface

The django admin interface is enabled, so when running the development server you can browse to http://127.0.0.1:5000/admin to login to the admin interface using the credentials you created using the createsuperuser (or other valid credentials if connected to an existing database). Here you can manage administrative users, priced items and other things.

Migrate price information to deployments

with the correct enviroment settings setup, it is possble to dump the latest price information by running from the source database:

django-admin dumpdata stripe_checkout.PricedItem |json_pp > prices.json

to load price information into the target database, run:

django-admin loaddata prices.json