Python SDK for the QvaPay API
Project description
Python SDK for the QvaPay API
Non official, but friendly QvaPay library for the Python language.
Installation
pip install qvapay
Or with uv:
uv add qvapay
Sign up on QvaPay
Create your account to process payments through QvaPay at qvapay.com/register.
Quick start
The SDK provides two types of clients:
- User clients (
AsyncQvaPayClient/SyncQvaPayClient) — Bearer-token authenticated, for user-level operations. - Merchant clients (
AsyncQvaPayMerchant/SyncQvaPayMerchant) — UUID + secret key authenticated, for app-level operations like invoicing.
Authentication
Use the standalone auth module to obtain an access token:
from qvapay import auth
# Async
token = await auth.login("email@example.com", "password")
print(token.access_token)
For the sync equivalent:
from qvapay._sync import auth
token = auth.login("email@example.com", "password")
The auth module also provides register, request_pin, check, and logout functions.
User client
Create a client with the access token obtained from login:
from qvapay import AsyncQvaPayClient
async with AsyncQvaPayClient(access_token="your-token") as client:
profile = await client.user.me()
print(profile.username)
Or synchronously:
from qvapay import SyncQvaPayClient
with SyncQvaPayClient(access_token="your-token") as client:
profile = client.user.me()
print(profile.username)
Merchant client
For app-level operations, use the merchant client with your app UUID and secret key (get these at qvapay.com/apps/create):
from qvapay import AsyncQvaPayMerchant
async with AsyncQvaPayMerchant(uuid="app-uuid", secret_key="app-secret") as merchant:
invoice = await merchant.create_invoice(
amount=10.00,
description="Ebook",
remote_id="EE-BOOK-123",
)
print(invoice.url)
User client modules
The user client organizes functionality into modules accessed as attributes:
Transactions (client.transactions)
# List recent transactions (with optional filters)
transactions = await client.transactions.list(
start="2024-01-01",
end="2024-12-31",
status="completed",
)
# Get a specific transaction
detail = await client.transactions.get("transaction-uuid")
# Transfer balance to another user (by UUID, email, or phone)
tx = await client.transactions.transfer(
to="user@email.com",
amount=5.00,
description="Payment for services",
)
# Pay a pending transaction
tx = await client.transactions.pay("transaction-uuid", pin="1234")
# Download transaction PDF
pdf_bytes = await client.transactions.get_pdf("transaction-uuid")
User profile (client.user)
profile = await client.user.me()
extended = await client.user.me_extended()
# Update profile
await client.user.update(bio="Hello world")
await client.user.update_username("new_username")
# Search users
users = await client.user.search("john")
# KYC verification
status = await client.user.kyc_status()
# Sub-modules
contacts = await client.user.contacts.list()
methods = await client.user.payment_methods.list()
domains = await client.user.domains.check("example.com")
Apps (client.app)
apps = await client.app.list()
app = await client.app.get("app-uuid")
new_app = await client.app.create(
name="My App",
url="https://example.com",
desc="My QvaPay app",
callback="https://example.com/callback",
)
P2P trading (client.p2p)
offers = await client.p2p.get_offers(coin="USDT", type="buy")
offer = await client.p2p.create_offer(coin="USDT", amount=100, price=1.05, type="sell")
# Chat
messages = await client.p2p.chat.get("offer-uuid")
await client.p2p.chat.send("offer-uuid", "Hello!")
# Trade flow
await client.p2p.apply("offer-uuid")
await client.p2p.mark_paid("offer-uuid")
await client.p2p.confirm_received("offer-uuid")
Withdrawals (client.withdraw)
withdrawal = await client.withdraw.create(
pay_method="USDT",
amount=50.00,
details={"address": "0x..."},
)
withdrawals = await client.withdraw.list()
Payment links (client.payment_links)
links = await client.payment_links.list()
link = await client.payment_links.create(
name="Donation",
product_id="product-uuid",
amount=5.00,
)
Store (client.store)
products = await client.store.products()
purchased = await client.store.my_purchased()
# Sub-modules
packages = await client.store.phone_package.list()
cards = await client.store.gift_card.catalog()
Top-up (client.topup)
packages = await client.topup.list_products()
Merchant client methods
async with AsyncQvaPayMerchant(uuid="app-uuid", secret_key="secret") as merchant:
# App info and balance
info = await merchant.info()
balance = await merchant.balance()
# Invoicing
invoice = await merchant.create_invoice(
amount=25.00,
description="Premium Plan",
remote_id="INV-001",
signed=True,
)
await merchant.modify_invoice("invoice-uuid", amount=30.00)
# Transactions
txs = await merchant.get_transactions()
status = await merchant.get_transaction_status("tx-uuid")
# Payment authorization
auth_url = await merchant.get_payments_authorization(redirect_url="https://...")
await merchant.charge_user(token="auth-token", amount=10.00)
Standalone modules
Coins
from qvapay import coins
categories = await coins.list()
operational = await coins.list_v2(enabled_in=True)
coin = await coins.get(coin_id=1)
history = await coins.price_history("BTC", timeframe="7D")
Stocks
from qvapay import stocks
data = await stocks.list()
Error handling
All API errors raise QvaPayError:
from qvapay import QvaPayError
try:
await client.transactions.transfer(to="user@email.com", amount=1000)
except QvaPayError as e:
print(e.status_code, e.status_message)
For developers
Setup
git clone https://github.com/ragnarok22/qvapay-python.git
cd qvapay-python
make install # or: uv sync
Commands
make tests— run linting and tests with coveragemake coverage— tests with terminal coverage reportmake format— auto-format with ruffmake lint— check formatting without modifying files
Migration guide
0.3.0 -> 0.9.0
- Imports moved from
qvapay.v1toqvapay(e.g.,from qvapay import AsyncQvaPayClient) - Client methods are now organized into modules:
client.transactions.list()instead ofclient.get_transactions() - New
AsyncQvaPayMerchant/SyncQvaPayMerchantfor app-level operations (invoicing, balance) - Standalone
auth,coins, andstocksmodules replace the oldQvaPayAuthhelper - Client constructor takes
access_tokeninstead ofapp_id/app_secret
0.2.0 -> 0.3.0
QvaPayClientwas divided into two classes:AsyncQvaPayClientandSyncQvaPayClient. Both classes have the same methods and properties, with the difference that the methods inAsyncQvaPayClientare asynchronous and inSyncQvaPayClientare synchronous.
0.1.0 -> 0.2.0
user_idofTransactionmodel was removedpaid_by_user_idofTransactionmodel was removed
0.0.3 -> 0.1.0
from qvapay.v1 import *instead offrom qvapay import *QvaPayClientinstead ofClientclient.get_infoinstead ofclient.infoclient.get_balanceinstead ofclient.balanceclient.get_transactionsinstead 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qvapay-0.9.0.tar.gz.
File metadata
- Download URL: qvapay-0.9.0.tar.gz
- Upload date:
- Size: 95.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff8a64207dfc8ec16360f88a8ecfe531aa9fdd3db10084d249059829f726a817
|
|
| MD5 |
16401f3ffca78a066707715f70fe092a
|
|
| BLAKE2b-256 |
aaca2accd87d2bf2704f5cfa9a067483ab071f54f1de1512f69c181ca4313e7b
|
Provenance
The following attestation bundles were made for qvapay-0.9.0.tar.gz:
Publisher:
publish.yml on ragnarok22/qvapay-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qvapay-0.9.0.tar.gz -
Subject digest:
ff8a64207dfc8ec16360f88a8ecfe531aa9fdd3db10084d249059829f726a817 - Sigstore transparency entry: 1602776939
- Sigstore integration time:
-
Permalink:
ragnarok22/qvapay-python@1d5a81fffb9f77ba950e8a562a360bb5152ce565 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/ragnarok22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d5a81fffb9f77ba950e8a562a360bb5152ce565 -
Trigger Event:
push
-
Statement type:
File details
Details for the file qvapay-0.9.0-py3-none-any.whl.
File metadata
- Download URL: qvapay-0.9.0-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa95fc5be45f19c5726c3a69103913c07b3bc9ed9492803cfee53dde87f6d1e6
|
|
| MD5 |
f7d0208155fc35568242db94577899b0
|
|
| BLAKE2b-256 |
27fa0c0dd29877ccd51e0997c558de449adf682771ec1771b03eb24030f19a15
|
Provenance
The following attestation bundles were made for qvapay-0.9.0-py3-none-any.whl:
Publisher:
publish.yml on ragnarok22/qvapay-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qvapay-0.9.0-py3-none-any.whl -
Subject digest:
fa95fc5be45f19c5726c3a69103913c07b3bc9ed9492803cfee53dde87f6d1e6 - Sigstore transparency entry: 1602777078
- Sigstore integration time:
-
Permalink:
ragnarok22/qvapay-python@1d5a81fffb9f77ba950e8a562a360bb5152ce565 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/ragnarok22
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1d5a81fffb9f77ba950e8a562a360bb5152ce565 -
Trigger Event:
push
-
Statement type: