Project

smartcoin

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby library to SmartCoin API - https://smartcoin.com.br
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 10.4, ~> 10.4
>= 3.1, ~> 3.1

Runtime

>= 1.7, ~> 1.7
 Project Readme

Build Status Dependency Status

Visite Smartcoin para cadastrar uma conta.

#Vamos fazer

Exemplos de uso:

Smartcoin.api_key('pk_test_407d1f51a61756') #Troque as chaves do demo para as suas de test ou live
Smartcoin.api_secret('sk_test_86e4486a0078b2') #Troque as chaves do demo para as suas de test ou live

#Create Charge with card information
begin
	charge = Smartcoin::Charge.create({
		amount: 100,
		currency: 'brl',
		card: {
			number:  4242424242424242,
	    exp_month: 11,
	    exp_year: 2017,
	    cvc: '041'
	  }
	})
puts charge.to_json
rescue Smartcoin::SmartcoinError => e
	puts e.json_message
end

#Create Charge with token as card param
begin
	charge = Smartcoin::Charge.create({
		amount: 100,
		currency: 'brl',
		card: 'tok_123344555666'
	})
	puts charge.to_json
rescue Smartcoin::SmartcoinError => e
	puts e.json_message
end

#Create Bank Slip Charge
begin
	charge = Smartcoin::Charge.create({
		amount: 1000, 
		currency: 'brl', 
		type: 'bank_slip'
	})
	puts charge.to_json
rescue Smartcoin::SmartcoinError => e
	puts e.json_message
end

#Create Subscription
begin
	card = {number:  4242424242424242, exp_month: 5, exp_year: 2017, cvc: '011', name: 'Doctor Who'}
	customer = Smartcoin::Customer.create({
		email: 'test@example.com',
		card: card
	})

	sub = customer.subscriptions.create(plan: 'silver')

	puts sub.to_json
rescue Smartcoin::SmartcoinError => e
	puts e.json_message
end

Veja os testes para mais opções.

#Teste

Para executar a suite de teste:

rspec ./test