Documentation ¶
Index ¶
- Constants
- type BillsCreatePaymentRequest
- type BillsCreatePaymentResponse
- type BillsStatusVerboseResponse
- type BillsValidateResponse
- type Client
- type ClientOption
- type GetPaymentLinkCustomer
- type GetPaymentLinkCustomizations
- type GetPaymentLinkRequest
- type GetPaymentLinkResponse
- type PaymentEventV3
- type RefundTransactionResponse
- type Response
- type TransactionResponse
Constants ¶
const (
// HeaderNameVerifHash is the name of the header used to verify your webhook requests.
HeaderNameVerifHash = "verif-hash"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BillsCreatePaymentRequest ¶
type BillsCreatePaymentRequest struct { Country string `json:"country"` Customer string `json:"customer"` Amount int `json:"amount"` Recurrence string `json:"recurrence,omitempty"` Type string `json:"type"` Reference string `json:"reference,omitempty"` BillerName string `json:"biller_name,omitempty"` }
BillsCreatePaymentRequest is data needed to creat a payment
type BillsCreatePaymentResponse ¶
type BillsCreatePaymentResponse struct { Status string `json:"status"` Message string `json:"message"` Data struct { PhoneNumber string `json:"phone_number"` Amount int `json:"amount"` Network string `json:"network"` FlwRef string `json:"flw_ref"` TxRef string `json:"tx_ref"` } `json:"data"` }
BillsCreatePaymentResponse is the data returned after creating a payment
func (BillsCreatePaymentResponse) IsSuccessfull ¶
func (response BillsCreatePaymentResponse) IsSuccessfull() bool
IsSuccessfull determines if the bill payment was successfull
type BillsStatusVerboseResponse ¶
type BillsStatusVerboseResponse struct { Status string `json:"status"` Message string `json:"message"` Data struct { Currency string `json:"currency"` CustomerID string `json:"customer_id"` Frequency string `json:"frequency"` Amount string `json:"amount"` Product string `json:"product"` ProductName string `json:"product_name"` Commission int `json:"commission"` TransactionDate time.Time `json:"transaction_date"` Country string `json:"country"` TxRef string `json:"tx_ref"` Extra interface{} `json:"extra"` ProductDetails string `json:"product_details"` Status string `json:"status"` } `json:"data"` }
BillsStatusVerboseResponse is the verbose response of a bill payment
func (BillsStatusVerboseResponse) IsSuccessfull ¶
func (response BillsStatusVerboseResponse) IsSuccessfull() bool
IsSuccessfull determines if the transaction was successfull
type BillsValidateResponse ¶
type BillsValidateResponse struct { Status string `json:"status"` Message string `json:"message"` Data struct { ResponseCode string `json:"response_code"` Address interface{} `json:"address"` ResponseMessage string `json:"response_message"` Name string `json:"name"` BillerCode string `json:"biller_code"` Customer string `json:"customer"` ProductCode string `json:"product_code"` Email interface{} `json:"email"` Fee int `json:"fee"` Maximum int `json:"maximum"` Minimum int `json:"minimum"` } `json:"data"` }
BillsValidateResponse is the response after validating a bill service
func (BillsValidateResponse) IsSuccessfull ¶
func (response BillsValidateResponse) IsSuccessfull() bool
IsSuccessfull determines if the bill validation was successfull
type Client ¶
type Client struct { Bills *billsService Payments *paymentsService Transactions *transactionsService // contains filtered or unexported fields }
Client is the flutterwave API client. Do not instantiate this client with Client{}. Use the New method instead.
func New ¶
func New(options ...ClientOption) *Client
New creates and returns a new flutterwave.Client from a slice of flutterwave.ClientOption.
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption are options for constructing a client
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL set's the base url for the flutterwave API
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets the underlying HTTP client used for API requests. By default, http.DefaultClient is used.
func WithSecretKey ¶
func WithSecretKey(secretKey string) ClientOption
WithSecretKey set's the secret key used to authorize requests to the flutterwave API See: https://developer.flutterwave.com/docs/api-keys
type GetPaymentLinkCustomer ¶ added in v0.0.4
type GetPaymentLinkCustomer struct { Email string `json:"email"` Name string `json:"name"` PhoneNumber string `json:"phonenumber"` }
GetPaymentLinkCustomer contains the customer details.
type GetPaymentLinkCustomizations ¶ added in v0.0.4
GetPaymentLinkCustomizations contains options to customize the look of the payment modal.
type GetPaymentLinkRequest ¶ added in v0.0.4
type GetPaymentLinkRequest struct { TransactionReference string `json:"tx_ref"` Amount string `json:"amount"` Currency string `json:"currency"` Meta map[string]interface{} `json:"meta"` RedirectURL string `json:"redirect_url"` Customer GetPaymentLinkCustomer `json:"customer"` Customizations GetPaymentLinkCustomizations `json:"customizations"` }
GetPaymentLinkRequest is data needed to create a payment link
type GetPaymentLinkResponse ¶ added in v0.0.4
type GetPaymentLinkResponse struct { Status string `json:"status"` Message string `json:"message"` Data struct { Link string `json:"link"` } `json:"data"` }
GetPaymentLinkResponse is the data returned after creating a payment link
type PaymentEventV3 ¶ added in v0.0.4
type PaymentEventV3 struct { Event string `json:"event"` Data struct { ID int64 `json:"id"` TxRef string `json:"tx_ref"` FlwRef string `json:"flw_ref"` DeviceFingerprint string `json:"device_fingerprint"` Amount int `json:"amount"` Currency string `json:"currency"` ChargedAmount int `json:"charged_amount"` AppFee float64 `json:"app_fee"` MerchantFee int `json:"merchant_fee"` ProcessorResponse string `json:"processor_response"` AuthModel string `json:"auth_model"` IP string `json:"ip"` Narration string `json:"narration"` Status string `json:"status"` PaymentType string `json:"payment_type"` CreatedAt time.Time `json:"created_at"` AccountID int `json:"account_id"` Customer struct { ID int `json:"id"` Name string `json:"name"` PhoneNumber interface{} `json:"phone_number"` Email string `json:"email"` CreatedAt time.Time `json:"created_at"` } `json:"customer"` Card struct { First6Digits string `json:"first_6digits"` Last4Digits string `json:"last_4digits"` Issuer string `json:"issuer"` Country string `json:"country"` Type string `json:"type"` Expiry string `json:"expiry"` } `json:"card"` } `json:"data"` EventType string `json:"event.type"` }
PaymentEventV3 is the payload for webhook requests after a payment
func (PaymentEventV3) IsFailed ¶ added in v0.0.4
func (event PaymentEventV3) IsFailed() bool
IsFailed checks if the payment failed
func (PaymentEventV3) IsSuccessful ¶ added in v0.0.4
func (event PaymentEventV3) IsSuccessful() bool
IsSuccessful checks if the payment event is successfull
type RefundTransactionResponse ¶ added in v0.0.6
type RefundTransactionResponse struct { Status string `json:"status"` Message string `json:"message"` Data struct { ID int `json:"id"` AccountID int `json:"account_id"` TxID int `json:"tx_id"` FlwRef string `json:"flw_ref"` WalletID int `json:"wallet_id"` AmountRefunded int `json:"amount_refunded"` Status string `json:"status"` Destination string `json:"destination"` Meta struct { Source string `json:"source"` } `json:"meta"` CreatedAt time.Time `json:"created_at"` } `json:"data"` }
RefundTransactionResponse is the payload generated when a transaction is refunded
type TransactionResponse ¶ added in v0.0.5
type TransactionResponse struct { Status string `json:"status"` Message string `json:"message"` Data struct { ID int64 `json:"id"` TxRef string `json:"tx_ref"` FlwRef string `json:"flw_ref"` DeviceFingerprint string `json:"device_fingerprint"` Amount int `json:"amount"` Currency string `json:"currency"` ChargedAmount int `json:"charged_amount"` AppFee float64 `json:"app_fee"` MerchantFee int `json:"merchant_fee"` ProcessorResponse string `json:"processor_response"` AuthModel string `json:"auth_model"` IP string `json:"ip"` Narration string `json:"narration"` Status string `json:"status"` PaymentType string `json:"payment_type"` CreatedAt time.Time `json:"created_at"` AccountID int `json:"account_id"` Card struct { First6Digits string `json:"first_6digits"` Last4Digits string `json:"last_4digits"` Issuer string `json:"issuer"` Country string `json:"country"` Type string `json:"type"` Token string `json:"token"` Expiry string `json:"expiry"` } `json:"card"` Meta interface{} `json:"meta"` AmountSettled float64 `json:"amount_settled"` Customer struct { ID int `json:"id"` Name string `json:"name"` PhoneNumber string `json:"phone_number"` Email string `json:"email"` CreatedAt time.Time `json:"created_at"` } `json:"customer"` } `json:"data"` }
TransactionResponse is data returned when querying a transaction