Vipps Python Library
The Unofficial* Vipps Python library provides convenient access to the Vipps AS API from applications written in the Python language.
Currently Supports:
Documentation
See the Vipps Developers resources
Installation
pip install vipps
Requirements
Test on Python3.7
- Python 3.7
- requests 2+
Usage
Vipps eCommerce API version 2. Initiate payment and get redirect Url:
from vipps import VippsEcomApi
payment = VippsEcomApi(
client_id="fb492b5e-7907-4d83-ba20-c7fb60ca35de",
client_secret="Y8Kteew6GE2ZmeycEt6egg==",
vipps_subscription_key="0f14ebcab0ec4b29ae0cb90d91b4a84a",
merchant_serial_number="123456",
vipps_server="https://apitest.vipps.no",
callback_prefix="https://example.com/vipps/callbacks-for-payment-updates"
fall_back="https://example.com/vipps/fallback-order-result-page/acme-shop-123-order123abc"
)
# Initiate payment
initiate = payment.init_payment(
order_id="acme-shop-123-order123abc",
amount=200,
transaction_text="One pair of Vipps socks",
)
# Redirect Url
redirect_url = initiate.get("url")
# Capture Payment
capture = payment.capture_payment(
order_id="acme-shop-123-order123abc",
amount=200,
transaction_text="One pair of Vipps socks",
)
# Cancel Payment
cancel = payment.cancel_payment(
order_id="acme-shop-123-order123abc",
transaction_text="One pair of Vipps socks",
)
# Refund Payment
refund = payment.refund_payment(
order_id="acme-shop-123-order123abc",
amount=200,
transaction_text="One pair of Vipps socks",
)
# Payment details
details = payment.details_payment(
order_id="acme-shop-123-order123abc"
)
*Unofficial
I am not affiliate or associate of the Vipps AS in any possible way. Used publicly available info to build this software.
Create PyPI package
- Docs:
- packaging.python.org
- I'l do it in docker:
touch Dockerfilenano Dockerfile# Dockerfile FROM python:latest RUN apt update ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 RUN pip install --upgrade pip
docker build -t ipy .docker run -it -v ${PWD}:/home --name py ipy bash
- Setup:
mkdir /home/vipps-pythoncd /home/vipps-pythonmkdir vippsmkdir teststouch vipps/__init__.pytouch LICENSEtouch README.mdtouch pyproject.tomltouch setup.cfgtouch setup.pynano pyproject.toml# pyproject.toml [build-system] requires = [ "setuptools>=42", "wheel" ] build-backend = "setuptools.build_meta"
nano setup.cfg# setup.cfg [metadata] name = vipps version = 0.3 author = Almaz Kunpeissov author_email = hi@akun.dev description = Python bindings for the Vipps API long_description = file: README.md long_description_content_type = text/markdown url = https://github.com/almazkun/vipps-python keywords = vipps api payments license = MIT License license_files = LICENSE project_urls = Documentation = https://github.com/almazkun/vipps-python Source = https://github.com/almazkun/vipps-python Tracker = https://github.com/almazkun/vipps-python/issues classifiers = Development Status :: 2 - Pre-Alpha Intended Audience :: Developers Operating System :: OS Independent Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3.7 Programming Language :: Python :: Implementation :: PyPy Topic :: Software Development :: Libraries :: Python Modules [options] packages = find: python_requires = >=3.7 include_package_data = true zip_safe = false install_requires = requests >= 2 [options.packages.find] exclude = tests tests.*
nano setup.pyfrom setuptools import setup setup()
- Creating distribution archives
python3 -m pip install --upgrade buildpython3 -m build
- Upload to Test.PyPI:
python3 -m pip install --user --upgrade twinepython3 -m twine upload --repository testpypi dist/*- username: token, password: your test PyPI token
curl https://test.pypi.org/project/vipps/0.1/
- Installing package:
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps vippspython3import vipps
- Upload to the PyPI:
python3 -m twine upload dist/*- username: token, password: your PyPI token
Metadata
Release files for vipps 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vipps-0.1.tar.gz | 7.2 kB | Without provenance | Details for vipps-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vipps-0.1-py3-none-any.whl | Python 3 | none | any | Details for vipps-0.1-py3-none-any.whl |
Total release size: 13.4 kB
Release files / vipps-0.1.tar.gz
| Download URL | vipps-0.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ab738c70337fd1f352fdf5e505f818722d002ca680a443c3101cbd2ca98ffe9
|
|
BLAKE2b-256 checksum How to use checksums |
590f9f863eb0b9a218233e6892a82ed623a0ca2a6d5ba5c2cfa48be597760241
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / vipps-0.1-py3-none-any.whl
| Download URL | vipps-0.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c03434e37652ddc2f0fac46d5fb2edf00c83a098e7a64defd37c44cf235361fe
|
|
BLAKE2b-256 checksum How to use checksums |
091b2bdaa415d9c3b6d21e58cdc0df73466acb15096572e97b245e3f67e28019
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Security for vipps 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.