Python API client for the Alma Installments API
Project description
alma-python-client
Python API Client for the Alma API
Install
pip install alma-client
Demo
We support both a sync and async client.
Synchronous client
from alma import Client
alma_client = Client.with_api_key("sk_test..")
payments = alma_client.payments.fetch_all()
for p in payments:
print(f"{p.id}: Paiement en {len(p.payment_plan)} fois")
payment_data = {
"payment": {
"purchase_amount": 10000,
"return_url": "http://merchant.com/payment-success",
"shipping_address": {
"first_name": "Martin",
"last_name": "Dupond",
"line1": "1 rue de Rivoli",
"postal_code": "75004",
"city": "Paris"
}
}
}
eligibility = alma_client.payments.eligibility(payment_data)
if eligibility.eligible:
payment = alma_client.payments.create(payment_data)
print(payment.raw_data)
Asynchronous client
from alma import AsyncClient
alma_client = AsyncClient.with_api_key("sk_test..")
payments = await alma_client.payments.fetch_all()
for p in payments:
print(f"{p.id}: Paiement en {len(p.payment_plan)} fois")
payment_data = {
"payment": {
"purchase_amount": 10000,
"return_url": "http://merchant.com/payment-success",
"shipping_address": {
"first_name": "Martin",
"last_name": "Dupond",
"line1": "1 rue de Rivoli",
"postal_code": "75004",
"city": "Paris"
}
}
}
eligibility = await alma_client.payments.eligibility(payment_data)
if eligibility.eligible:
payment = await alma_client.payments.create(payment_data)
print(payment.raw_data)
Changelog
2.0.2 (2022-06-22)
- Fix
potential-fraud
method URLs (#27)
2.0.1 (2022-06-17)
- Adds
include_child_accounts
andcustom_fields
params to the DataExport creation endpoint
2.0.0 (2021-08-12)
Breaking changes
- Move from requests to HTTPX
- Handle both sync and async python clients
- Remove support for Python 3.5
- Add support for Python 3.9
1.2.0 (2020-09-01)
- Add support for different authentication methods
- Add Black & isort checks on pull requests
1.1.0 (2020-03-25)
- Add support for Python 3.5+
1.0.1 (2020-03-24)
- Automatically detects the API mode from the api_key.
1.0.0 (2020-03-24)
- Create a Python client for Alma
- Handle Order entity for Payment
- Handle the refund endpoint
- Handle pagination for orders
- Handle the send-sms API for payments.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
alma-client-2.0.2.tar.gz
(15.6 kB
view hashes)
Built Distribution
Close
Hashes for alma_client-2.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f0fcc1e7a5b9bb0db957a4004168c3187937bb626daab35d48e9e5cbdc15358 |
|
MD5 | 1b3caed0823dbda613ca2417357be2a3 |
|
BLAKE2b-256 | 8f0a4396f8e1ac0ee7f2cd0e7f92ab5691e46f1880b547f5c99e5b118e3db4f0 |