wyzecash 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ dist/
2
+ __pycache__/
3
+ *.egg-info/
4
+ .mypy_cache/
5
+ .ruff_cache/
wyzecash-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WyzeCash
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: wyzecash
3
+ Version: 0.1.0
4
+ Summary: SDK oficial da WyzeCash para Python: cobranças por Pix, cartão e cripto, saques, subcontas e webhooks.
5
+ Project-URL: Documentation, https://bukio.mintlify.app
6
+ Author: WyzeCash
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: cartao,cripto,gateway,pagamentos,pix,webhook,wyzecash
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Natural Language :: Portuguese (Brazilian)
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Office/Business :: Financial
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+
25
+ # wyzecash
26
+
27
+ SDK oficial da [WyzeCash](https://bukio.mintlify.app) para Python 3.10+: cobranças por Pix, cartão e cripto, links de pagamento, saldo e extrato, saques, Pix enviado, estornos, MED, subcontas e webhooks. Sem dependências (só a biblioteca padrão) e com tipos para o editor.
28
+
29
+ ```bash
30
+ pip install wyzecash
31
+ ```
32
+
33
+ ## Começar
34
+
35
+ ```python
36
+ import os
37
+ from wyzecash import WyzeCash
38
+
39
+ wyzecash = WyzeCash(os.environ["WYZECASH_API_KEY"])
40
+
41
+ cobranca = wyzecash.payments.create(
42
+ amount=15000, # R$ 150,00, sempre em centavos
43
+ description="Pedido #1052",
44
+ )
45
+
46
+ print(cobranca["copyPaste"]) # Pix Copia e Cola
47
+ ```
48
+
49
+ A chave de API (`bk_live_…`) é criada no painel, em Integrações e API, com uma permissão por rota. Sem passar a chave, o SDK lê a variável `WYZECASH_API_KEY`.
50
+
51
+ Não existe ambiente de testes: todo pedido é de verdade. Para testar, faça uma cobrança pequena.
52
+
53
+ Os campos têm os mesmos nomes da API (`subaccountId`, `feePaidBy`...), então os exemplos da documentação valem direto. Só `from` vira `from_`, porque é palavra do Python. As respostas são dicionários com tipos (`TypedDict`): o editor completa os campos e mostra a descrição.
54
+
55
+ ## Recursos
56
+
57
+ | Recurso | Métodos |
58
+ |---|---|
59
+ | `payments` | `create`, `methods`, `list`, `retrieve` |
60
+ | `payment_links` | `create`, `list`, `retrieve`, `update`, `delete`, `list_payments` |
61
+ | `customers` | `create`, `list`, `retrieve`, `update`, `delete` |
62
+ | `balance` | `retrieve` |
63
+ | `fees` | `list`, `preview` |
64
+ | `statement` | `list` |
65
+ | `transactions` | `list`, `retrieve` |
66
+ | `search` | `query` |
67
+ | `receipts` | `retrieve` |
68
+ | `meds` | `list`, `retrieve`, `download_attachment` |
69
+ | `pix` | `send`, `list`, `retrieve` |
70
+ | `withdrawals` | `create`, `list`, `retrieve` |
71
+ | `refunds` | `create`, `list`, `retrieve` |
72
+ | `subaccounts` | `create`, `list`, `retrieve`, `update`, `delete`, `retrieve_settings`, `update_settings`, `preview_settings`, `list_entries`, `fund`, `transfer`, `return_to_account`, `withdraw` |
73
+
74
+ Campo que você não passa não vai no pedido. `None` vai como `null`, que em alguns campos limpa o valor (ex.: `limits={"perWithdrawal": None}` tira o limite próprio da subconta).
75
+
76
+ ## Listas
77
+
78
+ A lista traz a primeira página; o `for` passa por todas, buscando a próxima só quando precisa.
79
+
80
+ ```python
81
+ pagina = wyzecash.payments.list(status="paid", limit=50)
82
+ print(len(pagina.items), pagina.next_cursor)
83
+
84
+ for cobranca in wyzecash.payments.list(status="paid"):
85
+ print(cobranca["id"], cobranca["amount"])
86
+ ```
87
+
88
+ `pagina.next_page()` busca a próxima página e `pagina.to_list(limit=500)` junta os itens numa lista só.
89
+
90
+ ## Idempotency-Key
91
+
92
+ Criar cobrança, saque, Pix enviado, estorno e os envios das subcontas pedem a `Idempotency-Key`. Passe o código do pedido no seu sistema: repetir a mesma chave devolve o mesmo resultado, sem fazer de novo.
93
+
94
+ ```python
95
+ wyzecash.withdrawals.create(
96
+ amount=10000,
97
+ destination={"keyType": "email", "key": "financeiro@exemplo.com"},
98
+ idempotency_key="saque-1052",
99
+ )
100
+ ```
101
+
102
+ Sem ela, o SDK cria uma chave por chamada.
103
+
104
+ ## Erros e novas tentativas
105
+
106
+ ```python
107
+ from wyzecash import WyzeCashError
108
+
109
+ try:
110
+ wyzecash.payments.create(amount=15000)
111
+ except WyzeCashError as erro:
112
+ print(erro.status, erro.code, erro.message, erro.request_id)
113
+ ```
114
+
115
+ - O `code` é estável (`VALIDATION`, `INSUFFICIENT_FUNDS`, `RATE_LIMITED`...) e a `message` está em português.
116
+ - `429` (passou de 100 pedidos por minuto) volta a tentar sozinho, esperando o `Retry-After`.
117
+ - Erro de rede e `5xx` voltam a tentar só nas consultas e na criação de cobrança.
118
+ - O que tira dinheiro (saque, Pix enviado, estorno, envios das subcontas) **nunca** é repetido sozinho: se a rede cair, confira pela consulta ou pelo webhook antes de pedir de novo.
119
+ - Rede fora ou tempo esgotado lançam `WyzeCashConnectionError` (`code` `CONNECTION_ERROR` ou `TIMEOUT`).
120
+
121
+ Opções do cliente: `WyzeCash(chave, max_retries=2, timeout=60.0, base_url=..., transport=...)`. Cada método também aceita `timeout` e `max_retries`.
122
+
123
+ ## Webhooks
124
+
125
+ Cada aviso chega com o cabeçalho `X-Bukio-Signature`. Confira sempre com o corpo cru, como chegou:
126
+
127
+ ```python
128
+ from wyzecash import verify_webhook
129
+
130
+ evento = verify_webhook(corpo_cru, assinatura, os.environ["WYZECASH_WEBHOOK_SECRET"])
131
+ if evento["type"] == "payment.paid":
132
+ ... # marque o pedido como pago (use evento["id"] para não processar duas vezes)
133
+ ```
134
+
135
+ Aviso com assinatura errada, sem assinatura ou assinado há mais de 5 minutos lança `WyzeCashWebhookError`. Responda `200` quando deu certo e `400` quando o aviso não é da WyzeCash; com qualquer outra resposta, a WyzeCash manda de novo mais tarde.
136
+
137
+ ### FastAPI
138
+
139
+ ```python
140
+ from fastapi import FastAPI, HTTPException, Request
141
+ from wyzecash import WyzeCashWebhookError, verify_webhook
142
+
143
+ app = FastAPI()
144
+
145
+ @app.post("/webhooks/wyzecash")
146
+ async def webhook(request: Request):
147
+ try:
148
+ evento = verify_webhook(await request.body(), request.headers.get("x-bukio-signature"), os.environ["WYZECASH_WEBHOOK_SECRET"])
149
+ except WyzeCashWebhookError as erro:
150
+ raise HTTPException(400, erro.message)
151
+ if evento["type"] == "payment.paid":
152
+ ...
153
+ return {"received": True}
154
+ ```
155
+
156
+ ### Flask
157
+
158
+ ```python
159
+ @app.post("/webhooks/wyzecash")
160
+ def webhook():
161
+ try:
162
+ evento = verify_webhook(request.get_data(), request.headers.get("X-Bukio-Signature"), os.environ["WYZECASH_WEBHOOK_SECRET"])
163
+ except WyzeCashWebhookError as erro:
164
+ return {"error": erro.message}, 400
165
+ ...
166
+ return {"received": True}
167
+ ```
168
+
169
+ ### Django
170
+
171
+ ```python
172
+ @csrf_exempt
173
+ @require_POST
174
+ def webhook(request):
175
+ try:
176
+ evento = verify_webhook(request.body, request.headers.get("X-Bukio-Signature"), os.environ["WYZECASH_WEBHOOK_SECRET"])
177
+ except WyzeCashWebhookError as erro:
178
+ return JsonResponse({"error": erro.message}, status=400)
179
+ ...
180
+ return JsonResponse({"received": True})
181
+ ```
182
+
183
+ ## Documentação
184
+
185
+ Referência completa da API: https://bukio.mintlify.app
@@ -0,0 +1,161 @@
1
+ # wyzecash
2
+
3
+ SDK oficial da [WyzeCash](https://bukio.mintlify.app) para Python 3.10+: cobranças por Pix, cartão e cripto, links de pagamento, saldo e extrato, saques, Pix enviado, estornos, MED, subcontas e webhooks. Sem dependências (só a biblioteca padrão) e com tipos para o editor.
4
+
5
+ ```bash
6
+ pip install wyzecash
7
+ ```
8
+
9
+ ## Começar
10
+
11
+ ```python
12
+ import os
13
+ from wyzecash import WyzeCash
14
+
15
+ wyzecash = WyzeCash(os.environ["WYZECASH_API_KEY"])
16
+
17
+ cobranca = wyzecash.payments.create(
18
+ amount=15000, # R$ 150,00, sempre em centavos
19
+ description="Pedido #1052",
20
+ )
21
+
22
+ print(cobranca["copyPaste"]) # Pix Copia e Cola
23
+ ```
24
+
25
+ A chave de API (`bk_live_…`) é criada no painel, em Integrações e API, com uma permissão por rota. Sem passar a chave, o SDK lê a variável `WYZECASH_API_KEY`.
26
+
27
+ Não existe ambiente de testes: todo pedido é de verdade. Para testar, faça uma cobrança pequena.
28
+
29
+ Os campos têm os mesmos nomes da API (`subaccountId`, `feePaidBy`...), então os exemplos da documentação valem direto. Só `from` vira `from_`, porque é palavra do Python. As respostas são dicionários com tipos (`TypedDict`): o editor completa os campos e mostra a descrição.
30
+
31
+ ## Recursos
32
+
33
+ | Recurso | Métodos |
34
+ |---|---|
35
+ | `payments` | `create`, `methods`, `list`, `retrieve` |
36
+ | `payment_links` | `create`, `list`, `retrieve`, `update`, `delete`, `list_payments` |
37
+ | `customers` | `create`, `list`, `retrieve`, `update`, `delete` |
38
+ | `balance` | `retrieve` |
39
+ | `fees` | `list`, `preview` |
40
+ | `statement` | `list` |
41
+ | `transactions` | `list`, `retrieve` |
42
+ | `search` | `query` |
43
+ | `receipts` | `retrieve` |
44
+ | `meds` | `list`, `retrieve`, `download_attachment` |
45
+ | `pix` | `send`, `list`, `retrieve` |
46
+ | `withdrawals` | `create`, `list`, `retrieve` |
47
+ | `refunds` | `create`, `list`, `retrieve` |
48
+ | `subaccounts` | `create`, `list`, `retrieve`, `update`, `delete`, `retrieve_settings`, `update_settings`, `preview_settings`, `list_entries`, `fund`, `transfer`, `return_to_account`, `withdraw` |
49
+
50
+ Campo que você não passa não vai no pedido. `None` vai como `null`, que em alguns campos limpa o valor (ex.: `limits={"perWithdrawal": None}` tira o limite próprio da subconta).
51
+
52
+ ## Listas
53
+
54
+ A lista traz a primeira página; o `for` passa por todas, buscando a próxima só quando precisa.
55
+
56
+ ```python
57
+ pagina = wyzecash.payments.list(status="paid", limit=50)
58
+ print(len(pagina.items), pagina.next_cursor)
59
+
60
+ for cobranca in wyzecash.payments.list(status="paid"):
61
+ print(cobranca["id"], cobranca["amount"])
62
+ ```
63
+
64
+ `pagina.next_page()` busca a próxima página e `pagina.to_list(limit=500)` junta os itens numa lista só.
65
+
66
+ ## Idempotency-Key
67
+
68
+ Criar cobrança, saque, Pix enviado, estorno e os envios das subcontas pedem a `Idempotency-Key`. Passe o código do pedido no seu sistema: repetir a mesma chave devolve o mesmo resultado, sem fazer de novo.
69
+
70
+ ```python
71
+ wyzecash.withdrawals.create(
72
+ amount=10000,
73
+ destination={"keyType": "email", "key": "financeiro@exemplo.com"},
74
+ idempotency_key="saque-1052",
75
+ )
76
+ ```
77
+
78
+ Sem ela, o SDK cria uma chave por chamada.
79
+
80
+ ## Erros e novas tentativas
81
+
82
+ ```python
83
+ from wyzecash import WyzeCashError
84
+
85
+ try:
86
+ wyzecash.payments.create(amount=15000)
87
+ except WyzeCashError as erro:
88
+ print(erro.status, erro.code, erro.message, erro.request_id)
89
+ ```
90
+
91
+ - O `code` é estável (`VALIDATION`, `INSUFFICIENT_FUNDS`, `RATE_LIMITED`...) e a `message` está em português.
92
+ - `429` (passou de 100 pedidos por minuto) volta a tentar sozinho, esperando o `Retry-After`.
93
+ - Erro de rede e `5xx` voltam a tentar só nas consultas e na criação de cobrança.
94
+ - O que tira dinheiro (saque, Pix enviado, estorno, envios das subcontas) **nunca** é repetido sozinho: se a rede cair, confira pela consulta ou pelo webhook antes de pedir de novo.
95
+ - Rede fora ou tempo esgotado lançam `WyzeCashConnectionError` (`code` `CONNECTION_ERROR` ou `TIMEOUT`).
96
+
97
+ Opções do cliente: `WyzeCash(chave, max_retries=2, timeout=60.0, base_url=..., transport=...)`. Cada método também aceita `timeout` e `max_retries`.
98
+
99
+ ## Webhooks
100
+
101
+ Cada aviso chega com o cabeçalho `X-Bukio-Signature`. Confira sempre com o corpo cru, como chegou:
102
+
103
+ ```python
104
+ from wyzecash import verify_webhook
105
+
106
+ evento = verify_webhook(corpo_cru, assinatura, os.environ["WYZECASH_WEBHOOK_SECRET"])
107
+ if evento["type"] == "payment.paid":
108
+ ... # marque o pedido como pago (use evento["id"] para não processar duas vezes)
109
+ ```
110
+
111
+ Aviso com assinatura errada, sem assinatura ou assinado há mais de 5 minutos lança `WyzeCashWebhookError`. Responda `200` quando deu certo e `400` quando o aviso não é da WyzeCash; com qualquer outra resposta, a WyzeCash manda de novo mais tarde.
112
+
113
+ ### FastAPI
114
+
115
+ ```python
116
+ from fastapi import FastAPI, HTTPException, Request
117
+ from wyzecash import WyzeCashWebhookError, verify_webhook
118
+
119
+ app = FastAPI()
120
+
121
+ @app.post("/webhooks/wyzecash")
122
+ async def webhook(request: Request):
123
+ try:
124
+ evento = verify_webhook(await request.body(), request.headers.get("x-bukio-signature"), os.environ["WYZECASH_WEBHOOK_SECRET"])
125
+ except WyzeCashWebhookError as erro:
126
+ raise HTTPException(400, erro.message)
127
+ if evento["type"] == "payment.paid":
128
+ ...
129
+ return {"received": True}
130
+ ```
131
+
132
+ ### Flask
133
+
134
+ ```python
135
+ @app.post("/webhooks/wyzecash")
136
+ def webhook():
137
+ try:
138
+ evento = verify_webhook(request.get_data(), request.headers.get("X-Bukio-Signature"), os.environ["WYZECASH_WEBHOOK_SECRET"])
139
+ except WyzeCashWebhookError as erro:
140
+ return {"error": erro.message}, 400
141
+ ...
142
+ return {"received": True}
143
+ ```
144
+
145
+ ### Django
146
+
147
+ ```python
148
+ @csrf_exempt
149
+ @require_POST
150
+ def webhook(request):
151
+ try:
152
+ evento = verify_webhook(request.body, request.headers.get("X-Bukio-Signature"), os.environ["WYZECASH_WEBHOOK_SECRET"])
153
+ except WyzeCashWebhookError as erro:
154
+ return JsonResponse({"error": erro.message}, status=400)
155
+ ...
156
+ return JsonResponse({"received": True})
157
+ ```
158
+
159
+ ## Documentação
160
+
161
+ Referência completa da API: https://bukio.mintlify.app
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["hatchling==1.27.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "wyzecash"
7
+ version = "0.1.0"
8
+ description = "SDK oficial da WyzeCash para Python: cobranças por Pix, cartão e cripto, saques, subcontas e webhooks."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ authors = [{ name = "WyzeCash" }]
14
+ keywords = ["wyzecash", "pix", "cartao", "cripto", "pagamentos", "gateway", "webhook"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Natural Language :: Portuguese (Brazilian)",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Topic :: Office/Business :: Financial",
27
+ "Typing :: Typed",
28
+ ]
29
+ dependencies = []
30
+
31
+ [project.urls]
32
+ Documentation = "https://bukio.mintlify.app"
33
+
34
+ [tool.hatch.build.targets.wheel]
35
+ packages = ["src/wyzecash"]
36
+
37
+ [tool.hatch.build.targets.sdist]
38
+ include = ["src/wyzecash", "tests", "README.md", "LICENSE", "pyproject.toml"]
39
+ exclude = ["tests/test_generated.py"]
40
+
41
+ [tool.ruff]
42
+ line-length = 200
43
+ target-version = "py310"
44
+
45
+ [tool.ruff.lint]
46
+ select = ["E", "F", "I", "UP", "B"]
47
+ per-file-ignores = { "src/wyzecash/_generated.py" = ["E501", "UP006", "UP035"] }
48
+
49
+ [tool.ruff.format]
50
+ exclude = ["src/wyzecash/_generated.py"]
51
+
52
+ [tool.mypy]
53
+ strict = true
54
+ python_version = "3.10"
@@ -0,0 +1,28 @@
1
+ """SDK oficial da WyzeCash para Python: cobranças por Pix, cartão e cripto, saques, subcontas e webhooks."""
2
+
3
+ from ._client import DEFAULT_BASE_URL, Response, Transport, WyzeCash, urllib_transport
4
+ from ._errors import WyzeCashConnectionError, WyzeCashError, WyzeCashWebhookError
5
+ from ._pagination import Page
6
+ from ._types import NOT_GIVEN, NotGiven
7
+ from ._version import __version__
8
+ from ._webhooks import SIGNATURE_HEADER, WEBHOOK_EVENT_TYPES, Webhooks, sign_webhook, verify_webhook
9
+
10
+ __all__ = [
11
+ "DEFAULT_BASE_URL",
12
+ "NOT_GIVEN",
13
+ "NotGiven",
14
+ "Page",
15
+ "Response",
16
+ "SIGNATURE_HEADER",
17
+ "Transport",
18
+ "WEBHOOK_EVENT_TYPES",
19
+ "Webhooks",
20
+ "WyzeCash",
21
+ "WyzeCashConnectionError",
22
+ "WyzeCashError",
23
+ "WyzeCashWebhookError",
24
+ "__version__",
25
+ "sign_webhook",
26
+ "urllib_transport",
27
+ "verify_webhook",
28
+ ]