Documentation
¶
Index ¶
- Constants
- func BuildCheckQRCodePIXStatusURL(params RESTGetCheckQRCodePixStatusQueryParams) string
- func BuildGetWithdrawURL(params RESTGetSearchWithdrawQueryParams) string
- func BuildSimulatePaymentURL(params RESTPostSimulatePaymentQueryParams) string
- type APICharge
- type APIChargeMetadata
- type APICoupon
- type APICustomer
- type APICustomerMetadata
- type APIProduct
- type APIQRCodePIX
- type APIResponse
- type APIStore
- type APIStoreBalance
- type APIWithdraw
- type BaseWebhookEvent
- type CouponDiscountKind
- type CouponStatus
- type PaymentFrequency
- type PaymentMethod
- type PaymentStatus
- type PixKeyType
- type RESTChargeProduct
- type RESTCreateCouponData
- type RESTGetCheckQRCodePixStatusData
- type RESTGetCheckQRCodePixStatusQueryParams
- type RESTGetListBillingsData
- type RESTGetListCouponsData
- type RESTGetListCustomersData
- type RESTGetListWithdrawsData
- type RESTGetMRRData
- type RESTGetMerchantData
- type RESTGetRevenueByPeriodQueryParams
- type RESTGetSearchWithdrawData
- type RESTGetSearchWithdrawQueryParams
- type RESTGetStoreDetailsData
- type RESTMRRInfo
- type RESTMerchantInfo
- type RESTPostCreateCouponBody
- type RESTPostCreateCouponData
- type RESTPostCreateCustomerBody
- type RESTPostCreateCustomerData
- type RESTPostCreateNewChargeBody
- type RESTPostCreateNewChargeData
- type RESTPostCreateNewWithdrawBody
- type RESTPostCreateNewWithdrawData
- type RESTPostCreateQRCodePixBody
- type RESTPostCreateQRCodePixData
- type RESTPostSimulatePaymentData
- type RESTPostSimulatePaymentQueryParams
- type RESTQRCodePixStatus
- type WebhookBillingPaidBilling
- type WebhookBillingPaidEvent
- type WebhookBillingPaidPayment
- type WebhookBillingPaidPix
- type WebhookEnvelope
- type WebhookEventType
- type WebhookWithdrawDoneEvent
- type WebhookWithdrawFailedEvent
- type WithdrawStatus
Constants ¶
const ( RouteCreateCustomer = "/customer/create" RouteListCustomers = "/customer/list" )
const ( RouteCreateCharge = "/billing/create" RouteListCharges = "/billing/list" )
const ( RouteCreatePIXQRCode = "/pixQrCode/create" RouteSimulatePayment = "/pixQrCode/simulate-payment" RouteCheckQRCodePIX = "/pixQrCode/check" )
const ( RouteCreateCoupon = "/coupon/create" RouteListCoupons = "/coupon/list" )
const ( RouteCreateWithdraw = "/withdraw/create" RouteGetWithdraw = "/withdraw/get" RouteListWithdraws = "/withdraw/list" )
const ( RouteGetMRR = "/public-mrr/mrr" RouteGetMerchant = "/public-mrr/merchant-info" RouteGetRevenue = "/public-mrr/revenue" )
const APIBaseURL = "https://api.abacatepay.com/"
const APIVersion = "1"
Current AbacatePay API version - https://docs.abacatepay.com/pages/introduction
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"`
}
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"`
}
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 CouponDiscountKind ¶
type CouponDiscountKind string
https://docs.abacatepay.com/pages/coupon/reference#discountkind
const ( CouponDiscountKindFixed CouponDiscountKind = "FIXED" CouponDiscountKindPercentage CouponDiscountKind = "PERCENTAGE" )
https://docs.abacatepay.com/pages/coupon/reference#discountkind
type CouponStatus ¶
type CouponStatus string
https://docs.abacatepay.com/pages/coupon/reference#status
const ( CouponStatusActive CouponStatus = "ACTIVE" CouponStatusDeleted CouponStatus = "DELETED" CouponStatusDisabled CouponStatus = "DISABLED" )
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 PaymentMethod ¶
type PaymentMethod string
https://docs.abacatepay.com/pages/payment/reference#methods
const ( PaymentMethodPix PaymentMethod = "PIX" PaymentMethodCard PaymentMethod = "CARD" )
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 RESTGetCheckQRCodePixStatusData ¶
type RESTGetCheckQRCodePixStatusData = APIResponse[RESTQRCodePixStatus]
type RESTGetCheckQRCodePixStatusQueryParams ¶
type RESTGetCheckQRCodePixStatusQueryParams struct {
// QRCode Pix ID.
ID string `json:"id"`
}
type RESTGetListBillingsData ¶
type RESTGetListBillingsData = APIResponse[[]APICharge]
type RESTGetListCouponsData ¶
type RESTGetListCouponsData = APIResponse[[]APICoupon]
type RESTGetListCustomersData ¶
type RESTGetListCustomersData = APIResponse[[]APICustomer]
type RESTGetListWithdrawsData ¶
type RESTGetListWithdrawsData = APIResponse[[]APIWithdraw]
type RESTGetMRRData ¶
type RESTGetMRRData = APIResponse[RESTMRRInfo]
type RESTGetMerchantData ¶
type RESTGetMerchantData = APIResponse[RESTMerchantInfo]
type RESTGetRevenueByPeriodQueryParams ¶
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"`
}
type RESTGetStoreDetailsData ¶
type RESTGetStoreDetailsData = APIResponse[APIStore]
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 RESTPostCreateCouponBody ¶
type RESTPostCreateCouponBody struct {
// Coupon data.
Data RESTCreateCouponData `json:"data"`
}
type RESTPostCreateCouponData ¶
type RESTPostCreateCouponData = APIResponse[APICoupon]
type RESTPostCreateCustomerBody ¶
type RESTPostCreateCustomerBody = APICustomerMetadata
type RESTPostCreateCustomerData ¶
type RESTPostCreateCustomerData = APIResponse[APICustomer]
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"`
}
type RESTPostCreateNewChargeData ¶
type RESTPostCreateNewChargeData = APIResponse[APICharge]
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"`
}
type RESTPostCreateNewWithdrawData ¶
type RESTPostCreateNewWithdrawData = APIResponse[APIWithdraw]
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"`
}
type RESTPostCreateQRCodePixData ¶
type RESTPostCreateQRCodePixData = APIResponse[APIQRCodePIX]
type RESTPostSimulatePaymentData ¶
type RESTPostSimulatePaymentData = APIResponse[APIQRCodePIX]
type RESTPostSimulatePaymentQueryParams ¶
type RESTPostSimulatePaymentQueryParams struct {
// QRCode Pix ID.
ID string `json:"id"`
}
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"`
}
type WebhookWithdrawFailedEvent ¶
type WebhookWithdrawFailedEvent struct {
BaseWebhookEvent
Data struct {
// Status is always CANCELLED.
Transaction APIWithdraw `json:"transaction"`
} `json:"data"`
}
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