viva-wallet is an SDK for connecting to the payment provider Viva Wallet.
There are 2 types of clients, one using basic authentication mechanism and another using OAuth. This is due to the implementation of the API itself, meaning that different API calls are using different type of authenication, hence this is unavoidable.
Under your project directory run the following:
go get -u github.com/techpals-eu/viva-wallet
oauthClient := vivawallet.NewOAuth(clientID, clientSecret, true)
token, err := oauthClient.Authenticate()
req := vivawallet.CheckoutOrder{
Amount: 1000,
}
op, err2 := oauthClient.CreateOrderPayment(req)
oauthClient := vivawallet.NewOAuth(clientID, clientSecret, true)
token, err := oauthClient.Authenticate()
trx, err2 := oauthClient.GetTransaction("some-transaction-id")
oauthClient := vivawallet.NewOAuth(clientID, clientSecret, true)
token, err := oauthClient.Authenticate()
createCardToken := CreateCardToken{
TransactionID: "some-trx-id",
}
cardToken, err2 := CreateCardToken(cardToken)
For more examples check out: main.go
👩💻 Built by TechPals 👨💻