This is an unofficial Python SDK for AltaPay (formerly Pensio), https://altapay.com/. The SDK is maintained by Coolshop.com, https://www.coolshop.com/.
- Python (2.7, 3.3, 3.4, 3.5)
Other versions of Python may also be supported, but these are the only versions we test against.
The easiest way is using pip.
pip install altapay
Currently, this library only implements the bare minimum of the AltaPay API. It will allow you to create payment links, and do basic subscription functionality. If you need anything else, feel free to submit a full request, or if you have ideas, open an issue.
If you do decide to submit a pull request, do note that both isort and flake8 (including pep8-naming) are run for all pull requests. You are also advised to write test cases.
Running the Tests
First of all, have tox installed on your system. System-wide is probably the better choice. Once you have tox installed, simply run:
This will run all tests, against all supported Python versions.
- Fixed a bug where parsing the values “nan”, “inf” or “-inf” would lead to a float value, when handling XML values. While this could potentially be correct, it’s safer to assume that these values are in fact string values
- Added altapay.FundingList and altapay.Funding. These two objects will interact with the funding list features of AltaPay, and will allow you to both list all of your funding files, as well as download individual files. Currently no guide section is written on the subject, but full API documentation is available
- Added altapay.CustomReport which mimics the custom reporting module of AltaPay. Using a custom report ID and additional kwargs based on the report, you can either view or download your custom reports
- Previously, all calls would use an HTTP GET, since the AltaPay documentation in some cases suggests that this is the case. This works, however, it breaks when payments start to contain many order lines. Because of this, all calls have been changed to HTTP POST, which is the recommended way of communicating with the AltaPay API.
- Backwards incompatible altapay.Transaction.capture() will now return an altapay.Callback object instead of a altapay.Transaction object
First Production Release
- Addded altapay.Transaction.release()
- Backwards incompatible Moved altapay.Transaction.create_invoice_reservation() to altapay.Callback.create_invoice_reservation(). The method will now return a altapay.Callback object in order to read the result key (#41)
- Added altapay.Transaction.create_invoice_reservation()
- Backwards incompatible Changed the name of altapay.Transaction.reserve() to altapay.Transaction.reserve_subscription_charge()
- Added altapay.Transaction.reserve() which will reserve an amount on a subscription
- Backwards incompatible Changed the return type of altapay.Transaction.charge_subscription(). It will not return a altapay.Callback object instead of a list of transactions
- Backwards incompatible Changed the argument of altapay.Callback.transactions() to be keyword only. Will now accept any number of filters, and these will be matched using AND logic
- Added altapay.Transaction.charge_subscription() which will charge a subscription on a transaction, if this transaction is setup as a subscription
- Fixed a bug where looking up a non-existent transaction ID would result in a KeyError (#32)
- Added missing apostrophe’s in the documentation for the callback guide (#24)
- Fixed a bug where filtering transactions on a altapay.Callback object might result in a KeyError (#25)
- Made it more explicit how attributes on response objects work (#26)
- Added altapay.Transaction and the ability to find a transaction by its transaction ID in the AltaPay service
- Added altapay.Transaction.capture() which captures a transaction that has already been loaded. Optinally, parameters can be passed which allows for partial captures (see the AltaPay documentation for full list of possible arguments)
- Added a public facing API for converting an AltaPay XML response (as a string) to a Python dictionary (altapay.utils.xml_to_dict)
- Added altapay.Callback which wraps a callback response from AltaPay, and automatically wraps the coupled transactions in altapay.Transaction objects
- Fixed a bug where specifying a non-existing terminal while creating an altapay.Payment object would result in altapay.Payment.success returning True
- Fixed a bug where running in production mode was not possible. It is now possible by specifying a shop name when instantiating the API
- Complex payments are now possible. This means it is now possible to send detailed payment information in a Pythonic way using just lists and dictionaries, instead of the PHP style query params syntax
- Documentation now includes a small guide for available parts of the SDK, which will make is easier to get started easily without reading the raw API documentation
- Basic API connection class implemented in altapay.api.API
- Basic Payment class implemented in altapay.payment.Payment which is currently mainly for creating a very basic payment request with the AltaPay service
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.