Skip to main content

Python API client for the Alma Installments API

Project description

alma-python-client

Travis Build Status PyPI

Python API Client for the Alma API.

Support Python >= 3.8

Install

pip install alma-client

Demo

We support both a sync and async client.

Synchronous client

from alma_client 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_client 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

3.0.1 (2022-12-05)

  • Configure credentials later in the flow.

3.0.0 (2022-06-29)

Breaking change

  • Move the code from the alma namespace into the alma_client namespace.
  • Remove support for Python 3.6 and Python 3.7

2.0.2 (2022-06-22)

  • Fix potential-fraud method URLs (#27)

2.0.1 (2022-06-17)

  • Adds include_child_accounts and custom_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


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-3.0.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

alma_client-3.0.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file alma-client-3.0.1.tar.gz.

File metadata

  • Download URL: alma-client-3.0.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for alma-client-3.0.1.tar.gz
Algorithm Hash digest
SHA256 3ac1bfc3b8ea2802dd2037cba797a60878500c8f1eb92f81b435237484242671
MD5 3024dfc1a1795734147bde121dcc9a54
BLAKE2b-256 be0864d737e3ad3a1243f81e1957d7d8146007565559bc26a5946768f2ea72bb

See more details on using hashes here.

File details

Details for the file alma_client-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: alma_client-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for alma_client-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8d71aaa517d8bbf0c2d4f70b4ed26bb98289903a4932532c6371489ae269731
MD5 ba6f7f2eb6b4c1a9e0ce312d4170b350
BLAKE2b-256 c0e10b7e12b237c115965cdeafab0af30e0544a9084a08b34e0628417b4d2595

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page