Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abacatepay/abacatepay-go-sdk
AbacatePay #Golang SDK for you to start receiving payments in seconds
https://github.com/abacatepay/abacatepay-go-sdk
Last synced: 21 days ago
JSON representation
AbacatePay #Golang SDK for you to start receiving payments in seconds
- Host: GitHub
- URL: https://github.com/abacatepay/abacatepay-go-sdk
- Owner: AbacatePay
- Created: 2024-12-01T19:51:49.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-14T15:00:32.000Z (26 days ago)
- Last Synced: 2024-12-14T16:18:56.807Z (26 days ago)
- Language: Go
- Size: 17.6 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# abacatepay-go-sdk
## Installation
```bash
go get github.com/AbacatePay/abacatepay-go-sdk
```## Usage
```go
package mainimport (
"context"
"github.com/AbacatePay/abacatepay-go-sdk/abacatepay"
"github.com/AbacatePay/abacatepay-go-sdk/v1/billing"
"log"
"time"
)func main() {
client, err := abacatepay.New(&abacatepay.ClientConfig{
ApiKey: "abc_dev",
Timeout: 10 * time.Second,
})
if err != nil {
panic(err)
}//create a new billing
body := &billing.CreateBillingBody{
Frequency: billing.OneTime,
Methods: []billing.Method{billing.PIX},
CompletionUrl: "https://example.com/completion",
ReturnUrl: "https://example.com/return",
Products: []*billing.BillingProduct{
{
ExternalId: "pix-1234",
Name: "Example Product",
Description: "Example product description",
Quantity: 1,
Price: 100,
},
},
Customer: &billing.BillingCustomer{
Email: "[email protected]",
},
}ctx := context.Background()
createResponse, err := client.Billing.Create(ctx, body)
if err != nil {
panic(err)
}log.Println(createResponse)
// list all billings
billings, err := client.Billing.ListAll(ctx)
if err != nil {
panic(err)
}log.Println(billings.Data)
}
```## Documentation
[https://abacatepay.readme.io](https://abacatepay.readme.io)
## License
MIT