Documentation
¶
Index ¶
- type Authorization
- type AuthorizationRequest
- type DefaultTransactionService
- func (s *DefaultTransactionService) ChargeAuthorization(req *Request) (*Transaction, error)
- func (s *DefaultTransactionService) CheckAuthorization(req AuthorizationRequest) (response.Response, error)
- func (s *DefaultTransactionService) Export(params response.RequestValues) (response.Response, error)
- func (s *DefaultTransactionService) Get(id int) (*Transaction, error)
- func (s *DefaultTransactionService) Initialize(txn *Request) (response.Response, error)
- func (s *DefaultTransactionService) List() (*List, error)
- func (s *DefaultTransactionService) ListN(count, offset int) (*List, error)
- func (s *DefaultTransactionService) ReAuthorize(req AuthorizationRequest) (response.Response, error)
- func (s *DefaultTransactionService) Timeline(reference string) (*Timeline, error)
- func (s *DefaultTransactionService) Totals() (response.Response, error)
- func (s *DefaultTransactionService) Verify(reference string) (*Transaction, error)
- type List
- type Request
- type Service
- type Timeline
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorization struct {
AuthorizationCode string `json:"authorization_code,omitempty"`
Bin string `json:"bin,omitempty"`
Last4 string `json:"last4,omitempty"`
ExpMonth string `json:"exp_month,omitempty"`
ExpYear string `json:"exp_year,omitempty"`
Channel string `json:"channel,omitempty"`
CardType string `json:"card_type,omitempty"`
Bank string `json:"bank,omitempty"`
CountryCode string `json:"country_code,omitempty"`
Brand string `json:"brand,omitempty"`
Resusable bool `json:"reusable,omitempty"`
Signature string `json:"signature,omitempty"`
}
Authorization represents Paystack authorization object
type AuthorizationRequest ¶
type AuthorizationRequest struct {
Reference string `json:"reference,omitempty"`
AuthorizationCode string `json:"authorization_code,omitempty"`
Amount int `json:"amount,omitempty"`
Currency string `json:"currency,omitempty"`
Email string `json:"email,omitempty"`
Metadata client.Metadata `json:"metadata,omitempty"`
}
AuthorizationRequest represents a request to enable/revoke an authorization
type DefaultTransactionService ¶
DefaultTransactionService handles operations related to transactions For more details see https://developers.paystack.co/v1.0/reference#create-transaction
func (*DefaultTransactionService) ChargeAuthorization ¶
func (s *DefaultTransactionService) ChargeAuthorization(req *Request) (*Transaction, error)
ChargeAuthorization is for charging all authorizations marked as reusable whenever you need to recieve payments. For more details see https://developers.paystack.co/v1.0/reference#charge-authorization
func (*DefaultTransactionService) CheckAuthorization ¶
func (s *DefaultTransactionService) CheckAuthorization(req AuthorizationRequest) (response.Response, error)
CheckAuthorization checks authorization For more details see https://developers.paystack.co/v1.0/reference#check-authorization
func (*DefaultTransactionService) Export ¶
func (s *DefaultTransactionService) Export(params response.RequestValues) (response.Response, error)
Export exports transactions to a downloadable file and returns a link to the file For more details see https://developers.paystack.co/v1.0/reference#export-transactions
func (*DefaultTransactionService) Get ¶
func (s *DefaultTransactionService) Get(id int) (*Transaction, error)
Get returns the details of a transaction. For more details see https://developers.paystack.co/v1.0/reference#fetch-transaction
func (*DefaultTransactionService) Initialize ¶
func (s *DefaultTransactionService) Initialize(txn *Request) (response.Response, error)
Initialize initiates a transaction process For more details see https://developers.paystack.co/v1.0/reference#initialize-a-transaction
func (*DefaultTransactionService) List ¶
func (s *DefaultTransactionService) List() (*List, error)
List returns a list of transactions. For more details see https://paystack.com/docs/api/#transaction-list
func (*DefaultTransactionService) ListN ¶
func (s *DefaultTransactionService) ListN(count, offset int) (*List, error)
ListN returns a list of transactions For more details see https://developers.paystack.co/v1.0/reference#list-transactions
func (*DefaultTransactionService) ReAuthorize ¶
func (s *DefaultTransactionService) ReAuthorize(req AuthorizationRequest) (response.Response, error)
ReAuthorize requests reauthorization For more details see https://developers.paystack.co/v1.0/reference#request-reauthorization
func (*DefaultTransactionService) Timeline ¶
func (s *DefaultTransactionService) Timeline(reference string) (*Timeline, error)
Timeline fetches the transaction timeline. Reference can be ID or transaction reference For more details see https://developers.paystack.co/v1.0/reference#view-transaction-timeline
func (*DefaultTransactionService) Totals ¶
func (s *DefaultTransactionService) Totals() (response.Response, error)
Totals returns total amount received on your account For more details see https://developers.paystack.co/v1.0/reference#transaction-totals
func (*DefaultTransactionService) Verify ¶
func (s *DefaultTransactionService) Verify(reference string) (*Transaction, error)
Verify checks that transaction with the given reference exists For more details see https://api.paystack.co/transaction/verify/reference
type List ¶
type List struct {
Meta response.ListMeta
Values []Transaction `json:"data"`
}
List is a list object for transactions.
type Request ¶
type Request struct {
CallbackURL string `json:"callback_url,omitempty"`
Reference string `json:"reference,omitempty"`
AuthorizationCode string `json:"authorization_code,omitempty"`
Currency string `json:"currency,omitempty"`
Amount float32 `json:"amount,omitempty"`
Email string `json:"email,omitempty"`
Plan string `json:"plan,omitempty"`
InvoiceLimit int `json:"invoice_limit,omitempty"`
Metadata client.Metadata `json:"metadata,omitempty"`
SubAccount string `json:"subaccount,omitempty"`
TransactionCharge int `json:"transaction_charge,omitempty"`
Bearer string `json:"bearer,omitempty"`
Channels []string `json:"channels,omitempty"`
}
Request represents a request to start a transaction.
type Service ¶
type Service interface {
Initialize(txn *Request) (response.Response, error)
Verify(reference string) (*Transaction, error)
List() (*List, error)
ListN(count, offset int) (*List, error)
Get(id int) (*Transaction, error)
ChargeAuthorization(req *Request) (*Transaction, error)
Timeline(reference string) (*Timeline, error)
Totals() (response.Response, error)
Export(params response.RequestValues) (response.Response, error)
ReAuthorize(req AuthorizationRequest) (response.Response, error)
CheckAuthorization(req AuthorizationRequest) (response.Response, error)
}
type Timeline ¶
type Timeline struct {
TimeSpent int `json:"time_spent,omitempty"`
Attempts int `json:"attempts,omitempty"`
Authentication string `json:"authentication,omitempty"` // TODO: confirm type
Errors int `json:"errors,omitempty"`
Success bool `json:"success,omitempty"`
Mobile bool `json:"mobile,omitempty"`
Input []string `json:"input,omitempty"` // TODO: confirm type
Channel string `json:"channel,omitempty"`
History []map[string]interface{} `json:"history,omitempty"`
}
Timeline represents a timeline of events in a transaction session
type Transaction ¶
type Transaction struct {
ID int `json:"id,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Domain string `json:"domain,omitempty"`
Metadata string `json:"metadata,omitempty"` //TODO: why is transaction metadata a string?
Status string `json:"status,omitempty"`
Reference string `json:"reference,omitempty"`
Amount float32 `json:"amount,omitempty"`
Message string `json:"message,omitempty"`
GatewayResponse string `json:"gateway_response,omitempty"`
PaidAt string `json:"piad_at,omitempty"`
Channel string `json:"channel,omitempty"`
Currency string `json:"currency,omitempty"`
IPAddress string `json:"ip_address,omitempty"`
Log map[string]interface{} `json:"log,omitempty"` // TODO: same as timeline?
Fees int `json:"int,omitempty"`
FeesSplit string `json:"fees_split,omitempty"` // TODO: confirm data type
Customer customer.Customer `json:"customer,omitempty"`
Authorization Authorization `json:"authorization,omitempty"`
Plan plan.Plan `json:"plan,omitempty"`
SubAccount subaccount.SubAccount `json:"sub_account,omitempty"`
}
Transaction is the resource representing your Paystack transaction. For more details see https://developers.paystack.co/v1.0/reference#initialize-a-transaction