Skip to main content

ALATPay SDK (Python)

Downloads Downloads Downloads

A Python client SDK for integrating with the ALATPay API.

Features

  • Fully Typed.
  • Automatic payload, queries and response data case transformation.
  • Pydantic for payload and response data modeling.
  • Custom response data model injection.
  • Synchronous and Asynchronous clients

Installation

Requires Python version >=3.11

With uv

uv add alatpay-sdk

With pip

pip install alatpay-sdk

Usage

# You may provide your credentials through environment variables.
# The client automatically loads the following variables:
#
# ALATPAY_SECRET_KEY=""            # Required
# ALATPAY_BUSINESS_ID=""           # Optional. If omitted, methods that require
#                                  #   a business ID will require one explicitly.
# ALATPAY_WEBHOOK_SECRET_KEY=""    # Optional
# ALATPAY_PUBLIC_KEY=""            # Optional
#
# Credentials passed to the client on instantiation take precedence over
# environment variables.

from alatpay_sdk import ALATPayClient, AsyncALATPayClient, PayViaVirtualAccountPayload
from uuid import uuid4

# Instantiate the client
# Credentials may be passed directly if they are not available
# in the environment.
# May raise `MissingCredentialError` if no credentials was passed in 
# on instantiation or found in the environmental variables.
client = ALATPayClient()
# In a async context, you may use the async client
aclient = AsyncALATPayClient()

# Now we create a payload for a debit request via a virtual account.
payload = PayViaVirtualAccountPayload.model_validate(
            {
                "amount": 100,
                "order_id": str(uuid4()),
                "description": "test payin",
                "customer": {
                    "email": "johndoe@example.com",
                    "phone": "08012345678",
                    "first_name": "John",
                    "last_name": "Doe",
                },
            }
        )
# NOTE: Payloads are all pydantic models and you may choose to instantiate it 
#   however you please. They follow a naming convention of converting the method 
#   they are for into PascalCase and appending a `Payload` to it.

# Now we call our client method designated for requesting a debit via a virtual account
# with our payload. (Calling a client method that makes a request, may raise 
# `ClientError` You need to handle this.)
response = client.pay_via_virtual_aaccount(payload)
# If you're using the async clients, the method names remain the same, they just need 
# to be awaited (This only works in a async context ).
response = await aclient.pay_via_virtual_aaccount(payload)

# Use the response data in your application
print(response)
# NOTE: response are pydantic models of type APIResponse[T] where T is the type of the 
# `data` field. The response also includes fields like `status`, `message` and `raw`
# which is the exact response data gotten from ALATPay without any transformation.
# It's also worth noting that you may pass a custom response model while calling
# the client method via the `response_model_class` parameter, for the most part,
# you'll only need to change the `T` of the `APIResponse` e.g if i have 
# `MyCustomResponseData`, then `response_model_class=APIResponse[MyCustomResponseData]`.
# When the client is unable to serialize the data returned by ALATPay, it sets the `data`
# field to `None`, the original data is still present in the `raw` field.

Issues and Contributions

If you discover bugs, missing endpoints, incorrect typings, or any other issues, please open an issue or submit a pull request. Contributions are welcome.

Metadata

Release files for alatpay-sdk 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alatpay-sdk 0.0.1
File Size Uploaded Provenance
alatpay_sdk-0.0.1.tar.gz 12.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for alatpay-sdk 0.0.1
File Interpreter ABI Platform
alatpay_sdk-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / alatpay_sdk-0.0.1.tar.gz

Download URL alatpay_sdk-0.0.1.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2f242b3f951f890badde13ac035a9ad20e25d9ffe13ca24b4a4ef76e913b8fe4
BLAKE2b-256 checksum
How to use checksums
2cca9aa8bc2beca48f0c25b04db4d477f9f7710258894d8052c8af8790263bd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / alatpay_sdk-0.0.1-py3-none-any.whl

Download URL alatpay_sdk-0.0.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f745c20b597b0ad788a02c4940dead3ce029c71db6d24967382d054b9246d2f4
BLAKE2b-256 checksum
How to use checksums
050f99c93fd7f3bb1f13eafa857942db1c10a39115340d6c2df03bb7ed7f160f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for alatpay-sdk 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page