The package can be installed by adding abacatepay to your list of dependencies in mix.exs:
def deps do
[
{:abacatepay, "~> 0.2.0"}
]
endThe 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"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){:ok, customers} = AbacatePay.Customer.list()# 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){:ok, billings} = AbacatePay.Billing.list()%AbacatePay.Customer{
id: "cust_aebxkhDZNaMmJeKsy0AHS0FQ",
name: "Daniel Lima",
tax_id: "123.456.789-01",
email: "daniel_lima@abacatepay.com",
cellphone: "+5511999999999"
}%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]
}