Giter Site home page Giter Site logo

khipu's Introduction

Python wrapper for the Khipu API

Khipu es un servicio que facilita los cobros y la facturación web en Chile.

Para comenzar a escribir el código me base en la biblioteca php https://github.com/Tifon-/Khipu

La documentación de Khipu.com se puede ver desde aquí: http://khipu.com/page/api

Instalación

pip install git+https://github.com/jrperdomoz/khipu

Ejemplos

1) Verificar Estado de una cuenta Khipu

Este servicio permite consultar el estado de una cuenta khipu, la cual retorna un json mencionando el ambiente en que se encuentra y si puede recibir pagos. A continuación un ejemplo:

from khipu import Khipu
api = Khipu('receiver_id', 'secret_key')
api.service('ReceiverStatus')
>> {u'type': u'production', u'ready_to_collect': True}

2) Crear URL para un pago

Con esta opción puedes crear un pago desde tu servidor y obtener la URL para enviar a pagar a tus pagadores (tanto en escritorios como aplicaciones móviles).

from khipu import Khipu
api = Khipu('receiver_id', 'secret_key')
data = {
    'subject': 'El asunto del cobro',
    'body': 'Descripción del cobro',
    'amount': '200',
    'payer_email': '[email protected]',
    'bank_id': '',
    'expires_date': 'Formato Unix timestamp. Debe corresponder a una fecha en el futuro.',
    'transaction_id': 'T-1000',
    'custom': '',
    'notify_url': 'http://yourwebsite.cl/notificame/',
    'return_url': 'http://yourwebsite.cl/exito/',
    'cancel_url': '',
    'picture_url': ''
}
result = api.service('CreatePaymentURL', **data)
print result
>> {
    "id":"5wb665tyvm1p",
    "bill-id":"SSRwa",
    "url":"https://khipu.com/payment/show/5wb665tyvm1p",
    "manual-url":"https://khipu.com/payment/manual/5wb665tyvm1p",
    "mobile-url":"khipu:///pos/5wb665tyvm1p",
    "ready-for-terminal":false
  }

khipu's People

Contributors

ionatan-israel avatar

Watchers

James Cloos avatar João Carlos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.