Skip to main content
https://circleci.com/gh/cornershop/python-tbk/tree/master.svg?style=svg https://badge.fury.io/py/python-tbk.svg

Requirements

  • python: ~2.7, ^3.6

  • libxml2 >= 2.9.1

  • libxmlsec1 >= 1.2.14


🇬🇧

Installation

Just run:

$ pip install python-tbk

Usage

As simple as call (snakecased) webpay api methods:

>>> from tbk.services import WebpayService
>>> from tbk.commerce import Commerce
>>> from tbk import INTEGRACION
>>> commerce = Commerce(commerce_code, key_data, cert_data, tbk_cert_data, INTEGRACION)
>>> webpay = WebpayService(commerce)
>>> transaction = webpay.init_transaction(amount, buy_order, return_url, final_url)
>>> print(transaction['token'])
e87df74f7af4dcfdc1d17521b07413ff9a004a7b423dc47ad09f6a8166a73842

Conventions

This library use a snake cased naming convention for webservices and params for a more pythonic implementation. Every camelcased name in the webpay API was transformed to snakecase:

initTransaction(amount, buyOrder, returnURL, finalURL, sessionId)

became:

init_transaction(amount, buy_order, return_url, final_url, session_id)

Oneclick Mall Service

A list of tbk.services.StoreInput input is expected as wsOneClickMulticodeStorePaymentInput for stores_input parameter on authorize method.

Documentation

You can refer to http://www.transbankdevelopers.cl/?m=api for official API documentation. This library documentation is on the way.

Loggers

There are two levels of loggers:

tbk.services
tbk.soap

Specific service logger are defined by class name:

tbk.services.WebpayService

Bugs?

Issues are welcome at https://github.com/cornershop/python-tbk/issues

🇪🇸

Instalación

Ejecuta:

$ pip install python-tbk

Uso

Tan simple como llamar los métodos del API de Webpay (pero snakecased):

>>> from tbk.services import WebpayService
>>> from tbk.commerce import Commerce
>>> from tbk import INTEGRACION
>>> commerce = Commerce(commerce_code, key_data, cert_data, tbk_cert_data, INTEGRACION)
>>> webpay = WebpayService(commerce)
>>> transaction = webpay.init_transaction(amount, buy_order, return_url, final_url)
>>> print(transaction['token'])
e87df74f7af4dcfdc1d17521b07413ff9a004a7b423dc47ad09f6a8166a73842

Convenciones

La librería usa una convención de nombres snakecased para ser más pythonica. Cada nombre camelcased en el API de Webpay se transformó a snakecased:

initTransaction(amount, buyOrder, returnURL, finalURL, sessionId)

se traduce en:

init_transaction(amount, buy_order, return_url, final_url, session_id)

Servicio Oneclick Mall

El método authorize espera una lista de tbk.services.StoreInput en el parámetro stores_input que se corresponde con la definición de wsOneClickMulticodeStorePaymentInput.

Documentación

La documentación oficial se encuentra disponible en http://www.transbankdevelopers.cl/?m=api. La documentación de esta librería está en desarrollo.

Loggers

Se encuentran definidos dos niveles de logger:

tbk.services
tbk.soap

El logger específico de un servicio está definido por su nombre de clase:

tbk.services.WebpayService

Testing cards / Tarjetas de prueba

Credit / Crédito

Marca

VISA

MASTERCARD

No de Tarjeta

4051885600446623

5186059559590568

Año Expiración

Cualquiera

Cualquiera

CVV

123

123

Resultado

APROBADO

RECHAZADO

Debit / Débito

APRUEBA

RECHAZA

TARJETA

4051885600446620

5186059559590560

RUT

11.111.111-1

11.111.111-1

PASSWORD

123

123

Release files for pancho-tbk 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pancho-tbk 0.3.0
File Size Uploaded
pancho-tbk-0.3.0.tar.gz 13.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pancho-tbk 0.3.0
File Interpreter ABI Platform
pancho_tbk-0.3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 30.6 kB

Release files / pancho-tbk-0.3.0.tar.gz

Download URL pancho-tbk-0.3.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f14bc581f43ccd5c007915be4b70ed406117cd714ac4834389651dd2def4955f
BLAKE2b-256 checksum
How to use checksums
87250c1c2c1f1c0bb7a7e231a7b40cce79250389670ba4de543ddcda91ee2e6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.2 CPython/3.7.6 Darwin/19.6.0

Release files / pancho_tbk-0.3.0-py2.py3-none-any.whl

Download URL pancho_tbk-0.3.0-py2.py3-none-any.whl
Size 16.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
af773411b1d6f258acb66d0ef2c3aebd57bab33e6cf4dac7779b7d7ebb3d7db8
BLAKE2b-256 checksum
How to use checksums
da8cfb9221476b6808ff251131ebc298bec028350ea52996ad1f9bcda0869eee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.2 CPython/3.7.6 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page