asaas-sdk
Biblioteca não oficial de comunicação com a API de pagamento do ASAAS
Baseado na documentação especificada em https://asaasv3.docs.apiary.io/
Instalação
Instale o pacote via pip:
pip install asaas-sdk
Utilização
from asaas import Asaas
asaas = Asaas(access_token = 'acess_token', url_production='asaas_production_url', production = False)
A variável acess_token deve receber um token válido.
A variável url_production deve receber a url de produção do Asaas.
Customers
new_customer = asaas.customers.new(name = 'Roberto', cpfCnpj = '24971563792')
print(new_customer)
# Customer(id=cus_000005263646, name=Roberto, email=None)
Payments
Cartão de crédito
from asaas.payments import CreditCard, CreditCardHolderInfo, BillingType
from datetime import date
credit_card = CreditCard(
holderName = 'marcelo h almeida',
number = '5162306219378829',
expiryYear = '2024', expiryMonth = '05',
ccv = '318'
)
credit_card_holder_info = CreditCardHolderInfo(
name = 'Marcelo Henrique Almeida',
email = 'marcelo.almeida@gmail.com',
cpfCnpj = '24971563792',
postalCode = '89223-005',
addressNumber = '277',
addressComplement = '',
phone = '4738010919'
)
pagamento = asaas.payments.new(
customer = new_customer,
billingType = BillingType.CREDIT_CARD,
value = 100,
dueDate = date.today(),
creditCard = credit_card.json(),
creditCardHolderInfo = credit_card_holder_info.json()
)
print(pagamento)
# Payment(id=pay_6954209428403551, customer=Customer(id=cus_000005263646, name=Roberto, email=None), billingType=CREDIT_CARD, value=100)
Boleto
pagamento = asaas.payments.new(
customer = new_customer,
billingType = BillingType.BOLETO,
value = 100,
dueDate = date.today()
)
print(pagamento)
# Payment(id=pay_6954209428403552, customer=Customer(id=cus_000005263646, name=Roberto, email=None), billingType=BOLETO, value=100, invoiceUrl=https://sandbox.asaas.com/i/6997545710784231)
Pix
pagamento = asaas.payments.new(
customer = new_customer,
billingType = BillingType.PIX,
value = 100,
dueDate = date.today()
)
print(pagamento)
# Payment(id=pay_6954209428403553, customer=Customer(id=cus_000005263646, name=Roberto, email=None), billingType=PIX, value=100)
pix_info = asaas.payments.get_pix_qr(pagamento.id)
print(pix_info)
# 'Pix(success=True, expirationDate=2023-04-27 23:59:59, payload=00020101021226820014br.gov.bcb.pix2560qrpix-...)'
Metadata
Release files for asaas-sdk 3.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| asaas_sdk-3.3.1.tar.gz | 9.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asaas_sdk-3.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / asaas_sdk-3.3.1.tar.gz
| Download URL | asaas_sdk-3.3.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d7b0826ed3a0cd1f6bc992cba072dffa19233f64e62e8eea9b32d3b8828387e
|
|
BLAKE2b-256 checksum How to use checksums |
77616ed6a313429e378b80d77687a6b58aab3cfdbe3acc0a34521ad04fe92acc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / asaas_sdk-3.3.1-py3-none-any.whl
| Download URL | asaas_sdk-3.3.1-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a74e796273ca6298f59aeb975f59aed30b8fc95d83b9e4acbcdcc1e84c3e61ec
|
|
BLAKE2b-256 checksum How to use checksums |
3cc8e549d4fcecd4d51288232812292d89a7ce59389d4411edca25ae18808579
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Security for asaas-sdk 3.3.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.