Cliente HTTP para a API de Checkout da VTEX com suporte a pagamento PIX
Project description
notify-vtex-client
Cliente HTTP para a API de Checkout da VTEX com suporte a pagamento PIX.
Instalacao
pip install notify-vtex-client
Uso
from notify_tls_client import NotifyTLSClient
from notify_vtex_client.client.notifyvtexclient import NotifyVtexClient
from notify_vtex_client.client.structures.item import Item
from notify_vtex_client.payloads.additemspayload import AddItemsPayload
from notify_vtex_client.payloads.attachclientprofilepayload import AttachClientProfilePayload
from notify_vtex_client.payloads.attachshippingdatapayload import AttachShippingDataPayload
from notify_vtex_client.payloads.attachpaymentdatapayloads.attachpixpaymentdatapayload import AttachPixPaymentDataPayload
# Inicializar cliente
tls = NotifyTLSClient()
client = NotifyVtexClient(tls=tls, base_url="https://www.loja.com.br")
# Iniciar sessao
session = client.start_session()
# Adicionar item ao carrinho
item = Item(id="123", quantity=1, seller="1")
response = client.add_item_to_cart(item=item, sc=1)
# Anexar dados do cliente
profile = AttachClientProfilePayload(email="cliente@email.com")
client.attach_client_profile_data(payload=profile)
# Anexar endereco
shipping = AttachShippingDataPayload(
postal_code="01001000",
street="Praca da Se",
number="1",
city="Sao Paulo",
state="SP",
neighborhood="Se",
receiver_name="Nome do Cliente"
)
client.attach_client_shipping_data(payload=shipping)
# Pagamento PIX
payment = AttachPixPaymentDataPayload(reference_value=9990)
client.attach_payment_data(payload=payment)
# Criar e processar transacao
transaction = client.create_transaction(value=9990)
# Obter QR code PIX
callback = client.process_callback_url(order_id="order-id")
print(callback.pix_code)
Fluxo de Checkout
start_session()- Inicia sessao e obtem order_form_idcheck_email()/attach_client_profile_data()- Perfil do clienteget_postal_code_info()- Valida CEPattach_client_shipping_data()- Dados de envioadd_item_to_cart()- Adiciona produtoattach_payment_data()- Dados de pagamento PIXcreate_transaction()- Cria transacao no gatewayprocess_transaction()- Processa pagamentoprocess_callback_url()- Obtem QR code PIX
Licenca
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
notify_vtex_client-0.4.0.tar.gz
(13.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file notify_vtex_client-0.4.0.tar.gz.
File metadata
- Download URL: notify_vtex_client-0.4.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc46650e075c771a707406cd8121b8ef0670546855f60ac7132d12f51b9b93a5
|
|
| MD5 |
f12559bb17db6edf5439f144dec1bf9b
|
|
| BLAKE2b-256 |
7029a59d5f0949ba5f935de6c68cb3392d4097218a341fe91652f7c1a2302fb7
|
File details
Details for the file notify_vtex_client-0.4.0-py3-none-any.whl.
File metadata
- Download URL: notify_vtex_client-0.4.0-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35cdf33aebbc7fd794a39f8c8a60d2b4493e85200184c618d24a5311a1dc5de3
|
|
| MD5 |
a3533eb10b1fa42749470fa212ae3a52
|
|
| BLAKE2b-256 |
0cdec230357545f3581a5a3cb4b5a331bc69b12f017e5e829e7d2c3ca2d909ba
|