Python SDK for the QvaPay API
Project description
Python SDK for the QvaPay API
Non official, but friendly QvaPay library for the Python language.
Setup
You can install this package by using the pip tool and installing:
pip install qvapay
Or
easy_install qvapay
Sign up on QvaPay
Create your account to process payments through QvaPay at qvapay.com/register.
Using the client
First, import the AsyncQvaPayClient
(or SyncQvaPayClient
) class and create your QvaPay asynchronous (or synchronous) client using your app credentials.
from qvapay.v1 import AsyncQvaPayClient
client = AsyncQvaPayClient(app_id, app_secret)
It is also possible to use the QvaPayAuth
class (which by default obtains its properties from environment variables or from the content of the .env
file) and the static method AsyncQvaPayClient.from_auth
(or SyncQvaPayClient.from_auth
) to initialize the client.
from qvapay.v1 import AsyncQvaPayClient, QvaPayAuth
client = AsyncQvaPayClient.from_auth(QvaPayAuth())
Use context manager
The recommended way to use a client is as a context manager. For example:
async with AsyncQvaPayClient(...) as client:
# Do anything you want
...
or
with SyncQvaPayClient(...) as client:
# Do anything you want
...
Get your app info
# Use await when using AsyncQvaPayClient
# With SyncQvaPayClient it is not necessary.
info = await client.get_info()
Get your account balance
# Use await when using AsyncQvaPayClient
# With SyncQvaPayClient it is not necessary.
balance = await client.get_balance()
Create an invoice
# Use await when using AsyncQvaPayClient
# With SyncQvaPayClient it is not necessary.
transaction = await client.create_invoice(
amount=10,
description='Ebook',
remote_id='EE-BOOk-123' # example remote invoice id
)
Get transaction
# Use await when using AsyncQvaPayClient
# With SyncQvaPayClient it is not necessary.
transaction = await client.get_transaction(id)
Get transactions
# Use await when using AsyncQvaPayClient
# With SyncQvaPayClient it is not necessary.
transactions = await client.get_transactions(page=1)
You can also read the QvaPay API documentation: qvapay.com/docs.
For developers
The _sync
folders were generated automatically executing the command unasync qvapay tests
.
The code that is added in the _async
folders is automatically transformed.
So every time to make a change you must run the command unasync qvapay tests
to regenerate the folders _sync
with the synchronous version of the implementation.
Improve tests
implementation and add pre-commit
system to ensure format and style.
Migration guide
0.2.0 -> 0.3.0
QvaPayClient
was divided into two classes:AsyncQvaPayClient
andSyncQvaPayClient
. Both classes have the same methods and properties, with the difference that the methods inAsyncQvaPayClient
are asynchronous and inSyncQvaPayClient
are synchronous.
0.1.0 -> 0.2.0
user_id
ofTransaction
model was removedpaid_by_user_id
ofTransaction
model was removed
0.0.3 -> 0.1.0
from qvapay.v1 import *
instead offrom qvapay import *
QvaPayClient
instead ofClient
client.get_info
instead ofclient.info
client.get_balance
instead ofclient.balance
client.get_transactions
instead ofclient.transactions
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Carlos Lugones 💻 |
Ozkar L. Garcell 💻 |
Leynier Gutiérrez González 💻 |
Jorge Alejandro Jimenez Luna 💻 |
Reinier Hernández 🐛 |
This project follows the all-contributors specification. Contributions of any kind welcome!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file qvapay-0.3.0.tar.gz
.
File metadata
- Download URL: qvapay-0.3.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b37fd563b73f644dffc5794afeb11560afefadb5d8301d5beedb36e8096b941d |
|
MD5 | d4c90fdaf71c7e84eda991ec226a3b6d |
|
BLAKE2b-256 | 0d4a9a45c9907c11e939eb39d08162c2893e4f9b9af722d9f652197d3374df7d |
File details
Details for the file qvapay-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: qvapay-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8682641f9d41a9aec4e2db6dc7521fa5d810169b8e2ae52acee0bbb7c2f01ee |
|
MD5 | 3250f0f7a27d1e033bec583fdc3db1bd |
|
BLAKE2b-256 | 2a6ff9bcd9648cd6b35d486166f01e6ab1d597a6f16e45cf063b34393a50fbd4 |