Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
zakirkun committed May 9, 2024
1 parent cc999a1 commit cbb60c4
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions _examples/open_payment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package examples

import (
"github.com/zakirkun/go-tripay/client"
"github.com/zakirkun/go-tripay/utils"

"fmt"
)

func Example_open_payment_create() {

client := client.Client{
MerchantCode: "T14302",
ApiKey: "DEV-ZKIDl5gE3AsCDThj7mWX6yvQ8f42NZWJWlZ7TSzS",
PrivateKey: "J2WTm-93avv-w0PZV-ur1t4-4TCjd",
Mode: utils.MODE_DEVELOPMENT,
}

client.SetSignature(utils.Signature{
MerchantCode: "T14302",
Channel: "BCAVA",
MerchanReff: "INV345675",
})

payment := client.OpenPaymentRequest{
Method: "BCAVA",
MerchatReff: "INV345675",
CustomerName: "Fulan Fulan",
Signature: client.GetSignature(),
}

responseOk, responseBad := client.OpenPaymentTransaction(payment)
if responseBad != nil {
fmt.Errorf("ERROR: %v", responseBad)
}

fmt.Printf("Success: ", responseOk)
}

0 comments on commit cbb60c4

Please sign in to comment.