Skip to main content
Help us improve Python packaging – donate today!

Python library for implementing Omnikassa

Project Description

Omnikassa

https://travis-ci.org/RobWouters/omnikassa.png?branch=master

Python library for implementing Omnikassa.

Generating payment request

from omnikassa import Omnikassa
from omnikassa.constants import Currency

settings = {
    'currencyCode': Currency.EURO,  # Default value, can be overriden per request
    'automaticResponseUrl': 'https://example.com/callback',
    'normalReturnUrl': 'https://example.com/omnikassa',
    'merchantId': '0123456789',
}
secret = 'secret key'  # set this to None to use test environment

omnikassa = Omnikassa(settings, secret)
data = omnikassa.generate_request({
    'transactionReference': 'transaction123',  # unique reference
    'amount': 456,  # in cents
    'orderId': 123,  # optional
})

data contains relevant info to create a form:

<form action="${url}" method="post" id="form">
    <input type="hidden" name="Seal" value="${seal}">
    <input type="hidden" name="InterfaceVersion" value="${version}">
    <input type="hidden" name="Data" value="${data}">
    <button type="submit">
        Start payment
    </button>
</form>

Handling return

from omnikassa import Omnikassa
from omnikassa.constants import Currency

settings = {
    'currencyCode': Currency.EURO,
    'automaticResponseUrl': 'https://example.com/callback',
    'normalReturnUrl': 'https://example.com/omnikassa',
    'merchantId': '0123456789',
}
secret = 'secret key'

omnikassa = Omnikassa(settings, secret)
try:
    data = omnikassa.verify_callback(request.POST)
except InvalidSeal:
    ...
except InvalidResponseCode as exc:
    # `exc.data` contains responseData
    ...

# `data` is a dict of validated omnikassa data

Release history Release notifications

This version
History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
omnikassa-0.0.4.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None Oct 22, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page