Skip to main content

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

  1. start_session() - Inicia sessao e obtem order_form_id
  2. check_email() / attach_client_profile_data() - Perfil do cliente
  3. get_postal_code_info() - Valida CEP
  4. attach_client_shipping_data() - Dados de envio
  5. add_item_to_cart() - Adiciona produto
  6. attach_payment_data() - Dados de pagamento PIX
  7. create_transaction() - Cria transacao no gateway
  8. process_transaction() - Processa pagamento
  9. process_callback_url() - Obtem QR code PIX

Licenca

MIT

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

notify_vtex_client-0.4.0-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

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

Hashes for notify_vtex_client-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fc46650e075c771a707406cd8121b8ef0670546855f60ac7132d12f51b9b93a5
MD5 f12559bb17db6edf5439f144dec1bf9b
BLAKE2b-256 7029a59d5f0949ba5f935de6c68cb3392d4097218a341fe91652f7c1a2302fb7

See more details on using hashes here.

File details

Details for the file notify_vtex_client-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for notify_vtex_client-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35cdf33aebbc7fd794a39f8c8a60d2b4493e85200184c618d24a5311a1dc5de3
MD5 a3533eb10b1fa42749470fa212ae3a52
BLAKE2b-256 0cdec230357545f3581a5a3cb4b5a331bc69b12f017e5e829e7d2c3ca2d909ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page