Skip to content

AbacatePay/abacatepay-elixir-sdk

 
 

AbacatePay Elixir

Official AbacatePay Elixir SDK to integrate payments via PIX in a simple, secure and fast way.

AbacatePay Open Source

Build Status Hex.pm Hex Docs

Installation

The package can be installed by adding abacatepay to your list of dependencies in mix.exs:

def deps do
  [
    {:abacatepay, "~> 0.2.0"}
  ]
end

Configuration

The SDK has a range of configuration options, but most applications will have a configuration that looks like the following:

# config/config.exs
config :abacatepay,
  api_key: "abc_dev_pWxM5GhSROzeerqmdkfu6mNN"

Features

Customer Operations

Create Customer

Create a new customer in the AbacatePay system.

customer_data = [
  name: "Daniel Lima",
  tax_id: "123.456.789-01",
  email: "daniel_lima@abacatepay.com",
  cellphone: "+5511999999999"
]

{:ok, customer} = AbacatePay.Customer.create(customer_data)

List Customers

Retrieve a list of all customers.

{:ok, customers} = AbacatePay.Customer.list()

Billing Operations

Create Billing

Create a new billing for a customer.

# The customer associated with the Billing
customer = %AbacatePay.Customer{
  id: "cust_aebxkhDZNaMmJeKsy0AHS0FQ",
  name: "Daniel Lima",
  tax_id: "123.456.789-01",
  email: "daniel_lima@abacatepay.com",
  cellphone: "+5511999999999"
}

# The products to be included in the Billing
products = [
  %AbacatePay.Product{
    name: "Product 1",
    price: 5000,
    quantity: 1
  },
  %AbacatePay.Product{
    name: "Product 2",
    price: 3000,
    quantity: 2
  }
]

billing_data = [
  frequency: :one_time,
  methods: [:pix, :card],
  products: products,
  customer: customer,
  return_url: "https://example.com/return",
  completion_url: "https://example.com/completion",
  allow_coupons: true,
  coupons: ["DEYVIN_20"],
  external_id: "order_0001",
  metadata: %{"notes" => "First order"}
]

{:ok, billing} = AbacatePay.Billing.create(billing_data)

List Billings

Retrieve a list of all billings.

{:ok, billings} = AbacatePay.Billing.list()

Response Types

Customer Response

%AbacatePay.Customer{
  id: "cust_aebxkhDZNaMmJeKsy0AHS0FQ",
  name: "Daniel Lima",
  tax_id: "123.456.789-01",
  email: "daniel_lima@abacatepay.com",
  cellphone: "+5511999999999"
}

Billing Response

%AbacatePay.Billing{
  id: "bill_aebxkhDZNaMmJeKsy0AHS0FQ",
  frequency: :one_time,
  url: "https://app.abacatepay.com/pay/bill_aebxkhDZNaMmJeKsy0AHS0FQ",
  status: :pending,
  dev_mode: false,
  methods: [:pix, :card],
  products: [%AbacatePay.Product{name: "Product 1", price: 5000, quantity: 1}, %AbacatePay.Product{name: "Product 2", price: 3000, quantity: 2}],
  customer: %AbacatePay.Customer{id: "cust_aebxkhDZNaMmJeKsy0AHS0FQ", name: "Daniel Lima", cellphone: "+5511999999999", email: "daniel_lima@abacatepay.com", tax_id: "123.456.789-01"},
  metadata: %{fee: 80, return_url: "https://example.com/return", completion_url: "https://example.com/completion"},
  next_billing: nil,
  allow_coupons: true,
  coupons: ["DEYVIN_20"],
  created_at: ~U[2026-01-01T12:00:00Z],
  updated_at: ~U[2026-01-02T12:00:00Z]
}

About

AbacatePay Elixir SDK for you to start receiving payments in seconds

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages

  • Elixir 100.0%