go get -u github.com/vannleonheart/payhere-api-go
payhereConfig := payhere.Config {
BaseUrl: "{payhere_api_url}",
Token: "{your_payhere_token}"
}
Payhere Base Url for production
https://api.payhere.id
payhereClient := payhere.New(&payhereConfig)
result, err := payhereClient.GetBalance()
if err != nil {
// handle error
}
fmt.Println(result.Balance)
testAmount := 10000
result, err := payhereClient.CreateDisbursement(payhere.CreateDisbursementRequest{
MerchantTrxId: "{your_transaction_id}",
RecipientName: "{recipient_name}",
RecipientBankCode: "{indonesian_bank_code}",
RecipientAccountNumber: "{recipient_bank_account_number}",
Amount: testAmount,
Description: "{optional_description}",
CallbackUrl: "{optional_your_callback_url}",
})
if err != nil {
// handle error
}
fmt.Println(result.Uuid)
uuid := "{transaction_uuid}"
result, err := payhereClient.InquiryDisbursementByUuid(uuid)
if err != nil {
// handle error
}
fmt.Println(result.MerchantTrxId)
merchantTrxId := "{your_transaction_id}"
result, err := payhereClient.InquiryDisbursementByMerchantTrx(merchantTrxId)
if err != nil {
// handle error
}
fmt.Println(result.Uuid)