Skip to main content

Python SDK to interact with AbacatePay's API

Project description

AbacatePay SDK

PyPI Version PyPI Downloads

A Python SDK to simplify interactions with the AbacatePay API.
This SDK provides tools for billing management, customer handling, and more.

English | Português


Table of Contents


Installation

Using pip

pip install abacatepay

Using Poetry

poetry add abacatepay

Getting Started

To use the SDK, import it and initialize the client with your API key:

import abacatepay

client = abacatepay.AbacatePay("<your-api-key>")

Usage Examples

Create a Billing

from abacatepay.products import Product


products = [
    Product(
        external_id="123",
        name="Test Product",
        quantity=1,
        price=50_00,
        description="Example product"
    ),
    # or as dict
    {
        'external_id': "321",
        'name': "Product as dict",
        'quantity': 1,
        'price': 10_00,
        'description': "Example using dict"
    }
]

billing = client.billing.create(
    products=products,
    return_url="https://yourwebsite.com/return",
    completion_url="https://yourwebsite.com/complete"
)

print(billing.data.url)

List All Billings

billings = client.billing.list()
for billing in billings:
    print(billing.id, billing.status)

print(len(billings))

Customer Management

from abacatepay.customers import CustomerMetadata

customer = CustomerMetadata(  # Its can also be only a dict
    email="customer@example.com",
    name="Customer Name",
    cellphone="(12) 3456-7890",
    tax_id="123-456-789-10"
)

created_customer = client.customers.create(customer)
print(created_customer.id)

Contributing

We welcome contributions to the AbacatePay SDK! Follow the steps below to get started:

  1. Fork the repository on GitHub.

  2. Clone your fork locally:

    git clone https://github.com/your-username/abacatepay.git
    cd abacatepay
    
  3. Set up the virtual environment using poetry:

If you don't have poetry installed, you can install following the instructions here.

poetry install
  1. Make your changes in a new branch:

    git checkout -b feature-name
    
  2. Run tests to ensure your changes don’t break existing functionality:

    poetry run pytest
    
  3. Commit your changes and push the branch:

    git add .
    git commit -m "Add feature or fix description"
    git push origin feature-name
    
  4. Open a pull request on GitHub and describe your changes.

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

abacatepay-1.0.4.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abacatepay-1.0.4-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file abacatepay-1.0.4.tar.gz.

File metadata

  • Download URL: abacatepay-1.0.4.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for abacatepay-1.0.4.tar.gz
Algorithm Hash digest
SHA256 258f126be6d9d74a485d0d334b635c06a0bd82dfa5058be812dad7e22f54eca3
MD5 e0338f671bbbe7588e6f27033fdaf879
BLAKE2b-256 ba6f6b51b01f39b61a7e35bc78c8e6abf980deb179fb8d3dbdbc63e9d7e70a9e

See more details on using hashes here.

File details

Details for the file abacatepay-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: abacatepay-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for abacatepay-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 96063e06b2f73d4a2c75440356991cd86ba19628cfc612b122a777e4e0fe788a
MD5 ce5f28ec04947df88af7faff22ecfb5b
BLAKE2b-256 ad826adc994dafe22eca5e9a2ee91d48dfcc792c2078d653c9298dc81cf641f1

See more details on using hashes here.

Supported by

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