v1

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 1 Imported by: 7

Documentation

Index

Constants

View Source
const (
	RouteCreateCustomer = "/customer/create"
	RouteListCustomers  = "/customer/list"
)
View Source
const (
	RouteCreateCharge = "/billing/create"
	RouteListCharges  = "/billing/list"
)
View Source
const (
	RouteCreatePIXQRCode = "/pixQrCode/create"
	RouteSimulatePayment = "/pixQrCode/simulate-payment"
	RouteCheckQRCodePIX  = "/pixQrCode/check"
)
View Source
const (
	RouteCreateCoupon = "/coupon/create"
	RouteListCoupons  = "/coupon/list"
)
View Source
const (
	RouteCreateWithdraw = "/withdraw/create"
	RouteGetWithdraw    = "/withdraw/get"
	RouteListWithdraws  = "/withdraw/list"
)
View Source
const (
	RouteGetMRR      = "/public-mrr/mrr"
	RouteGetMerchant = "/public-mrr/merchant-info"
	RouteGetRevenue  = "/public-mrr/revenue"
)
View Source
const APIBaseURL = "https://api.abacatepay.com/"
View Source
const APIVersion = "1"

Current AbacatePay API version - https://docs.abacatepay.com/pages/introduction

View Source
const RouteStoreDetails = "/store/get"

Variables

This section is empty.

Functions

func BuildCheckQRCodePIXStatusURL

func BuildCheckQRCodePIXStatusURL(params RESTGetCheckQRCodePixStatusQueryParams) string

func BuildGetWithdrawURL

func BuildGetWithdrawURL(params RESTGetSearchWithdrawQueryParams) string

func BuildSimulatePaymentURL

func BuildSimulatePaymentURL(params RESTPostSimulatePaymentQueryParams) string

Types

type APICharge

type APICharge struct {
	// Unique billing ID at AbacatePay.
	ID string `json:"id"`

	// Billing frequency. It can be "ONE_TIME" or "MULTIPLE_PAYMENTS".
	Frequency PaymentFrequency `json:"frequency"`

	// URL for your customer to make payment for the charge.
	URL string `json:"url"`

	// Billing status. Can be "PENDING", "EXPIRED", "CANCELLED", "PAID", "REFUNDED".
	Status PaymentStatus `json:"status"`

	// Indicates whether the charge was created in a development (true) or production (false) environment.
	DevMode bool

	// Supported payment types: "PIX" and "CARD" (beta).
	Methods []PaymentMethod `json:"methods"`

	// List of products included in the charge.
	Products []APIProduct `json:"products"`

	// Customer you are billing. Optional. See structure reference [here](https://docs.abacatepay.com/pages/payment/client/reference.mdx).
	Customer APICustomer `json:"customer"`

	// Object with metadata about the charge.
	Metadata APIChargeMetadata `json:"metadata"`

	// Date and time of next charge, or null for one-time charges.
	NextBilling *string `json:"nextBilling,omitempty"`

	// Whether or not to allow coupons for billing.
	AllowCoupons *bool `json:"allowCoupons,omitempty"`

	// Coupons allowed in billing. Coupons are only considered if "AllowCoupons" is true.
	Coupons []APICoupon `json:"coupons"`

	// Charge creation date and time.
	CreatedAt string `json:"createdAt"`

	// Charge last updated date and time.
	UpdatedAt string `json:"updatedAt"`
}

https://docs.abacatepay.com/pages/payment/reference#estrutura

type APIChargeMetadata

type APIChargeMetadata struct {
	// Fee applied by AbacatePay.
	Fee int `json:"fee"`

	// URL that the customer will be redirected to when clicking the “back” button.
	ReturnURL string `json:"returnUrl"`

	// URL that the customer will be redirected to when making payment.
	CompletionURL string `json:"completionUrl"`
}

https://docs.abacatepay.com/pages/payment/reference#metadata

type APICoupon

type APICoupon struct {
	// Unique coupon code that your customers will use to apply the discount.
	ID string `json:"id"`

	// Type of discount applied by the coupon.
	DiscountKind CouponDiscountKind `json:"discountKind"`

	// Discount amount.
	// For `PERCENTAGE` use numbers from 1-100 (ex: 10 = 10%).
	// For `FIXED` use the value in cents (ex: 500 = R$5.00).
	Discount int `json:"discount"`

	// Limit on the number of times the coupon can be used.
	// Use `-1` for unlimited coupons.
	MaxRedeems int `json:"maxRedeems"`

	// Counter of how many times the coupon has been used by customers.
	RedeemsCount int `json:"redeemsCount"`

	// Coupon status.
	Status CouponStatus `json:"status"`

	// Indicates whether the coupon was created in a development (true)
	// or production (false) environment.
	DevMode bool `json:"devMode"`

	// Internal description of the coupon for your organization and control.
	Notes *string `json:"notes,omitempty"`

	// Coupon creation date and time (ISO 8601).
	CreatedAt string `json:"createdAt"`

	// Coupon last updated date and time (ISO 8601).
	UpdatedAt string `json:"updatedAt"`

	// Additional custom metadata.
	Metadata map[string]any `json:"metadata,omitempty"`
}

https://docs.abacatepay.com/pages/coupon/reference#estrutura

type APICustomer

type APICustomer struct {
	// Unique customer identifier.
	ID string `json:"id"`

	// Customer data.
	Metadata APICustomerMetadata `json:"metadata"`
}

https://docs.abacatepay.com/pages/client/reference#estrutura

type APICustomerMetadata

type APICustomerMetadata struct {
	// Customer's full name.
	Name string `json:"name"`

	// Customer's email.
	Email string `json:"email"`

	// Customer's CPF or CNPJ.
	TaxID string `json:"taxId"`

	// Customer's cell phone.
	Cellphone string `json:"cellphone"`
}

https://docs.abacatepay.com/pages/client/reference#metadados

type APIProduct

type APIProduct struct {
	// The product id on your system. We use this id to create your product on AbacatePay automatically, so make sure your id is unique.
	ExternalID string `json:"externalId"`

	// Product name.
	Name string `json:"name"`

	// Quantity of product being purchased.
	Quantity int `json:"quantity"`

	// Price per unit of product in cents. The minimum is 100 (1 BRL).
	Price int `json:"price"`

	Description *string `json:"description,omitempty"`
}

https://docs.abacatepay.com/pages/payment/reference#products

type APIQRCodePIX

type APIQRCodePIX struct {
	// Unique billing identifier.
	ID string `json:"id"`

	// Charge amount in cents (e.g. 4000 = R$40.00).
	Amount int `json:"amount"`

	// Billing status. Can be "PENDING", "EXPIRED", "CANCELLED", "PAID", "REFUNDED".
	Status PaymentStatus `json:"status"`

	// Indicates whether the charge is in a testing (true) or production (false) environment.
	DevMode bool `json:"devMode"`

	// PIX code (copy-and-paste) for payment.
	BrCode string `json:"brCode"`

	// PIX code in Base64 format (Useful for displaying in images).
	BrCodeBase64 string `json:"brCodeBase64"`

	// Platform fee in cents. Example: 80 means R$0.80.
	PlatformFee int `json:"platformFee"`

	// Payment description.
	Description string `json:"description"`

	// Payment metadata.
	Metadata map[string]any `json:"metadata,omitempty"`

	// QRCode PIX creation date and time.
	CreatedAt string `json:"createdAt"`

	// QRCode PIX last updated date and time.
	UpdatedAt string `json:"updatedAt"`

	// QRCode expiration date and time.
	ExpiresAt string `json:"expiresAt"`
}

https://docs.abacatepay.com/pages/pix-qrcode/reference#estrutura

type APIResponse

type APIResponse[D any] struct {
	/// The data of the response.
	Data *D `json:"data,omitempty"`

	// Error message returned from the API.
	Error *string `json:"error,omitempty"`
}

func (*APIResponse[D]) IsError

func (response *APIResponse[D]) IsError() bool

Checks whether the response of the API is an error or not

type APIStore

type APIStore struct {
	// Unique identifier for your store on AbacatePay.
	ID string `json:"id"`

	// Name of your store/company.
	// Example: "Minha Loja Online"
	Name string `json:"name"`

	// Object containing information about your account balances.
	// All balance values ​​are returned in cents. To convert to Reais, divide by 100. For example: 15000 cents = R$150.00
	Balance APIStoreBalance `json:"balance"`
}

https://docs.abacatepay.com/pages/store/reference#estrutura

type APIStoreBalance

type APIStoreBalance struct {
	// Balance available for withdrawal in cents.
	Available int `json:"available"`

	// Balance pending confirmation in cents.
	Pending int `json:"pending"`

	// Balance blocked in disputes in cents.
	// The blocked balance represents amounts that are in dispute or under review. These amounts are not available for withdrawal until the situation is resolved.
	Blocked int `json:"blocked"`
}

https://docs.abacatepay.com/pages/store/reference#balance

type APIWithdraw

type APIWithdraw struct {
	// Unique ID of the AbacatePay withdrawal transaction.
	ID string `json:"id"`

	// Current status of the withdrawal transaction.
	Status WithdrawStatus `json:"status"`

	// Indicates whether the loot was created in a development environment (sandbox) or production. AbacatePay currently only supports withdrawals in production.
	DevMode bool `json:"devMode"`

	// Withdrawal transaction receipt URL.
	ReceiptURL string `json:"receiptUrl"`

	// Withdrawal value in cents.
	Amount int `json:"amount"`

	// Platform fee charged for withdrawal in cents.
	PlatformFee int `json:"platformFee"`

	// Unique identifier of the withdrawal in your system. Optional.
	ExternalID *string `json:"externalId,omitempty"`

	// Date and time of withdrawal creation.
	CreatedAt string `json:"createdAt"`

	// Date and time of last withdrawal update.
	UpdatedAt string `json:"updatedAt"`
}

https://docs.abacatepay.com/pages/withdraw/reference#estrutura

type BaseWebhookEvent

type BaseWebhookEvent struct {
	// Unique identifier for the webhook.
	ID string `json:"id"`

	// Event type.
	Event WebhookEventType `json:"event"`

	// Indicates whether the event occurred in dev mode.
	DevMode bool `json:"devMode"`
}

type CouponStatus

type CouponStatus string

https://docs.abacatepay.com/pages/coupon/reference#status

const (
	CouponStatusActive   CouponStatus = "ACTIVE"
	CouponStatusDeleted  CouponStatus = "DELETED"
	CouponStatusDisabled CouponStatus = "DISABLED"
)

https://docs.abacatepay.com/pages/coupon/reference#status

type PaymentFrequency

type PaymentFrequency string

https://docs.abacatepay.com/pages/payment/reference#frequency

const (
	PaymentFrequencyOneTime          PaymentFrequency = "ONE_TIME"
	PaymentFrequencyMultiplePayments PaymentFrequency = "MULTIPLE_PAYMENTS"
)

https://docs.abacatepay.com/pages/payment/reference#frequency

type PaymentStatus

type PaymentStatus string

// https://docs.abacatepay.com/pages/payment/reference#atributos

const (
	PaymentStatusPending   PaymentStatus = "PENDING"
	PaymentStatusExpired   PaymentStatus = "EXPIRED"
	PaymentStatusCancalled PaymentStatus = "CANCELLED"
	PaymentStatusPaid      PaymentStatus = "PAID"
	PaymentStatusRefunded  PaymentStatus = "REFUNDED"
)

https://docs.abacatepay.com/pages/payment/reference#atributos

type PixKeyType

type PixKeyType string
const (
	PixKeyCPF    PixKeyType = "CPF"
	PixKeyCNPJ   PixKeyType = "CNPJ"
	PixKeyPhone  PixKeyType = "PHONE"
	PixKeyEmail  PixKeyType = "EMAIL"
	PixKeyRandom PixKeyType = "RANDOM"
	PixKeyBRCode PixKeyType = "BR_CODE"
)

type RESTChargeProduct

type RESTChargeProduct struct {
	// The product id on your system. We use this id to create your product on AbacatePay automatically, so make sure your id is unique.
	ExternalID string `json:"externalId"`

	// Product name.
	Name string `json:"name"`

	// Quantity of product being purchased.
	Quantity int `json:"quantity"`

	// Price per unit of product in cents. The minimum is 100 (1 BRL).
	Price int `json:"price"`

	// Detailed product description.
	Description *string `json:"description,omitempty"`
}

type RESTCreateCouponData

type RESTCreateCouponData struct {
	// Unique coupon identifier.
	Code string `json:"code"`

	// Discount amount to be applied.
	Discount int `json:"discount"`

	// Type of discount applied, percentage or fixed.
	DiscountKind CouponDiscountKind `json:"discountKind"`

	// Coupon description.
	Notes *string `json:"notes,omitempty"`

	// Number of times the coupon can be redeemed. -1 means this coupon can be redeemed without limits.
	// Default -1
	MaxRedeems *int `json:"maxRedeems,omitempty"`

	// Key value object for coupon metadata.
	Metadata map[string]any `json:"metadata,omitempty"`
}

type RESTGetCheckQRCodePixStatusQueryParams

type RESTGetCheckQRCodePixStatusQueryParams struct {
	// QRCode Pix ID.
	ID string `json:"id"`
}

https://api.abacatepay.com/v1/pixQrCode/check

type RESTGetRevenueByPeriodQueryParams

type RESTGetRevenueByPeriodQueryParams struct {
	// Period start date (YYYY-MM-DD format).
	StartDate string `json:"startDate"`

	// Period end date (YYYY-MM-DD format).
	EndDate string `json:"endDate"`
}

https://api.abacatepay.com/v1/public-mrr/revenue

type RESTGetSearchWithdrawData added in v1.0.2

type RESTGetSearchWithdrawData = APIResponse[APIWithdraw]

type RESTGetSearchWithdrawQueryParams

type RESTGetSearchWithdrawQueryParams struct {
	// Unique identifier of the withdrawal in your system.
	ExternalID string `json:"externalId"`
}

https://api.abacatepay.com/v1/withdraw/get

type RESTMRRInfo

type RESTMRRInfo struct {
	// Monthly recurring revenue in cents. Value 0 indicates that there is no recurring revenue at the moment.
	MRR int `json:"mrr"`

	// Total active subscriptions. Value 0 indicates that there are no currently active subscriptions.
	TotalActiveSubscriptions int `json:"totalActiveSubscriptions"`
}

type RESTMerchantInfo

type RESTMerchantInfo struct {
	// Store name.
	Name string `json:"name"`

	// Store website.
	Website string `json:"website"`

	// Store creation date.
	CreatedAt string `json:"createdAt"`
}

type RESTPostCreateCouponBody

type RESTPostCreateCouponBody struct {
	// Coupon data.
	Data RESTCreateCouponData `json:"data"`
}

https://api.abacatepay.com/v1/coupon/create

type RESTPostCreateNewChargeBody

type RESTPostCreateNewChargeBody struct {
	// Payment methods that will be used. Currently, only `PIX` is supported, `CARD` is in beta.
	Methods []PaymentMethod `json:"methods"`

	// Defines the type of billing frequency. For one-time charges, use "ONE_TIME". For charges that can be paid more than once, use "MULTIPLE_PAYMENTS".
	Frequency PaymentFrequency `json:"frequency"`

	// List of products your customer is paying for.
	Products []RESTChargeProduct `json:"products"`

	// URL to redirect the customer if they click on the "Back" option.
	ReturnURL string `json:"returnUrl"`

	// URL to redirect the customer when payment is completed.
	CompletionURL string `json:"completionUrl"`

	// The ID of a customer already registered in your store.
	CustomerID *string `json:"customerId,omitempty"`

	// Your customer's data to create it.
	// The customer object is not mandatory, but when entering any `customer` information, all `name`, `cellphone`, `email` and `taxId` fields are mandatory.
	Customer *APICustomerMetadata `json:"customer,omitempty"`

	// If true coupons can be used in billing.
	// Default false
	AllowCoupons *bool `json:"allowCoupons,omitempty"`

	// List of coupons available for resem used with billing (0-50 max.).
	Coupons []string `json:"coupons,omitempty"`

	// If you have a unique identifier for your billing application, completely optional.
	ExternalID *string `json:"externalId,omitempty"`

	// Optional billing metadata.
	Metadata map[string]any `json:"metadata,omitempty"`
}

https://api.abacatepay.com/v1/billing/create

type RESTPostCreateNewWithdrawBody

type RESTPostCreateNewWithdrawBody struct {
	// Unique identifier of the withdrawal in your system.
	ExternalID string `json:"externalId"`

	// Always "PIX"
	Method string `json:"method"`

	// Withdrawal value in cents (Min 350).
	Amount int `json:"amount"`

	// PIX key data to receive the withdrawal.
	Pix struct {
		// PIX key type.
		Key string `json:"key"`

		// PIX key value.
		Type PixKeyType `json:"type"`
	} `json:"pix"`

	// Optional description of the withdrawal.
	Description *string `json:"description,omitempty"`
}

https://api.abacatepay.com/v1/withdraw/create

type RESTPostCreateQRCodePixBody

type RESTPostCreateQRCodePixBody struct {
	// Charge amount in cents.
	Amount int `json:"amount"`

	// Billing expiration time in seconds.
	ExpiresIn *int `json:"expiresIn,omitempty"`

	// Message that will appear when paying the PIX.
	Description *string `json:"description,omitempty"`

	// Your customer's data to create it.
	// The customer object is not mandatory, but when entering any `customer` information, all `name`, `cellphone`, `email` and `taxId` fields are mandatory.
	Customer *APICustomerMetadata `json:"customer,omitempty"`

	// Optional billing metadata.
	Metadata map[string]any `json:"metadata,omitempty"`
}

https://api.abacatepay.com/v1/pixQrCode/create

type RESTPostSimulatePaymentQueryParams

type RESTPostSimulatePaymentQueryParams struct {
	// QRCode Pix ID.
	ID string `json:"id"`
}

https://api.abacatepay.com/v1/pixQrCode/simulate-payment

type RESTQRCodePixStatus

type RESTQRCodePixStatus struct {
	// QRCode Pix expiration date.
	ExpiresAt string `json:"expiresAt"`

	// Information about the progress of QRCode Pix.
	Status PaymentStatus `json:"status"`
}

type WebhookBillingPaidBilling

type WebhookBillingPaidBilling struct {
	Amount      int              `json:"amount"`
	CouponsUsed []string         `json:"couponsUsed"`
	Customer    APICustomer      `json:"customer"`
	Frequency   PaymentFrequency `json:"frequency"`
	ID          string           `json:"id"`

	// @unstable
	Kind []PaymentMethod `json:"kind"`

	// @unstable
	PaidAmount int `json:"paidAmount"`

	Products []APIProduct `json:"products"`

	Status PaymentStatus `json:"status"` // Always PAID
}

type WebhookBillingPaidEvent

type WebhookBillingPaidEvent struct {
	BaseWebhookEvent

	Data struct {
		Payment WebhookBillingPaidPayment `json:"payment"`

		PixQrCode *WebhookBillingPaidPix     `json:"pixQrCode,omitempty"`
		Billing   *WebhookBillingPaidBilling `json:"billing,omitempty"`
	} `json:"data"`
}

https://docs.abacatepay.com/pages/webhooks#billing-paid

func (WebhookBillingPaidEvent) IsBilling

func (event WebhookBillingPaidEvent) IsBilling() bool

func (WebhookBillingPaidEvent) IsPix

func (event WebhookBillingPaidEvent) IsPix() bool

type WebhookBillingPaidPayment

type WebhookBillingPaidPayment struct {
	Amount int           `json:"amount"`
	Fee    int           `json:"fee"`
	Method PaymentMethod `json:"method"`
}

type WebhookBillingPaidPix

type WebhookBillingPaidPix struct {
	Amount int           `json:"amount"`
	ID     string        `json:"id"`
	Kind   PaymentMethod `json:"kind"`   // Always PIX
	Status PaymentStatus `json:"status"` // Always PAID
}

type WebhookEnvelope

type WebhookEnvelope struct {
	Event WebhookEventType `json:"event"`
}

func (WebhookEnvelope) IsBillingPaid

func (event WebhookEnvelope) IsBillingPaid() bool

func (WebhookEnvelope) IsWithdrawDone

func (event WebhookEnvelope) IsWithdrawDone() bool

func (WebhookEnvelope) IsWithdrawFailed

func (event WebhookEnvelope) IsWithdrawFailed() bool

type WebhookEventType

type WebhookEventType string

https://docs.abacatepay.com/pages/webhooks#eventos-suportados

const (
	WebhookEventWithdrawFailed WebhookEventType = "withdraw.failed"
	WebhookEventWithdrawDone   WebhookEventType = "withdraw.done"
	WebhookEventBillingPaid    WebhookEventType = "billing.paid"
)

https://docs.abacatepay.com/pages/webhooks#eventos-suportados

type WebhookWithdrawDoneEvent

type WebhookWithdrawDoneEvent struct {
	BaseWebhookEvent

	Data struct {
		// Status is always COMPLETE.
		Transaction APIWithdraw `json:"transaction"`
	} `json:"data"`
}

https://docs.abacatepay.com/pages/webhooks#withdraw-done

type WebhookWithdrawFailedEvent

type WebhookWithdrawFailedEvent struct {
	BaseWebhookEvent

	Data struct {
		// Status is always CANCELLED.
		Transaction APIWithdraw `json:"transaction"`
	} `json:"data"`
}

https://docs.abacatepay.com/pages/webhooks#withdraw-failed

type WithdrawStatus

type WithdrawStatus string

https://docs.abacatepay.com/pages/withdraw/reference#atributos

const (
	WithdrawStatusPending   WithdrawStatus = "PENDING"
	WithdrawStatusExpired   WithdrawStatus = "EXPIRED"
	WithdrawStatusCancelled WithdrawStatus = "CANCELLED"
	WithdrawStatusComplete  WithdrawStatus = "COMPLETE"
	WithdrawStatusRefunded  WithdrawStatus = "REFUNDED"
)

https://docs.abacatepay.com/pages/withdraw/reference#atributos

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL