Socket
Book a DemoInstallSign in
Socket

inter_api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inter_api

3.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

InterApi

Wrapper de integração com a API v2 do Banco Inter.

Funcionalidades:

  • Autenticação
  • Pagamento Pix: get, create, update, refund

Instalação

Adicionar inter_api no Gemfile:

gem 'inter_api'

ou

bundle add inter_api

Instalar a gem:

bin/rails generate inter_api:install

Uso

Exemplo

Criar Pagamento PIX

# Instanciar o API client
api_client = InterApi::Client.new(crt: "./certificado_api_inter.crt", key: "./chave_api_inter.key", client_id: "123456", client_secret: "abcde", chave_pix: "1011121314", conta_corrente: "9876", scopes: "cobv.write cobv.read cob.write cob.read pix.write pix.read")
# É possível passar o parâmetro "test_mode" na instanciação do client, que vai definir se ele vai usar ambiente de teste ou produção. Por padrão é "false" (produção).
# Ao instanciar o objeto, cria um access_token e/ou valida a partir da data de expiração

# Criar um pagamento
response = api_client.create_payment(amount: 50.00, payer_tax_id: "123.123.123-01", payer_name: "João da Silva", expiration: 3600, solicitacao_pagador: "Compra de produto", info_adicionais: [ nome: "Produto", valor: "Produto 1"])
# retorna um objeto <Ac::AcObject>
puts response.txid # "123123"
puts response.status # "ATIVA"

# Obter um pagamento a partir do id
response = api_client.get_payment(payment.txid)
# retorna um objeto <Ac::AcObject>
puts response.txid # "123123"
puts response.status # "ATIVA"

# Atualizar um pagamento
response = api_client.update_payment(payment_id: payment.txid, status: "REMOVIDA_PELO_USUARIO_RECEBEDOR")
# retorna o objeto <Ac::AcObject> com o pagamento atualizado
puts response.status # "REMOVIDA_PELO_USUARIO_RECEBEDOR"

Métodos do Pagamento

# Reebolso de pagamento
response = api_client.refund_payment(end_to_end_id: "123", amount: 50.00, refund_nature: "ORIGINAL", description: "Reembolso")
# retorna um objeto <Ac::AcObject>
response.status # "EM_PROCESSAMENTO"

FAQs

Package last updated on 14 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.