smartcoin

The Smartcoin provides a Python REST APIs to create, process and manage payments.


Keywords
smartcoin, smartcoinpayments, rest, payment
License
MIT
Install
pip install smartcoin==0.1.2

Documentation

smartcoin-python

Smartcoin Python lib

InstalaĆ§Ć£o

InstalaĆ§Ć£o utilizando pip

Execute o comando:

$ pip install smartcoin

InstalaĆ§Ć£o via repositĆ³rio

Clone o cĆ³digo:

$ git clone git@github.com:smartcoinpayments/smartcoin-python.git

Execute o script de setup:

$ cd smartcoin-python
$ python setup.py install

DocumentaĆ§Ć£o

Visite smartcoin.com.br/api/ para consultar documentaĆ§Ć£o de referĆŖncia..

Exemplo de uso:

# Setup Account keys

import smartcoin

smartcoin.config(key='pk_test_407d1f51a61756',
                 secret='sk_test_86e4486a0078b2') # Replace keys by your account keys

# Create a Token with card information

TOKEN_DATA = {
    'number': '4242424242424242',
    'exp_month': '12',
    'exp_year': '2018',
    'name': 'Luke Skywalker',
    'cvc': '123'
}

try:
	token = smartcoin.Token().create(TOKEN_DATA)
except Exception, message:
	print message

# Create Charge with token as card param

try:
	smartcoin.Charge().create({
	    'amount': '100',
	    'currency': 'brl',
	    'capture': 'true',
	    'type': 'credit_card',
	    'card': token['id'],
	    'description': 'Smartcoin charge test for example@test.com'
	})
except Exception, message:
	print message


# Create Bank Slip Charge

try:
	smartcoin.Charge().create({
	    'amount': '100',
	    'currency': 'brl',
	    'capture': 'true',
	    'type': 'bank_slip'
	})
except Exception, message:
	print message	

# Create Subscription

try:
	smartcoin.Subscription().create('customer_id', {
    	'plan': 'plan_id'
	})
except Exception, message:
	print message

Teste

Para instalar a suƭte de testes, siga as intruƧƵes em:

https://pypi.python.org/pypi/unittest2

Para executar a suĆ­te de testes:

unit2

Autor

Originally by Felipe Tomaz.

Colaborador(es): Ricardo Caldeira