Skip to content

caua1503/abacatepay-python-sdk

 
 

Repository files navigation

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="[email protected]",
    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! To get started, please follow the steps in our Contributing Guide.

About

AbacatePay Python SDK for you to start receiving payments in seconds

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%