Kobana

Integrate with your preferred language

Official libraries maintained by Kobana to accelerate your integration. Clean, well-documented code ready for production.

RubyPHPPythonNode.js
Developer illustration with Ruby, PHP, Python and Node.js logos

Common Features

Simple Authentication

Configure once, use in all requests.

Error Handling

Typed exceptions for each API error type.

Automatic Retries

Auto retry with exponential backoff for network errors.

Easy Pagination

Iterators and helpers to navigate through paginated results.

Complete Typing

TypeScript definitions, type hints (Python), PHPDoc.

Integrated Logging

Debug mode to inspect requests and responses.

Official SDKs

💎

Ruby

Official
gem install kobana
# Gemfile: gem 'kobana'

Configuration

require 'kobana'

Kobana.configure do |config|
  config.access_token = ENV['KOBANA_ACCESS_TOKEN']
  config.environment = :production # or :sandbox
end

Usage example

# Create bank slip
boleto = Kobana::Charge::BankBillet.create(
  amount: 150.50,
  expire_at: Date.today + 30,
  customer_person_name: 'John Smith',
  customer_cnpj_cpf: '12345678901',
  description: 'January/2025 Monthly Fee',
  bank_billet_account_id: 123
)

puts boleto.uid
puts boleto.url

# List bank slips
boletos = Kobana::Charge::BankBillet.all(status: 'opened', per_page: 50)
boletos.each { |b| puts "#{b.uid}: R$ #{b.amount}" }

# Create PIX charge
pix = Kobana::Charge::Pix.create(
  amount: 50.00,
  expire_at: Date.today + 1,
  message: 'Service payment',
  pix_account_id: 456
)

puts pix.qrcode[:emv]
🐘

PHP

Official
composer require kobana/kobana-php-client

Configuration

<?php
require 'vendor/autoload.php';

use Kobana\Client;

$kobana = new Client([
    'access_token' => getenv('KOBANA_ACCESS_TOKEN'),
    'environment' => 'production' // or 'sandbox'
]);

Usage example

// Create bank slip
$boleto = $kobana->charge->bankBillets->create([
    'amount' => 150.50,
    'expire_at' => date('Y-m-d', strtotime('+30 days')),
    'customer_person_name' => 'John Smith',
    'customer_cnpj_cpf' => '12345678901',
    'description' => 'January/2025 Monthly Fee',
    'bank_billet_account_id' => 123
]);

echo $boleto->uid;
echo $boleto->url;

// List bank slips
$boletos = $kobana->charge->bankBillets->list([
    'status' => 'opened',
    'per_page' => 50
]);

foreach ($boletos->items as $b) {
    echo "{$b->uid}: R$ {$b->amount}\n";
}

// Create PIX charge
$pix = $kobana->charge->pix->create([
    'amount' => 50.00,
    'expire_at' => date('Y-m-d', strtotime('+1 day')),
    'message' => 'Service payment',
    'pix_account_id' => 456
]);

echo $pix->qrcode->emv;
🐍

Python

Official
pip install kobana

Configuration

from kobana import Kobana
import os

client = Kobana(
    access_token=os.environ['KOBANA_ACCESS_TOKEN'],
    environment='production'  # or 'sandbox'
)

Usage example

from datetime import date, timedelta

# Create bank slip
boleto = client.charge.bank_billets.create(
    amount=150.50,
    expire_at=(date.today() + timedelta(days=30)).isoformat(),
    customer_person_name='John Smith',
    customer_cnpj_cpf='12345678901',
    description='January/2025 Monthly Fee',
    bank_billet_account_id=123
)

print(boleto.uid)
print(boleto.url)

# List bank slips
boletos = client.charge.bank_billets.list(status='opened', per_page=50)
for b in boletos.items:
    print(f'{b.uid}: R$ {b.amount}')

# Create PIX charge
pix = client.charge.pix.create(
    amount=50.00,
    expire_at=(date.today() + timedelta(days=1)).isoformat(),
    message='Service payment',
    pix_account_id=456
)

print(pix.qrcode.emv)
🟢

Node.js

Official
npm install kobana
# or: yarn add kobana

Configuration

const Kobana = require('kobana');

const client = new Kobana({
  accessToken: process.env.KOBANA_ACCESS_TOKEN,
  environment: 'production' // or 'sandbox'
});

Usage example

// Create bank slip
const boleto = await client.charge.bankBillets.create({
  amount: 150.50,
  expireAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
  customerPersonName: 'John Smith',
  customerCnpjCpf: '12345678901',
  description: 'January/2025 Monthly Fee',
  bankBilletAccountId: 123
});

console.log(boleto.uid);
console.log(boleto.url);

// List bank slips
const boletos = await client.charge.bankBillets.list({
  status: 'opened',
  perPage: 50
});

boletos.items.forEach(b => {
  console.log(`${b.uid}: R$ ${b.amount}`);
});

// Create PIX charge
const pix = await client.charge.pix.create({
  amount: 50.00,
  expireAt: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
  message: 'Service payment',
  pixAccountId: 456
});

console.log(pix.qrcode.emv);

Ready to get started?

Create your sandbox account and test the integration in minutes.