Skip to main content

A package to handle rede payments api

Project description

SDK Python

SDK de integração eRede

Utilizando

Autorizando uma transação

from erede import *

store = Store("PV", "TOKEN", Environment.sandbox())

transaction = Transaction(12345, "Reference")
transaction.credit_card("5448280000000007", "123", "12", "2020", "Fulano de Tal")
transaction.set_additional(3456, 12)

try:
    transaction = eRede(store).create(transaction)

    if transaction.returnCode == "00":
        print("Transação aprovada com sucesso. O tid é: {}".format(transaction.tid))
except RedeError as e:
    print("Opz[{}]: {}".format(e.code, e))

Por padrão, a transação é capturada automaticamente; caso seja necessário apenas autorizar a transação, o método Transaction.capture_transaction(False) deverá ser chamado com o parâmetro False:

from erede import *

store = Store("PV", "TOKEN", Environment.sandbox())

transaction = Transaction(12345, "Reference")
transaction.credit_card("5448280000000007", "123", "12", "2020", "Fulano de Tal").capture_transaction(False)

try:
    transaction = eRede(store).create(transaction)

    if transaction.returnCode == "00":
        print("Transação aprovada com sucesso. O tid é: {}".format(transaction.tid))
except RedeError as e:
    print("Opz[{}]: {}".format(e.code, e))

Autorizando uma transação com MCC dinâmico

from erede import *

store = Store("PV", "TOKEN", Environment.sandbox())

transaction = Transaction(12345, "Reference")
transaction.credit_card("5448280000000007", "123", "12", "2020", "Fulano de Tal")
transaction.mcc("LOJADOZE", "22349202212", SubMerchant("1234", "Sao Paulo", "Brasil"))

try:
    transaction = eRede(store).create(transaction)

    if transaction.returnCode == "00":
        print("Transação aprovada com sucesso. O tid é: {}".format(transaction.tid))
except RedeError as e:
    print("Opz[{}]: {}".format(e.code, e))

Autorizando uma transação com identificação de plataforma

from erede import *

store = Store("PV", "TOKEN", Environment.sandbox())

transaction = Transaction(12345, "Reference")
transaction.credit_card("5448280000000007", "123", "12", "2020", "Fulano de Tal")
transaction.set_additional(1234, 12)

try:
    transaction = eRede(store).create(transaction)

    if transaction.returnCode == "00":
        print("Transação aprovada com sucesso. O tid é: {}".format(transaction.tid))
except RedeError as e:
    print("Opz[{}]: {}".format(e.code, e))

Autorizando uma transação IATA

from erede import *

store = Store("PV", "TOKEN", Environment.sandbox())

transaction = Transaction(12345, "Reference")
transaction.credit_card("5448280000000007", "123", "12", "2020", "Fulano de Tal")
transaction.set_iata("code123", "250")

try:
    transaction = eRede(store).create(transaction)

    if transaction.returnCode == "00":
        print("Transação aprovada com sucesso. O tid é: {}".format(transaction.tid))
except RedeError as e:
    print("Opz[{}]: {}".format(e.code, e))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rede-payments, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size rede_payments-1.0.0-py3-none-any.whl (15.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size rede payments-1.0.0.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page