https://github.com/duitkupg/duitku-go
Duitku API Library for Go
https://github.com/duitkupg/duitku-go
api-library duitku go payment payment-gateway
Last synced: about 2 months ago
JSON representation
Duitku API Library for Go
- Host: GitHub
- URL: https://github.com/duitkupg/duitku-go
- Owner: duitkupg
- License: mit
- Created: 2025-04-15T10:16:08.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-05T10:50:10.000Z (12 months ago)
- Last Synced: 2026-01-15T05:45:43.960Z (3 months ago)
- Topics: api-library, duitku, go, payment, payment-gateway
- Language: Go
- Homepage: https://docs.duitku.com/
- Size: 44.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Duitku Golang API Client Library
[](https://pkg.go.dev/github.com/idoyudha/duitku-go)
[](https://github.com/idoyudha/duitku-go/actions/workflows/go.yml?query=branch%3Amaster)
[](https://goreportcard.com/report/github.com/idoyudha/duitku-go)
[](https://opensource.org/licenses/MIT)
Duitku API Library for Go
## Supported Feature
| Feature | Function | HTTP Request | Description |
|------------------------|--------------------------------------|-----------------------------------------------|---------------------------------------|
| Get Payment Method | client.PaymentService.GetMethods | POST /merchant/paymentmethod/getpaymentmethod | Get list of available payment methods |
| Create New Transaction | client.TransactionService.Create | POST /merchant/v2/inquiry | Create Transaction via V2 API |
| Get Transaction | client.TransactionService.GetStatus | POST /merchant/transactionStatus | Get Transaction via V2 API |
| Craete New Invoice | client.InvoiceService.Create | POST /merchant/createInvoice | Create Transaction via POP API |
## Requirements
- Go 1.24 or later
- Duitku account, [register here](https://dashboard.duitku.com/Account/Register)
- [API Key](https://docs.duitku.com/en/account/#account-integration--getting-api-key)
## Documentation
- https://docs.duitku.com/
## Installation
Make sure your project is using go modules, if not initialize it:
```bash
go mod init
```
Get this library, add to your project
```bash
go get -u github.com/idoyudha/duitku-go
```
## Example Usage
```go
import (
"context"
"github.com/idoyudha/duitku-go"
"github.com/idoyudha/duitku-go/common"
"github.com/idoyudha/duitku-go/invoice"
)
client := duitku.NewClient(&common.Config{
MerchantCode: "YOUR MERCHANT CODE",
APIKey: "YOUR API KEY",
Environment: common.SandboxEnv,
})
invoiceRequest := invoice.CreateInvoiceRequest{
PaymentAmount: 10001,
MerchantOrderId: "YOUR UNIQUE ORDER ID",
ProductDetails: "YOUR PRODUCT DETAILS",
Email: "admin@yourcompany.com",
CallbackURL: "https://yourcompany.com/callback",
ReturnURL: "https://yourcompany.com",
}
res, httpResponse, err := client.InvoiceService.Create(context.Background(), invoiceRequest)
if err != nil {
log.Printf("Found error InvoiceService.Create => %v", err)
}
log.Printf("Full HTTP Response from InvoiceService.Create => %v", httpResponse)
log.Printf("Response body from InvoiceService.Create => %v", createInvoiceRes)
```
## More Detailed Example
- [Invoice (Create Invoice - POP)](examples/invoice.md)
- [Payment (Get Payment Method)](examples/payment.md)
- [Transaction (Create Transaction, Get Transaction Status)](examples/transaction.md)
## Support
If you have a feature request or spotted a bug or a techical problem, [create an issue here](https://github.com/idoyudha/duitku-go/issues/new/choose).
For other questions, please contact duitku through their live chat on your dashboard.
## License
MIT license. For more information, see the LICENSE file.