A simple django app to manage Satispay payments following the Web-button flow.
Project description
django-satispaython
A simple django app to manage Satispay payments following the Web-button flow.
Requirements
- python >= 3.6
- django >= 3
satispaython
>= 0.2
Installation
You can install this package with pip: pip install django-satispaython
.
Usage
Key generation and key-id
In order to use django-satispaython you need to generate a RSA private key and then get a key-id. Django-satispaython is based on satispaython so you can import it, create a key and get a key-id.
Configuration
Once you created a RSA key and got a key-id add django-satispaython to your INSTALLED_APPS:
INSTALLED_APPS = (
#...
'django_satispaython.apps.DjangoSatispaythonConfig',
#...
)
Then add the followings to you django settings:
SATISPAYTHON_PRIVATE_KEY_PATH = '/path/to/my/key.pem'
SATISPAYTHON_KEY_ID_PATH = '/path/to/my/key-id.txt'
SATISPAYTHON_STAGING = True
SATISPAYTHON_PRIVATE_KEY_PATH
: the path of your PEM file containing the RSA private key used to get your key-id.SATISPAYTHON_KEY_ID_PATH
: the path of the file containing the key-id coupled with the private-key.SATISPAYTHON_STAGING
: ifTrue
django-satispaython will use the Sandbox endpoints.
Satispay API
In order to use the Satispay API import django-satispaython.api:
from django_satispaython import api as satispay
Then you can:
-
Create a payment
satispay.create_payment(amount_unit, currency, callback_url, expiration_date=None, external_code=None, metadata=None, idempotency_key=None, update=False)
You may use satispaython utility function
format_datetime
to get a correctly formattedexpiration_date
to supply to the request. -
Get payment details
satisapy.get_payment_details(payment_id, update=False)
All these functions return an instance of the SatispayPayment model without actually saving it.
If you want to save a newly create payment in the database or update an already existing one with the informations provided by the response, set the update
parameter to True
.
In this case an output similar to django's update_or_create
will be returned.
TODOS
- Signals
- ImproperlyConfiguredException
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-satispaython-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfbe9e57c95dcbccea28803fb0deb6e46065f62dc3e381493d0c05e0e1ceadc8 |
|
MD5 | 2e9ecf88c3cd94a8e92123be2ef9df64 |
|
BLAKE2b-256 | 3726f9bf19b4e006546df2debc939cc064b746502a3888f9f8a980ab09d99d66 |
Hashes for django_satispaython-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54063ed11b655aed7e21a8529d6aaa5a3715e27acfebda27447c6ad69ad3fb83 |
|
MD5 | f297da3d4bdba4a44be29211cfee6271 |
|
BLAKE2b-256 | 0ca5098024264ca253b951e80043f5513776f0d31a816276c35a8782c223d216 |