This library is deprecated. Please use Shift4 Python Library.
pip install securionpay
import securionpay as securionpay
securionpay.secret_key = 'pk_test_my_secret_key'
try:
customer = securionpay.customers.create({
'email': '[email protected]',
'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)
Please refer to detailed API docs (linked) for all available fields
- charges
- customers
- cards
- subscriptions
- plans
- events
- tokens
- blacklist
- checkoutRequest
- crossSaleOffers
- credits
- disputes
- fileUploads
- fraudWarnings
For further information, please refer to our official documentation at https://securionpay.com/docs.
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/