Skip to content

aliworkshop/samanpayment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Saman payment library

Saman payment library for Go Language. Which includes saman web api methods for connect to bank and verify transaction and reverse transaction.

Installation

Installation is done using go get.

go get -u github.com/aliworkshop/samanpayment

These are following bank methods which is supported by this package

  • GetTokenRequest
  • VerifyTransactionRequest
  • ReverseTransactionRequest

GetTokenRequest

this method use for get token from bank webservice for connect to the bank payment gateway

this method receives 5 following parameter for get token

Parameter Type
resnum String
amount Integer
payer_phone String
callback_url String
transaction_key Integer
saman := samanpayment.SamanConfig{
    TerminalId: 123456789,
}
result, err := saman.GetTokenRequest(resnum, transaction_key, amount, callback_url, mobile)

VerifyTransactionRequest

this method use for verify transaction and update database if payment was successful

this method receive 2 parameters included transaction_key that you set it before and refnum that you get it from bank response in callback

saman := samanpayment.SamanConfig{
    TerminalId: 123456789,
}
res, err := saman.VerifyTransactionRequest(transaction_key, resp.RefNum)

ReverseTransactionRequest

this method use for reverse transaction that was unsuccessful

this method receive 2 parameters included transaction_key that you set it before and refnum that you get it from bank response in callback

saman := samanpayment.SamanConfig{
    TerminalId: 123456789,
}
res, err := saman.VerifyTransactionRequest(transaction_key, resp.RefNum)

Contributor

Ali Torabi If this library helps you in anyway, show your love ❤️ by putting a ⭐ on this project ✌️

More details and learn how to work visit MiLearn