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)
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)
:information_source: All these functions return an instance of the SatispayPayment model without actually saving it.
If you want to save a newly created payment in the database or update an already existing one with the informations provided by the response, set the update
parameter to True
.
satispay.create_payment(amount_unit, currency, callback_url, expiration_date=None, external_code=None, metadata=None, idempotency_key=None, update=False)
satisapy.get_payment_details(payment_id, update=False)
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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3057b16ac610cdef0312659f7b34e6ff7e39f5f86af25a5f77139707a966cfa5 |
|
MD5 | 47f67bd2c1f2a7266769007beb08c82b |
|
BLAKE2b-256 | 356612097355e5fc70586500ef433596773acdf2fed27edbcc7996a640c2b49b |
Hashes for django_satispaython-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cce8d1df256b6fb6f16bdafd9b760433305b7e15d2ea6d523f3bdd4de71ee4a |
|
MD5 | 7ccf25942201dcca650ca354d616eb5b |
|
BLAKE2b-256 | 1b3e8f430d43fcbd195ecb617292fc3b7df55efac4f0cd861453ff9605907fe4 |