Skip to main content

UNOFFICIAL Airwallex Python SDK

A simple SDK for interacting with the Airwallex API.

Features

  • SOMEWHAT Comprehensive implementation of the Airwallex API
  • Both synchronous and asynchronous client support
  • Automatic authentication and token refresh
  • Built-in rate limiting and retry logic
  • Type checking with Pydantic models

Installation

pip install airwallex-sdk

Quick Start

Payments API

Synchronous Usage

from airwallex import AirwallexClient
from airwallex.models.payment import PaymentCreateRequest, PaymentAmount

# Initialize the client
client = AirwallexClient(
    client_id="your_client_id",
    api_key="your_api_key"
)

# List accounts
accounts = client.accounts.list()
for account in accounts:
    print(f"Account: {account.account_name} ({account.id})")

# Fetch a specific account
account = client.accounts.fetch("account_id")
print(account.show())  # Print a formatted representation

# Create a payment
payment_request = PaymentCreateRequest(
    request_id="unique_request_id",
    amount=PaymentAmount(value=100.00, currency="USD"),
    source={
        "type": "account",
        "account_id": "account_id"
    },
    beneficiary={
        "type": "bank_account",
        "id": "beneficiary_id"
    },
    payment_method="swift"
)

payment = client.payments.create_from_model(payment_request)
print(f"Payment created with ID: {payment.id}")

# Use generator to iterate through all payments
for payment in client.payments():
    print(f"Payment {payment.id}: {payment.amount.value} {payment.amount.currency}")

Asynchronous Usage

import asyncio
from airwallex import AirwallexAsyncClient
from airwallex.models.beneficiary import BeneficiaryCreateRequest, BankDetails

async def main():
    # Initialize the async client
    client = AirwallexAsyncClient(
        client_id="your_client_id",
        api_key="your_api_key"
    )
    
    # List accounts
    accounts = await client.accounts.list_async()
    
    # Create a beneficiary
    beneficiary_request = BeneficiaryCreateRequest(
        name="John Doe",
        type="bank_account",
        bank_details=BankDetails(
            account_name="John Doe",
            account_number="123456789",
            swift_code="ABCDEFGH",
            bank_country_code="US"
        )
    )
    
    beneficiary = await client.beneficiaries.create_from_model_async(beneficiary_request)
    print(f"Beneficiary created with ID: {beneficiary.id}")
    
    # Async generator to iterate through all beneficiaries
    async for ben in client.beneficiaries.paginate_async_generator():
        print(f"Beneficiary: {ben.name}")
    
    await client.close()

# Run the async function
asyncio.run(main())

Issuing API

Working with Cardholders and Cards

from airwallex import AirwallexClient
from airwallex.models.issuing_cardholder import CardholderCreateRequest, Individual, Name, Address
from airwallex.models.issuing_card import CardCreateRequest, AuthorizationControls, CardProgram

# Initialize the client
client = AirwallexClient(
    client_id="your_client_id",
    api_key="your_api_key"
)

# Create a cardholder
cardholder_request = CardholderCreateRequest(
    email="john.doe@example.com",
    individual=Individual(
        name=Name(
            first_name="John",
            last_name="Doe",
            title="Mr"
        ),
        date_of_birth="1982-11-02",
        address=Address(
            city="Melbourne",
            country="AU",
            line1="44 Example St",
            postcode="3121",
            state="VIC"
        ),
        cardholder_agreement_terms_consent_obtained="yes",
        express_consent_obtained="yes"
    ),
    type="INDIVIDUAL"
)

cardholder = client.issuing_cardholder.create_cardholder(cardholder_request)
print(f"Cardholder created with ID: {cardholder.cardholder_id}")

# Create a virtual card
card_request = CardCreateRequest(
    cardholder_id=cardholder.cardholder_id,
    request_id="unique-request-id",
    created_by="API User",
    form_factor="VIRTUAL",
    is_personalized=True,
    authorization_controls=AuthorizationControls(
        allowed_currencies=["USD", "AUD"],
        allowed_transaction_count="MULTIPLE"
    ),
    program=CardProgram(
        id="your_program_id",
        name="Default Program"
    )
)

card = client.issuing_card.create_card(card_request)
print(f"Card created with ID: {card.card_id}")

# Get card details
card_details = client.issuing_card.get_card_details(card.card_id)
print(f"Card Number: {card_details.card_number}")
print(f"CVV: {card_details.cvv}")
print(f"Expiry: {card_details.expiry_month}/{card_details.expiry_year}")

Documentation

For detailed documentation, see https://www.airwallex.com/docs/api.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for airwallex-sdk 0.1.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 airwallex-sdk 0.1.1
File Size Uploaded Provenance Actions
airwallex_sdk-0.1.1.tar.gz 35.1 kB Without provenance Details for airwallex_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for airwallex-sdk 0.1.1
File Interpreter ABI Platform Actions
airwallex_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for airwallex_sdk-0.1.1-py3-none-any.whl

Total release size: 87.5 kB

Release files / airwallex_sdk-0.1.1.tar.gz

Download URL airwallex_sdk-0.1.1.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc9a362a69525657b39e6af9be4f2dfe437b013d9e586eee54e74529b292b2c2
BLAKE2b-256 checksum
How to use checksums
bb9bb974759271f17a02224420caccaa222f357b921c644c01561425dccda963
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Linux/5.15.167.4-microsoft-standard-WSL2

Release files / airwallex_sdk-0.1.1-py3-none-any.whl

Download URL airwallex_sdk-0.1.1-py3-none-any.whl
Size 52.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
677dc9b09a1691f815af6250ebcef9aa20e868935d940d8cd58e27a695303209
BLAKE2b-256 checksum
How to use checksums
199c260058c2d300ec765f6de5c65dcc3bf26db939e7272a7f5eb90ef911ed40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Linux/5.15.167.4-microsoft-standard-WSL2

Security for airwallex-sdk 0.1.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.1.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