securionpay

Python library for SecurionPay API


Keywords
payment
License
MIT
Install
pip install securionpay==2.1.0

Documentation

Python library for SecurionPay API

Build

Installation

pip install securionpay

Quick start

import securionpay as securionpay

securionpay.secret_key = 'pk_test_my_secret_key'

try:
    customer = securionpay.customers.create({
        'email': 'user@example.com',
        'description': 'User description'
    })
    print("Created customer:", customer)
    card = securionpay.cards.create(customer['id'], {
        'number': '4242424242424242',
        'expMonth': '12',
        'expYear': '2023',
        'cvc': '123',
        'cardholderName': 'John Smith'
    })
    print("Created card:", card)
    charge = securionpay.charges.create({
      'amount': 1000,
      'currency': 'EUR',
      'customerId': card['customerId']
    })
    print("Created charge:", charge)
except securionpay.SecurionPayException as e:
  print(e)

API reference

Please refer to detailed API docs (linked) for all available fields

For further information, please refer to our official documentation at https://securionpay.com/docs.

Developing

Optionally setup a virtual environment

python -m venv ./venv --clear
source ./venv/bin/activate 

Install the package dependencies:

pip install -r requirements.txt -r test_requirements.txt

To connect to different backend:

import securionpay as api

api.secret_key = 'pk_test_my_secret_key'
api.api_url = 'https://api.mysecurionenv.com'
api.uploads_url = 'https://uploads.mysecurionenv.com'

To run tests:

SECRET_KEY=pk_test_my_secret_key pytest tests

Format the package files using black:

black setup.py securionpay/ tests/