Documentation Index
Fetch the complete documentation index at: https://docs.abacatepay.com/llms.txt
Use this file to discover all available pages before exploring further.
AbacatePay Go SDK
Repositório oficial — issues, changelog e contribuições.
Pré-requisitos
Instalação
go get github.com/AbacatePay/abacatepay-go-sdk
Configuração
Armazene sua chave de API em uma variável de ambiente e nunca no código:
import (
"os"
"time"
"github.com/AbacatePay/abacatepay-go-sdk/abacatepay"
)
client, err := abacatepay.New(&abacatepay.ClientConfig{
ApiKey: os.Getenv("ABACATEPAY_API_KEY"),
Timeout: 10 * time.Second,
})
if err != nil {
panic(err)
}
Primeira cobrança (PIX)
import (
"context"
"log"
"time"
"github.com/AbacatePay/abacatepay-go-sdk/v1/pix"
)
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
response, err := client.Pix.Create(ctx, &pix.CreateQrCodePIXBody{
Amount: 1000, // em centavos
})
if err != nil {
log.Fatal(err)
}
log.Printf("PIX criado: %s\n", response.Data.ID)
Resposta:
{
"success": true,
"error": null,
"data": {
"id": "pix_char_123456",
"amount": 1000,
"status": "PENDING",
"devMode": true,
"brCode": "00020101021226950014br.gov.bcb.pix...",
"createdAt": "2025-03-24T21:50:20.772Z",
"expiresAt": "2025-03-25T21:50:20.772Z"
}
}
Próximos passos
Configurar webhooks
Receba notificações em tempo real sobre pagamentos confirmados.
Checkout Transparente
Aceite PIX e cartão diretamente na sua interface.
Criar clientes
Gerencie clientes vinculados às cobranças.
Referência completa
Todos os endpoints, status codes e formato de resposta.