Name | asaas-sdk JSON |
Version |
3.3.1
JSON |
| download |
home_page | None |
Summary | Biblioteca não oficial de comunicação com a API de pagamento do ASAAS |
upload_time | 2024-09-09 14:13:01 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
asaas
sdk
payment
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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:
```sh
pip install asaas-sdk
```
## Utilização
```py
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](https://asaasv3.docs.apiary.io/#introduction/autenticacao).
A variável `url_production` deve receber a url de produção do Asaas.
### Customers
```py
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
```py
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
```py
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
```py
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-...)'
```
Raw data
{
"_id": null,
"home_page": null,
"name": "asaas-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "asaas, sdk, payment",
"author": null,
"author_email": "Gabriel Niziolek <ganiziolek@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/77/61/6ed6a313429e378b80d77687a6b58aab3cfdbe3acc0a34521ad04fe92acc/asaas_sdk-3.3.1.tar.gz",
"platform": null,
"description": "# asaas-sdk\nBiblioteca n\u00e3o oficial de comunica\u00e7\u00e3o com a API de pagamento do ASAAS\n\nBaseado na documenta\u00e7\u00e3o especificada em https://asaasv3.docs.apiary.io/\n\n## Instala\u00e7\u00e3o\n\nInstale o pacote via pip:\n\n```sh\npip install asaas-sdk\n```\n\n## Utiliza\u00e7\u00e3o\n\n```py\nfrom asaas import Asaas\n\nasaas = Asaas(access_token = 'acess_token', url_production='asaas_production_url', production = False)\n\n``` \nA vari\u00e1vel `acess_token` deve receber um [token v\u00e1lido](https://asaasv3.docs.apiary.io/#introduction/autenticacao).\nA vari\u00e1vel `url_production` deve receber a url de produ\u00e7\u00e3o do Asaas.\n\n\n### Customers\n```py\nnew_customer = asaas.customers.new(name = 'Roberto', cpfCnpj = '24971563792')\n\nprint(new_customer)\n# Customer(id=cus_000005263646, name=Roberto, email=None)\n```\n\n### Payments\n\n#### Cart\u00e3o de cr\u00e9dito\n\n```py\n\nfrom asaas.payments import CreditCard, CreditCardHolderInfo, BillingType\nfrom datetime import date\n\ncredit_card = CreditCard(\n holderName = 'marcelo h almeida',\n number = '5162306219378829',\n expiryYear = '2024', expiryMonth = '05',\n ccv = '318'\n )\n\ncredit_card_holder_info = CreditCardHolderInfo(\n name = 'Marcelo Henrique Almeida',\n email = 'marcelo.almeida@gmail.com',\n cpfCnpj = '24971563792',\n postalCode = '89223-005',\n addressNumber = '277',\n addressComplement = '',\n phone = '4738010919'\n )\n\npagamento = asaas.payments.new(\n customer = new_customer,\n billingType = BillingType.CREDIT_CARD,\n value = 100,\n dueDate = date.today(),\n creditCard = credit_card.json(),\n creditCardHolderInfo = credit_card_holder_info.json()\n )\n\nprint(pagamento)\n# Payment(id=pay_6954209428403551, customer=Customer(id=cus_000005263646, name=Roberto, email=None), billingType=CREDIT_CARD, value=100)\n\n```\n\n#### Boleto\n\n\n```py\n\n\npagamento = asaas.payments.new(\n customer = new_customer,\n billingType = BillingType.BOLETO,\n value = 100,\n dueDate = date.today()\n )\n\nprint(pagamento)\n# Payment(id=pay_6954209428403552, customer=Customer(id=cus_000005263646, name=Roberto, email=None), billingType=BOLETO, value=100, invoiceUrl=https://sandbox.asaas.com/i/6997545710784231)\n\n```\n\n#### Pix\n\n\n```py\n\npagamento = asaas.payments.new(\n customer = new_customer,\n billingType = BillingType.PIX,\n value = 100,\n dueDate = date.today()\n )\n\nprint(pagamento)\n# Payment(id=pay_6954209428403553, customer=Customer(id=cus_000005263646, name=Roberto, email=None), billingType=PIX, value=100)\n\npix_info = asaas.payments.get_pix_qr(pagamento.id)\n\nprint(pix_info)\n# 'Pix(success=True, expirationDate=2023-04-27 23:59:59, payload=00020101021226820014br.gov.bcb.pix2560qrpix-...)'\n\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Biblioteca n\u00e3o oficial de comunica\u00e7\u00e3o com a API de pagamento do ASAAS",
"version": "3.3.1",
"project_urls": {
"Bug Tracker": "https://github.com/GaNiziolek/asaas-sdk/issues",
"Homepage": "https://github.com/GaNiziolek/asaas-sdk"
},
"split_keywords": [
"asaas",
" sdk",
" payment"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3cc8e549d4fcecd4d51288232812292d89a7ce59389d4411edca25ae18808579",
"md5": "35f4118605cd8efa22314c9a7ca332ef",
"sha256": "a74e796273ca6298f59aeb975f59aed30b8fc95d83b9e4acbcdcc1e84c3e61ec"
},
"downloads": -1,
"filename": "asaas_sdk-3.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "35f4118605cd8efa22314c9a7ca332ef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 10428,
"upload_time": "2024-09-09T14:12:59",
"upload_time_iso_8601": "2024-09-09T14:12:59.762115Z",
"url": "https://files.pythonhosted.org/packages/3c/c8/e549d4fcecd4d51288232812292d89a7ce59389d4411edca25ae18808579/asaas_sdk-3.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77616ed6a313429e378b80d77687a6b58aab3cfdbe3acc0a34521ad04fe92acc",
"md5": "7a84273440b2a83fb864720d6a135e43",
"sha256": "6d7b0826ed3a0cd1f6bc992cba072dffa19233f64e62e8eea9b32d3b8828387e"
},
"downloads": -1,
"filename": "asaas_sdk-3.3.1.tar.gz",
"has_sig": false,
"md5_digest": "7a84273440b2a83fb864720d6a135e43",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9572,
"upload_time": "2024-09-09T14:13:01",
"upload_time_iso_8601": "2024-09-09T14:13:01.251140Z",
"url": "https://files.pythonhosted.org/packages/77/61/6ed6a313429e378b80d77687a6b58aab3cfdbe3acc0a34521ad04fe92acc/asaas_sdk-3.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-09 14:13:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GaNiziolek",
"github_project": "asaas-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "asaas-sdk"
}