Documentation ¶
Overview ¶
Package paystack is a 3rd party client package for Paystack https://paystack.com. It allows for easy Integration of paystack services into your Go projects.
Index ¶
- Constants
- Variables
- func AddQueryParamsToUrl(url string, queries ...Query) string
- type APIClient
- type ApplePayClient
- func (a ApplePayClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (a *ApplePayClient) All(queries ...Query) (*Response, error)
- func (a *ApplePayClient) Register(domainName string) (*Response, error)
- func (a *ApplePayClient) Unregister(domainName string) (*Response, error)
- type BulkChargeClient
- func (a BulkChargeClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (b *BulkChargeClient) All(queries ...Query) (*Response, error)
- func (b *BulkChargeClient) Charges(idOrCode string, queries ...Query) (*Response, error)
- func (b *BulkChargeClient) FetchOne(idOrCode string) (*Response, error)
- func (b *BulkChargeClient) Initiate(charges interface{}) (*Response, error)
- func (b *BulkChargeClient) Pause(idOrCode string) (*Response, error)
- func (b *BulkChargeClient) Resume(idOrCode string) (*Response, error)
- type ChargeClient
- func (a ChargeClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (c *ChargeClient) Create(email string, amount string, ...) (*Response, error)
- func (c *ChargeClient) PendingCharge(reference string) (*Response, error)
- func (c *ChargeClient) SubmitAddress(address string, reference string, city string, state string, zipCode string) (*Response, error)
- func (c *ChargeClient) SubmitBirthday(birthday string, reference string) (*Response, error)
- func (c *ChargeClient) SubmitPhone(phone string, reference string) (*Response, error)
- func (c *ChargeClient) SubmitPin(pin string, reference string) (*Response, error)
- type ClientOptions
- type CustomerClient
- func (a CustomerClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (c *CustomerClient) All(queries ...Query) (*Response, error)
- func (c *CustomerClient) Create(email string, firstName string, lastName string, ...) (*Response, error)
- func (c *CustomerClient) Deactivate(authorizationCode string) (*Response, error)
- func (c *CustomerClient) FetchOne(emailOrCode string) (*Response, error)
- func (c *CustomerClient) Flag(emailOrCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
- func (c *CustomerClient) Update(code string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
- func (c *CustomerClient) Validate(code string, firstName string, lastName string, identificationType string, ...) (*Response, error)
- type DedicatedVirtualAccountClient
- func (a DedicatedVirtualAccountClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (d *DedicatedVirtualAccountClient) All(queries ...Query) (*Response, error)
- func (d *DedicatedVirtualAccountClient) Assign(email string, firstName string, lastName string, phone string, ...) (*Response, error)
- func (d *DedicatedVirtualAccountClient) BankProviders() (*Response, error)
- func (d *DedicatedVirtualAccountClient) Create(customerIdOrCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
- func (d *DedicatedVirtualAccountClient) Deactivate(id string) (*Response, error)
- func (d *DedicatedVirtualAccountClient) FetchOne(dedicatedAccountId string) (*Response, error)
- func (d *DedicatedVirtualAccountClient) RemoveSplit(accountNumber string) (*Response, error)
- func (d *DedicatedVirtualAccountClient) Requery(queries ...Query) (*Response, error)
- func (d *DedicatedVirtualAccountClient) Split(customerIdOrCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
- type DisputeClient
- func (a DisputeClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (d *DisputeClient) AddEvidence(id string, customerEmail string, customerName string, customerPhone string, ...) (*Response, error)
- func (d *DisputeClient) All(queries ...Query) (*Response, error)
- func (d *DisputeClient) AllTransactionDisputes(transactionId string) (*Response, error)
- func (d *DisputeClient) Export(queries ...Query) (*Response, error)
- func (d *DisputeClient) FetchOne(id string) (*Response, error)
- func (d *DisputeClient) Resolve(id string, resolution string, message string, refundAmount int, ...) (*Response, error)
- func (d *DisputeClient) Update(id string, referenceAmount int, ...) (*Response, error)
- func (d *DisputeClient) UploadURL(id string, queries ...Query) (*Response, error)
- type IntegrationClient
- type MiscellaneousClient
- func (a MiscellaneousClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (p *MiscellaneousClient) Banks(queries ...Query) (*Response, error)
- func (p *MiscellaneousClient) Countries() (*Response, error)
- func (p *MiscellaneousClient) States(queries ...Query) (*Response, error)
- type OptionalPayloadParameter
- type PaymentPageClient
- func (a PaymentPageClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (p *PaymentPageClient) AddProducts(id string, products []string) (*Response, error)
- func (p *PaymentPageClient) All(queries ...Query) (*Response, error)
- func (p *PaymentPageClient) CheckSlug(slug string) (*Response, error)
- func (p *PaymentPageClient) Create(name string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
- func (p *PaymentPageClient) FetchOne(idOrSlug string) (*Response, error)
- func (p *PaymentPageClient) Update(idOrSlug string, name string, description string, ...) (*Response, error)
- type PaymentRequestClient
- func (a PaymentRequestClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (p *PaymentRequestClient) All(queries ...Query) (*Response, error)
- func (p *PaymentRequestClient) Archive(idOrCode string) (*Response, error)
- func (p *PaymentRequestClient) Create(customerIdOrCode string, amount int, ...) (*Response, error)
- func (p *PaymentRequestClient) FetchOne(idOrCode string) (*Response, error)
- func (p *PaymentRequestClient) Finalize(code string, sendNotification bool) (*Response, error)
- func (p *PaymentRequestClient) SendNotification(code string) (*Response, error)
- func (p *PaymentRequestClient) Total() (*Response, error)
- func (p *PaymentRequestClient) Update(idOrCode string, customerIdOrCode string, amount int, ...) (*Response, error)
- func (p *PaymentRequestClient) Verify(code string) (*Response, error)
- type PlanClient
- func (a PlanClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (p *PlanClient) All(queries ...Query) (*Response, error)
- func (p *PlanClient) Create(name string, amount int, interval string, ...) (*Response, error)
- func (p *PlanClient) FetchOne(idOrCode string) (*Response, error)
- func (p *PlanClient) Update(idOrCode string, name string, amount int, interval string, ...) (*Response, error)
- type ProductClient
- func (a ProductClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (p *ProductClient) All(queries ...Query) (*Response, error)
- func (p *ProductClient) Create(name string, description string, price int, currency string, ...) (*Response, error)
- func (p *ProductClient) FetchOne(id string) (*Response, error)
- func (p *ProductClient) Update(id string, name string, description string, price int, currency string, ...) (*Response, error)
- type Query
- type RefundClient
- func (a RefundClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (r *RefundClient) All(queries ...Query) (*Response, error)
- func (r *RefundClient) Create(transaction string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
- func (r *RefundClient) FetchOne(reference string) (*Response, error)
- type Response
- type SettlementClient
- type SubAccountClient
- func (a SubAccountClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (s *SubAccountClient) All(queries ...Query) (*Response, error)
- func (s *SubAccountClient) Create(businessName string, settlementBank string, accountNumber string, ...) (*Response, error)
- func (s *SubAccountClient) FetchOne(idOrCode string) (*Response, error)
- func (s *SubAccountClient) Update(idOrCode string, businessName string, settlementBank string, ...) (*Response, error)
- type SubscriptionClient
- func (a SubscriptionClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (s *SubscriptionClient) All(queries ...Query) (*Response, error)
- func (s *SubscriptionClient) Create(customer string, plan string, authorization string, ...) (*Response, error)
- func (s *SubscriptionClient) Disable(code string, token string) (*Response, error)
- func (s *SubscriptionClient) Enable(code string, token string) (*Response, error)
- func (s *SubscriptionClient) FetchOne(idOrCode string) (*Response, error)
- func (s *SubscriptionClient) GenerateLink(code string) (*Response, error)
- func (s *SubscriptionClient) SendLink(code string) (*Response, error)
- type TerminalClient
- func (a TerminalClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (t *TerminalClient) All(queries ...Query) (*Response, error)
- func (t *TerminalClient) Commission(serialNumber string) (*Response, error)
- func (t *TerminalClient) Decommission(serialNumber string) (*Response, error)
- func (t *TerminalClient) EventStatus(terminalId string, eventId string) (*Response, error)
- func (t *TerminalClient) FetchOne(terminalId string) (*Response, error)
- func (t *TerminalClient) SendEvent(terminalId string, eventType TerminalEvent, action string, data interface{}) (*Response, error)
- func (t *TerminalClient) TerminalStatus(terminalId string) (*Response, error)
- func (t *TerminalClient) Update(terminalId string, name string, address string) (*Response, error)
- type TerminalEvent
- type TransactionClient
- func (a TransactionClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (t *TransactionClient) All(queries ...Query) (*Response, error)
- func (t *TransactionClient) ChargeAuthorization(amount int, email string, authorizationCode string, ...) (*Response, error)
- func (t *TransactionClient) Export(queries ...Query) (*Response, error)
- func (t *TransactionClient) FetchOne(id string) (*Response, error)
- func (t *TransactionClient) Initialize(amount int, email string, ...) (*Response, error)
- func (t *TransactionClient) PartialDebit(authorizationCode string, currency string, amount string, email string, ...) (*Response, error)
- func (t *TransactionClient) Timeline(idOrReference string) (*Response, error)
- func (t *TransactionClient) Total(queries ...Query) (*Response, error)
- func (t *TransactionClient) Verify(reference string) (*Response, error)
- type TransactionSplitClient
- func (a TransactionSplitClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (t *TransactionSplitClient) Add(id string, subAccount string, share int) (*Response, error)
- func (t *TransactionSplitClient) All(queries ...Query) (*Response, error)
- func (t *TransactionSplitClient) Create(name string, transactionSplitType string, currency string, ...) (*Response, error)
- func (t *TransactionSplitClient) FetchOne(id string) (*Response, error)
- func (t *TransactionSplitClient) Remove(id string, subAccount string) (*Response, error)
- func (t *TransactionSplitClient) Update(id string, name string, active bool, ...) (*Response, error)
- type TransferClient
- func (a TransferClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (t *TransferClient) All(queries ...Query) (*Response, error)
- func (t *TransferClient) BulkInitiate(source string, transfers interface{}) (*Response, error)
- func (t *TransferClient) FetchOne(idOrCode string) (*Response, error)
- func (t *TransferClient) Finalize(transferCode string, otp string) (*Response, error)
- func (t *TransferClient) Initiate(source string, amount int, recipient string, ...) (*Response, error)
- func (t *TransferClient) Verify(reference string) (*Response, error)
- type TransferControlClient
- func (a TransferControlClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (t *TransferControlClient) Balance() (*Response, error)
- func (t *TransferControlClient) BalanceLedger() (*Response, error)
- func (t *TransferControlClient) DisableOTP() (*Response, error)
- func (t *TransferControlClient) EnableOTP() (*Response, error)
- func (t *TransferControlClient) FinalizeDisableOTP(otp string) (*Response, error)
- func (t *TransferControlClient) ResendOTP(transferCode string, reason string) (*Response, error)
- type TransferRecipientClient
- func (a TransferRecipientClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (t *TransferRecipientClient) All(queries ...Query) (*Response, error)
- func (t *TransferRecipientClient) BulkCreate(batch interface{}) (*Response, error)
- func (t *TransferRecipientClient) Create(recipientType string, name string, accountNumber string, bankCode string, ...) (*Response, error)
- func (t *TransferRecipientClient) Delete(idOrCode string) (*Response, error)
- func (t *TransferRecipientClient) FetchOne(idOrCode string) (*Response, error)
- func (t *TransferRecipientClient) Update(idOrCode string, name string, ...) (*Response, error)
- type VerificationClient
- func (a VerificationClient) APICall(method string, endPointPath string, payload interface{}) (*Response, error)
- func (v *VerificationClient) ResolveAccount(queries ...Query) (*Response, error)
- func (v *VerificationClient) ResolveBIN(bin string) (*Response, error)
- func (v *VerificationClient) ValidateAccount(accountName string, accountNumber string, accountType string, bankCode string, ...) (*Response, error)
Constants ¶
const BaseUrl = "https://api.paystack.co"
const Version = "0.1.0"
Variables ¶
var ErrNoSecretKey = errors.New("Paystack secret key was not provided")
Functions ¶
func AddQueryParamsToUrl ¶
AddQueryParamsToUrl lets you add query parameters to a url
Types ¶
type APIClient ¶
type APIClient struct { // Transactions let you interact with endpoints related to paystack Transaction resource // that allows you to create and manage payments on your Integration. Transactions *TransactionClient // TransactionSplits lets you interact with endpoints related to paystack Transaction Split resource // that allows you to split the settlement for a transaction across a payout account, and one or // more subaccounts. TransactionSplits *TransactionSplitClient // Terminals let you interact with endpoints related to paystack Terminal resource that allows you to // build delightful in-person payment experiences. Terminals *TerminalClient // Customers let you interact with endpoints related to paystack Customer resource // that allows you to create and manage Customers on your Integration. Customers *CustomerClient // DedicatedVirtualAccounts lets you interact with endpoints related to paystack dedicated virtual account // resource that enables Nigerian merchants to manage unique payment accounts of their Customers. DedicatedVirtualAccounts *DedicatedVirtualAccountClient // ApplePay lets you interact with endpoints related to paystack Apple Pay resource that // lets you register your application's top-level domain or subdomain. ApplePay *ApplePayClient // SubAccounts lets you interact with endpoints related to paystack subaccount resource that lets you // create and manage subaccounts on your Integration. Subaccounts can be used to split payment // between two accounts (your main account and a subaccount). SubAccounts *SubAccountClient // Plans lets you interact with endpoints related to paystack plan resource that lets you // create and manage installment payment options on your Integration. Plans *PlanClient // Subscriptions let you interact with endpoints related to paystack subscription resource that lets you // create and manage recurring payment on your Integration. Subscriptions *SubscriptionClient // Products let you interact with endpoints related to paystack product resource that allows you to create and // manage inventories on your Integration. Products *ProductClient // PaymentPages let you interact with endpoints related to paystack payment page resource // that lets you provide a quick and secure way to collect payment for Products. PaymentPages *PaymentPageClient // PaymentRequests let you interacts with endpoints related to paystack payment request resource that lets you manage requests // for payment of goods and services. PaymentRequests *PaymentRequestClient // Settlements let you interact with endpoints related to paystack settlement resource that lets you // gain insights into payouts made by Paystack to your bank account. Settlements *SettlementClient // TransferRecipients let you interact with endpoints related to paystack transfer recipient resource // that lets you create and manage beneficiaries that you send money to. TransferRecipients *TransferRecipientClient // Transfers let you interact with endpoints related to paystack transfer resource that lets you // automate sending money to your Customers. Transfers *TransferClient // TransferControl let you interact with endpoints related to paystack transfer control resource that lets // you manage settings of your Transfers. TransferControl *TransferControlClient // BulkCharges let you interact with endpoints related to paystack bulk Charges resource that lets // you create and manage multiple recurring payments from your Customers. BulkCharges *BulkChargeClient // Integration let you interact with endpoints related to paystack Integration resource // that lets you manage some settings on your Integration. Integration *IntegrationClient // Charge let you interact with endpoints related to paystack charge resource that // lets you configure a payment channel of your choice when initiating a payment. Charges *ChargeClient // Disputes let you interact with endpoint related to paystack dispute resource that lets you // manage transaction Disputes on your Integration. Disputes *DisputeClient // Refunds let you interact with endpoints related to paystack refund resource that lets you // create and manage transaction Refunds. Refunds *RefundClient // Verification let you interact with endpoints related to paystack Verification resource // that allows you to perform KYC processes. Verification *VerificationClient // Miscellaneous let you interact with endpoints related to paystack Miscellaneous resource that // provides information that is relevant to other client methods Miscellaneous *MiscellaneousClient // contains filtered or unexported fields }
APIClient is a struct that has other dedicated clients bound to it. This provides a convenience for interacting with all of paystack's endpoints in your Go project. It should not be instantiated directly but interacting but via the NewAPIClient function. As stated above, it has other dedicated clients bound to it as field, therefore, after creating an instance of the APIClient type. You can access the associated functions of each dedicated client via its field name.
Example import p "github.com/gray-adeyi/paystack" client := p.NewAPIClient(p.WithSecretKey("<your-paystack-secret-key>")) resp, err := client.Transactions.Verify("<reference>")
func NewAPIClient ¶
func NewAPIClient(options ...ClientOptions) *APIClient
NewAPIClient lets you create an APIClient. it can accept zero to many client options
Example import p "github.com/gray-adeyi/paystack" client := p.NewAPIClient(p.WithSecretKey("<your-paystack-secret-key>"))
type ApplePayClient ¶
type ApplePayClient struct {
// contains filtered or unexported fields
}
ApplePayClient interacts with endpoints related to paystack Apple Pay resource that lets you register your application's top-level domain or subdomain.
func NewApplePayClient ¶
func NewApplePayClient(options ...ClientOptions) *ApplePayClient
NewApplePayClient creates a ApplePayClient
Example:
import p "github.com/gray-adeyi/paystack" applePayClient := p.NewApplePayClient(p.WithSecretKey("<paystack-secret-key>"))
func (*ApplePayClient) All ¶
func (a *ApplePayClient) All(queries ...Query) (*Response, error)
All lets you retrieve all registered domains on your Integration. Returns an empty array if no domains have been added.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) applePayClient := p.NewApplePayClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access an Apple Pay client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.ApplePay field is a `ApplePayClient` // Therefore, this is possible // resp, err := paystackClient.ApplePay.All() // All also accepts queries, so say you want to use cursor, you can write it like so. // resp, err := applePayClient.All(p.WithQuery("use_cursor","true"))
// see https://paystack.com/docs/api/apple-pay/#list-domains for supported query parameters
resp, err := applePayClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ApplePayClient) Register ¶
func (a *ApplePayClient) Register(domainName string) (*Response, error)
Register lets you register a top-level domain or subdomain for your Apple Pay Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) applePayClient := p.ApplePayClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access an Apple Pay client from APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.ApplePay field is a `ApplePayClient` // Therefore, this is possible // resp, err := paystackClient.ApplePay.Register("<domainName>") resp, err := applePayClient.Register("<domainName>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ApplePayClient) Unregister ¶
func (a *ApplePayClient) Unregister(domainName string) (*Response, error)
Unregister lets you unregister a top-level domain or subdomain previously used for your Apple Pay Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) applePayClient := p.ApplePayClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access an Apple Pay client from APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.ApplePay field is a `ApplePayClient` // Therefore, this is possible // resp, err := paystackClient.ApplePay.Unregister("<domainName>") resp, err := applePayClient.Unregister("<domainName>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type BulkChargeClient ¶
type BulkChargeClient struct {
// contains filtered or unexported fields
}
BulkChargeClient interacts with endpoints related to paystack bulk Charges resource that lets you create and manage multiple recurring payments from your Customers.
func NewBulkChargeClient ¶
func NewBulkChargeClient(options ...ClientOptions) *BulkChargeClient
NewBulkChargeClient creates a BulkChargeClient
Example import p "github.com/gray-adeyi/paystack"
bcClient := p.NewBulkChargeClient(p.WithSecretKey("<paystack-secret-key>"))
func (*BulkChargeClient) All ¶
func (b *BulkChargeClient) All(queries ...Query) (*Response, error)
All lets you retrieve all bulk charge batches created by the Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) bcClient := p.NewBulkChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a bulk charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.BulkCharges field is a `BulkChargeClient` // Therefore, this is possible // resp, err := paystackClient.BulkCharges.All() // All also accepts queries, so say you want to customize how many payment pages to retrieve // and which page to retrieve, you can write it like so. // resp, err := bcClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/bulk-charge/#list for supported query parameters
resp, err := bcClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*BulkChargeClient) Charges ¶
func (b *BulkChargeClient) Charges(idOrCode string, queries ...Query) (*Response, error)
Charges lets you retrieve the Charges associated with a specified batch code.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) bcClient := p.NewBulkChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a bulk charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.BulkCharges field is a `BulkChargeClient` // Therefore, this is possible // resp, err := paystackClient.BulkCharges.Charges("<idOrCode>") // All also accepts queries, so say you want to customize how many payment pages to retrieve // and which page to retrieve, you can write it like so. // resp, err := bcClient.Charges("<idOrSlug>",p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/bulk-charge/#fetch-charge for supported query parameters
resp, err := bcClient.Charges("<idOrSlug>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*BulkChargeClient) FetchOne ¶
func (b *BulkChargeClient) FetchOne(idOrCode string) (*Response, error)
FetchOne lets you retrieve a specific batch code. It also returns useful information on its progress by way of the `total_charges` and `pending_charges` attributes.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) bcClient := p.NewBulkChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a bulk charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.BulkCharges field is a `BulkChargeClient` // Therefore, this is possible // resp, err := paystackClient.BulkCharges.FetchOne("<idOrCode>") resp, err := bcClient.FetchOne("<idOrSlug>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*BulkChargeClient) Initiate ¶
func (b *BulkChargeClient) Initiate(charges interface{}) (*Response, error)
Initiate lets you send an array of map with authorization codes and amount, using the supported currency format, so paystack can process Transactions as a batch.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) bcClient := p.NewBulkChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the bulk charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.BulkCharges field is a `BulkChargeClient` // Therefore, this is possible // batch := []map[string]interface{}{ // {"authorization": "AUTH_ncx8hews93", "amount": 2500, "reference": "dam1266638dhhd"}, // {"authorization": "AUTH_xfuz7dy4b9", "amount": 1500, "reference": "dam1266638dhhe"}, // } // resp, err := paystackClient.BulkCharges.Initiate(batch) batch := []map[string]interface{}{ {"authorization": "AUTH_ncx8hews93", "amount": 2500, "reference": "dam1266638dhhd"}, {"authorization": "AUTH_xfuz7dy4b9", "amount": 1500, "reference": "dam1266638dhhe"}, } resp, err := bcClient.Initiate(batch) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*BulkChargeClient) Pause ¶
func (b *BulkChargeClient) Pause(idOrCode string) (*Response, error)
Pause lets you pause a processing a batch
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) bcClient := p.NewBulkChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a bulk charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.BulkCharges field is a `BulkChargeClient` // Therefore, this is possible // resp, err := paystackClient.BulkCharges.Pause("<idOrCode>") resp, err := bcClient.Pause("<idOrSlug>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*BulkChargeClient) Resume ¶
func (b *BulkChargeClient) Resume(idOrCode string) (*Response, error)
Resume lets you resume a paused batch
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) bcClient := p.NewBulkChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a bulk charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.BulkCharges field is a `BulkChargeClient` // Therefore, this is possible // resp, err := paystackClient.BulkCharges.Resume("<idOrCode>") resp, err := bcClient.Resume("<idOrSlug>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type ChargeClient ¶
type ChargeClient struct {
// contains filtered or unexported fields
}
ChargeClient interacts with endpoints related to paystack charge resource that lets you configure a payment channel of your choice when initiating a payment.
func NewChargeClient ¶
func NewChargeClient(options ...ClientOptions) *ChargeClient
NewChargeClient creates a ChargeClient
Example import p "github.com/gray-adeyi/paystack" chargeClient := p.NewChargeClient(p.WithSecretKey("<paystack-secret-key>"))
func (*ChargeClient) Create ¶
func (c *ChargeClient) Create(email string, amount string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you initiate a payment by integrating the payment channel of your choice.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) chargeClient := p.NewChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Charges field is a `ChargeClient` // Therefore, this is possible // resp, err := paystackClient.Charges.Create("johndoe@example.com", 100000) // you can pass in optional parameters to the `Charges.Create` with `p.WithOptionalParameter` // for example say you want to specify the `amount`. // resp, err := ppClient.Create("johndoe@example.com", 100000, p.WithOptionalParameter("authorization_code","AUTH_xxx")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/charge/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := chargeClient.Create("johndoe@example.com", 100000)
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ChargeClient) PendingCharge ¶
func (c *ChargeClient) PendingCharge(reference string) (*Response, error)
PendingCharge lets you check the status of a charge. When you get pending as a charge status or if there was an exception when calling any of the /charge endpoints, wait 10 seconds or more, then make a check to see if its status has changed. Don't call too early as you may get a lot more pending than you should.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) chargeClient := p.NewChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Charges field is a `ChargeClient` // Therefore, this is possible // resp, err := paystackClient.Charges.PendingCharge("5bwib5v6anhe9xa")
resp, err := chargeClient.PendingCharge("5bwib5v6anhe9xa")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ChargeClient) SubmitAddress ¶
func (c *ChargeClient) SubmitAddress(address string, reference string, city string, state string, zipCode string) (*Response, error)
SubmitAddress lets you submit address to continue a charge
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) chargeClient := p.NewChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Charges field is a `ChargeClient` // Therefore, this is possible // resp, err := paystackClient.Charges.SubmitAddress("140 N 2ND ST", // "7c7rpkqpc0tijs8", "Stroudsburg", "PA", "18360")
resp, err := chargeClient.SubmitAddress("140 N 2ND ST", "7c7rpkqpc0tijs8", "Stroudsburg", "PA", "18360")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ChargeClient) SubmitBirthday ¶
func (c *ChargeClient) SubmitBirthday(birthday string, reference string) (*Response, error)
SubmitBirthday lets you submit a birthday when requested
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) chargeClient := p.NewChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Charges field is a `ChargeClient` // Therefore, this is possible // resp, err := paystackClient.Charges.SubmitBirthday("2016-09-21", "5bwib5v6anhe9xa")
resp, err := chargeClient.SubmitBirthday("2016-09-21", "5bwib5v6anhe9xa")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ChargeClient) SubmitPhone ¶
func (c *ChargeClient) SubmitPhone(phone string, reference string) (*Response, error)
SubmitPhone lets you submit phone number when requested
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) chargeClient := p.NewChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Charges field is a `ChargeClient` // Therefore, this is possible // resp, err := paystackClient.Charges.SubmitPhone("08012345678", "5bwib5v6anhe9xa")
resp, err := chargeClient.SubmitPhone("08012345678", "5bwib5v6anhe9xa")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ChargeClient) SubmitPin ¶
func (c *ChargeClient) SubmitPin(pin string, reference string) (*Response, error)
SubmitPin lets you submit pin to continue a charge
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) chargeClient := p.NewChargeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the charge client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Charges field is a `ChargeClient` // Therefore, this is possible // resp, err := paystackClient.Charges.SubmitPin("1234", "5bwib5v6anhe9xa")
resp, err := chargeClient.SubmitPin("1234", "5bwib5v6anhe9xa")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type ClientOptions ¶
type ClientOptions = func(client *APIClient)
ClientOptions is a type used to modify attributes of an APIClient. It can be passed into the NewAPIClient function while creating an APIClient
func WithBaseUrl ¶
func WithBaseUrl(baseUrl string) ClientOptions
WithBaseUrl lets you override paystack's base url for an APIClient. It should be used when creating an APIClient with the NewAPIClient function.
func WithSecretKey ¶
func WithSecretKey(secretKey string) ClientOptions
WithSecretKey lets you set the secret key of an APIClient. It should be used when creating an APIClient with the NewAPIClient function.
Example
import p "github.com/gray-adeyi/paystack" client := p.NewAPIClient(p.WithSecretKey("<your-paystack-secret-key>"))
type CustomerClient ¶
type CustomerClient struct {
// contains filtered or unexported fields
}
CustomerClient interacts with endpoints related to paystack Customer resource that allows you to create and manage Customers on your Integration.
func NewCustomerClient ¶
func NewCustomerClient(options ...ClientOptions) *CustomerClient
NewCustomerClient creates a CustomerClient
Example:
import p "github.com/gray-adeyi/paystack" customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>"))
func (*CustomerClient) All ¶
func (c *CustomerClient) All(queries ...Query) (*Response, error)
All lets you retrieve Customers available on your Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Customers field is a `CustomerClient` // Therefore, this is possible // resp, err := paystackClient.Customers.All() // All also accepts queries, so say you want to specify the page // to retrieve, you can write it like so. // resp, err := customerClient.All(p.WithQuery("page",2))
// see https://paystack.com/docs/api/customer/#list for supported query parameters
resp, err := customerClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*CustomerClient) Create ¶
func (c *CustomerClient) Create(email string, firstName string, lastName string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a customer on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Customers field is a `CustomerClient` // Therefore, this is possible // resp, err := paystackClient.Customers.Create("johndoe@example.com","John","Doe") // you can pass in optional parameters to the `customerClient.Create` with `p.WithOptionalParameter` // for example say you want to specify the `phone`. // resp, err := customerClient.Create("johndoe@example.com","John","Doe", p.WithOptionalParameter("phone","+2348123456789")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/customer/#create // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter`
resp, err := customerClient.Create("johndoe@example.com","John","Doe")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*CustomerClient) Deactivate ¶
func (c *CustomerClient) Deactivate(authorizationCode string) (*Response, error)
Deactivate lets you deactivate an authorization when the card needs to be forgotten
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Customers field is a `CustomerClient` // Therefore, this is possible // resp, err := paystackClient.Customers.Deactivate("AUTH_72btv547") resp, err := customerClient.Deactivate("AUTH_72btv547") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*CustomerClient) FetchOne ¶
func (c *CustomerClient) FetchOne(emailOrCode string) (*Response, error)
FetchOne lets you retrieve the details of a customer on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Customers field is a `CustomerClient` // Therefore, this is possible // resp, err := paystackClient.Customers.FetchOne("<emailOrCode>") resp, err := customerClient.FetchOne("<emailOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*CustomerClient) Flag ¶
func (c *CustomerClient) Flag(emailOrCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Flag lets you whitelist or blacklist a customer on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Customers field is a `CustomerClient` // Therefore, this is possible // resp, err := paystackClient.Customers.Flag("CUS_xr58yrr2ujlft9k") // you can pass in optional parameters to the `customerClient.Update` with `p.WithOptionalParameter` // for example say you want to specify the `risk_action`. // resp, err := customerClient.Flag("CUS_xr58yrr2ujlft9k", p.WithOptionalParameter("risk_action", "allow") // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/customer/#whitelist-blacklist // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter` resp, err := customerClient.Flag("CUS_xr58yrr2ujlft9k") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*CustomerClient) Update ¶
func (c *CustomerClient) Update(code string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update a customer's details on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Customers field is a `CustomerClient` // Therefore, this is possible // resp, err := paystackClient.Customers.Update("143", p.WithOptionalParameter("first_name","John")) // you can pass in optional parameters to the `customerClient.Update` with `p.WithOptionalParameter` // for example say you want to specify the `first_name`. // resp, err := customerClient.Update("143", p.WithOptionalParameter("first_name","John")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/customer/#update // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter` resp, err := customerClient.Update("143", p.WithOptionalParameter("first_name","John")) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*CustomerClient) Validate ¶
func (c *CustomerClient) Validate(code string, firstName string, lastName string, identificationType string, value string, country string, bvn string, bankCode string, accountNumber string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Validate lets you validate a customer's identity
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) customerClient := p.NewCustomerClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Customers field is a `CustomerClient` // Therefore, this is possible // resp, err := paystackClient.Customers.Validate("143", "Asta","Lavista","bank_account","","NG","20012345677","007","0123456789") // you can pass in optional parameters to the `customerClient.Validate` with `p.WithOptionalParameter` // for example say you want to specify the `middle_name`. // resp, err := customerClient.Validate("143", "Asta","Lavista","bank_account","","NG","20012345677","007", // "0123456789", p.WithOptionalParameter("middle_name","Doe")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/customer/#validate // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter` resp, err := customerClient.Validate("143", "Asta","Lavista","bank_account","","NG","20012345677","007","0123456789") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type DedicatedVirtualAccountClient ¶
type DedicatedVirtualAccountClient struct {
// contains filtered or unexported fields
}
DedicatedVirtualAccountClient interacts with endpoints related to paystack dedicated virtual account resource that enables Nigerian merchants to manage unique payment accounts of their Customers.
func NewDedicatedVirtualAccountClient ¶
func NewDedicatedVirtualAccountClient(options ...ClientOptions) *DedicatedVirtualAccountClient
NewDedicatedVirtualAccountClient creates a DedicatedVirtualAccountClient
Example:
import p "github.com/gray-adeyi/paystack" dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>"))
func (*DedicatedVirtualAccountClient) All ¶
func (d *DedicatedVirtualAccountClient) All(queries ...Query) (*Response, error)
All lets you retrieve dedicated virtual accounts available on your Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dedicated virtual account client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.All() // All also accepts queries, so say you want to customize how many Transactions to retrieve // and which page to retrieve, you can write it like so. // resp, err := dvaClient.All(p.WithQuery("active","true"), p.WithQuery("bank_id","035"))
// see https://paystack.com/docs/api/dedicated-virtual-account/#list for supported query parameters
resp, err := txnClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) Assign ¶
func (d *DedicatedVirtualAccountClient) Assign(email string, firstName string, lastName string, phone string, preferredBank string, country string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Assign lets you can create a customer, validate the customer, and assign a DVA to the customer.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.Assign("janedoe@test.com","Jane", // "Doe","Karen", "+2348100000000", "test-bank", "NG") // you can pass in optional parameters to the `DedicatedVirtualAccounts.Assign` with `p.WithOptionalParameter` // for example say you want to specify the `account_number`. // resp, err := dvaClient.Assign("janedoe@test.com","Jane", "Doe","Karen", "+2348100000000", "test-bank", "NG", // p.WithOptionalParameter("account_number","5273681014")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/dedicated-virtual-account/#create // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter`
resp, err := dvaClient.Assign("janedoe@test.com","Jane", "Doe","Karen", "+2348100000000", "test-bank", "NG")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) BankProviders ¶
func (d *DedicatedVirtualAccountClient) BankProviders() (*Response, error)
BankProviders lets you retrieve available bank providers for a dedicated virtual account
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dedicated virtual account client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.BankProviders() resp, err := dvaClient.BankProviders() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) Create ¶
func (d *DedicatedVirtualAccountClient) Create(customerIdOrCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a dedicated virtual account for an existing customer
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dedicated virtual account client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.Create("481193") // you can pass in optional parameters to the `DedicatedVirtualAccounts.Create` with `p.WithOptionalParameter` // for example say you want to specify the `preferred_bank`. // resp, err := dvaClient.Create("481193", p.WithOptionalParameter("preferred_bank","wema-bank")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/dedicated-virtual-account/#create // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter`
resp, err := dvaClient.Create("481193")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) Deactivate ¶
func (d *DedicatedVirtualAccountClient) Deactivate(id string) (*Response, error)
Deactivate lets you deactivate a dedicated virtual account on your Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dedicated virtual account client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.Deactivate("<dedicatedAccountId>") resp, err := dvaClient.Deactivate("<dedicatedAccountId>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) FetchOne ¶
func (d *DedicatedVirtualAccountClient) FetchOne(dedicatedAccountId string) (*Response, error)
FetchOne lets you retrieve details of a dedicated virtual account on your Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dedicated virtual account client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.FetchOne("<dedicatedAccountId>") resp, err := dvaClient.FetchOne("<dedicatedAccountId>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) RemoveSplit ¶
func (d *DedicatedVirtualAccountClient) RemoveSplit(accountNumber string) (*Response, error)
RemoveSplit lets you remove a split payment for Transactions. If you've previously set up split payment for Transactions on a dedicated virtual account
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dedicated virtual account client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.RemoveSplit("<accountNumber>") resp, err := dvaClient.RemoveSplit("<accountNumber>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) Requery ¶
func (d *DedicatedVirtualAccountClient) Requery(queries ...Query) (*Response, error)
Requery lets you requery Dedicated Virtual Account for new Transactions
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dedicated virtual account client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.Requery() // All also accepts queries, so say you want to customize how many Transactions to retrieve // and which page to retrieve, you can write it like so. // resp, err := dvaClient.Requery(p.WithQuery("account_number","1234567890"), p.WithQuery("provider_slug","example-provider"))
// see https://paystack.com/docs/api/dedicated-virtual-account/#requery for supported query parameters
resp, err := txnClient.Requery() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DedicatedVirtualAccountClient) Split ¶
func (d *DedicatedVirtualAccountClient) Split(customerIdOrCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Split lets you split a dedicated virtual account transaction with one or more accounts
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dvaClient := p.NewDedicatedVirtualAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a customer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.DedicatedVirtualAccounts field is a `DedicatedVirtualAccountClient` // Therefore, this is possible // resp, err := paystackClient.DedicatedVirtualAccounts.Split("<customerIdOrCode>") // you can pass in optional parameters to the `DedicatedVirtualAccounts.Split` with `p.WithOptionalParameter` // for example say you want to specify the `preferred_bank`. // resp, err := dvaClient.Split("<customerIdOrCode>", p.WithOptionalParameter("preferred_bank","wema-bank")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/dedicated-virtual-account/#add-split // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter`
resp, err := dvaClient.Split("<customerIdOrCode>")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type DisputeClient ¶
type DisputeClient struct {
// contains filtered or unexported fields
}
DisputeClient interacts with endpoint related to paystack dispute resource that lets you manage transaction Disputes on your Integration.
func NewDisputeClient ¶
func NewDisputeClient(options ...ClientOptions) *DisputeClient
NewDisputeClient creates a DisputeClient
Example import p "github.com/gray-adeyi/paystack" dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>"))
func (*DisputeClient) AddEvidence ¶
func (d *DisputeClient) AddEvidence(id string, customerEmail string, customerName string, customerPhone string, serviceDetails string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
AddEvidence lets you provide evidence for a dispute
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dispute client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.AddEvidence("<id>", "johndoe@example.com", // "John Doe", "5085072209", "claim for buying product") // you can pass in optional parameters to the `Disputes.Update` with `p.WithOptionalParameter` // for example say you want to specify the `delivery_address`. // resp, err := dClient.AddEvidence("<id>", "johndoe@example.com", "John Doe", "5085072209", "claim for buying product", // p.WithOptionalParameter("delivery_address", "3a ladoke street ogbomoso")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/dispute/#evidence // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter` resp, err := dClient.AddEvidence("<id>", "johndoe@example.com", "John Doe", "5085072209", "claim for buying product") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DisputeClient) All ¶
func (d *DisputeClient) All(queries ...Query) (*Response, error)
All lets you retrieve Disputes filed against you
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dispute client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.All() // All also accepts queries, so say you want to specify the date range, you can write it like so. // resp, err := dClient.All(p.WithQuery("from","2023-01-01"), p.WithQuery("to","2023-12-31"))
// see https://paystack.com/docs/api/dispute/#list for supported query parameters
resp, err := dClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DisputeClient) AllTransactionDisputes ¶
func (d *DisputeClient) AllTransactionDisputes(transactionId string) (*Response, error)
AllTransactionDisputes lets you retrieve Disputes for a particular transaction
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dispute client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.AllTransactionDisputes("transactionId") resp, err := dClient.AllTransactionDisputes("transactionId") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DisputeClient) Export ¶
func (d *DisputeClient) Export(queries ...Query) (*Response, error)
Export lets you export Disputes available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dispute client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.Export() // All also accepts queries, so say you want to specify the date range, you can write it like so. // resp, err := dClient.Export(p.WithQuery("from","2023-01-01"), p.WithQuery("to","2023-12-31"))
// see https://paystack.com/docs/api/dispute/#export for supported query parameters
resp, err := dClient.Export() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DisputeClient) FetchOne ¶
func (d *DisputeClient) FetchOne(id string) (*Response, error)
FetchOne lets you retrieve more details about a dispute.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment page client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.FetchOne("<id>") resp, err := dClient.FetchOne("<id>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DisputeClient) Resolve ¶
func (d *DisputeClient) Resolve(id string, resolution string, message string, refundAmount int, uploadedFilename string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Resolve lets you resolve a dispute on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dispute client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.AddEvidence("<id>", "johndoe@example.com", // "John Doe", "5085072209", "claim for buying product") // you can pass in optional parameters to the `Disputes.Update` with `p.WithOptionalParameter` // for example say you want to specify the `evidence`. // resp, err := dClient.AddEvidence("<id>", "johndoe@example.com","John Doe", "5085072209", "claim for buying product", // p.WithOptionalParameter("evidence", "evidenceId")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/dispute/#evidence // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter` resp, err := dClient.AddEvidence("<id>", "merchant-accepted", "Merchant accepted", 10000, "resolve.pdf") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DisputeClient) Update ¶
func (d *DisputeClient) Update(id string, referenceAmount int, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update the details of a dispute on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dispute client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.Update("<id>", 1002) // you can pass in optional parameters to the `Disputes.Update` with `p.WithOptionalParameter` // for example say you want to specify the `uploaded_filename`. // resp, err := dClient.Update("<id>", 1002, "description", // p.WithOptionalParameter("uploaded_filename","Disputes.pdf")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/dispute/#update // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter` resp, err := dClient.Update("<id>", 1002) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*DisputeClient) UploadURL ¶
func (d *DisputeClient) UploadURL(id string, queries ...Query) (*Response, error)
UploadURL lets you retrieve Disputes for a particular transaction
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) dClient := p.NewDisputeClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a dispute client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Disputes field is a `DisputeClient` // Therefore, this is possible // resp, err := paystackClient.Disputes.UploadURL() // All also accepts queries, so say you want to specify the `upload_filename`, you can write it like so. // resp, err := dClient.UploadURL("disputeId", p.WithQuery("upload_filename","filename.txt"))
// see https://paystack.com/docs/api/dispute/#upload-url for supported query parameters
resp, err := dClient.UploadURL() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type IntegrationClient ¶
type IntegrationClient struct {
// contains filtered or unexported fields
}
IntegrationClient interacts with endpoints related to paystack Integration resource that lets you manage some settings on your Integration.
func NewIntegrationClient ¶
func NewIntegrationClient(options ...ClientOptions) *IntegrationClient
NewIntegrationClient creates an IntegrationClient
Example import p "github.com/gray-adeyi/paystack" intClient := p.NewIntegrationClient(p.WithSecretKey("<paystack-secret-key>"))
func (*IntegrationClient) Timeout ¶
func (i *IntegrationClient) Timeout() (*Response, error)
Timeout lets you retrieve the payment session timeout on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) intClient := p.NewIntegrationClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access an Integration client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Integration field is a `IntegrationClient` // Therefore, this is possible // resp, err := paystackClient.Integration.Timeout() resp, err := intClient.Timeout() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*IntegrationClient) UpdateTimeout ¶
func (i *IntegrationClient) UpdateTimeout(timeout int) (*Response, error)
UpdateTimeout lets you update the payment session timeout on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tcClient := p.NewIntegrationClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access an Integration client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Integration field is a `IntegrationClient` // Therefore, this is possible // resp, err := paystackClient.Integration.UpdateTimeout(5) resp, err := tcClient.UpdateTimeout(5) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type MiscellaneousClient ¶
type MiscellaneousClient struct {
// contains filtered or unexported fields
}
MiscellaneousClient interacts with endpoints related to paystack Miscellaneous resource that provides information that is relevant to other client methods
func NewMiscellaneousClient ¶
func NewMiscellaneousClient(options ...ClientOptions) *MiscellaneousClient
NewMiscellaneousClient creates a MiscellaneousClient
Example import p "github.com/gray-adeyi/paystack" miscClient := p.NewMiscellaneousClient(p.WithSecretKey("<paystack-secret-key>"))
func (*MiscellaneousClient) Banks ¶
func (p *MiscellaneousClient) Banks(queries ...Query) (*Response, error)
Banks lets you retrieve a list of all supported banks and their properties
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) miscClient := p.NewMiscellaneousClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment pages client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Miscellaneous field is a `MiscellaneousClient` // Therefore, this is possible // resp, err := paystackClient.Miscellaneous.Banks() // Banks also accepts queries, so say you want to customize how many banks to retrieve // and which country the banks to retrieve are from, you can write it like so. // resp, err := miscClient.Banks(p.WithQuery("perPage","50"), p.WithQuery("country","nigeria"))
// see https://paystack.com/docs/api/miscellaneous/#bank for supported query parameters
resp, err := miscClient.Banks() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*MiscellaneousClient) Countries ¶
func (p *MiscellaneousClient) Countries() (*Response, error)
Countries let you retrieve a list of countries that Paystack currently supports
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) miscClient := p.NewMiscellaneousClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment pages client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Miscellaneous field is a `MiscellaneousClient` // Therefore, this is possible // resp, err := paystackClient.Miscellaneous.Countries() resp, err := miscClient.Countries() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*MiscellaneousClient) States ¶
func (p *MiscellaneousClient) States(queries ...Query) (*Response, error)
States lets you retrieve a list of states for a country for address Verification
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) miscClient := p.NewMiscellaneousClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment pages client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Miscellaneous field is a `MiscellaneousClient` // Therefore, this is possible // resp, err := paystackClient.Miscellaneous.States() // States also accepts queries, so say you want to specify country the states // to retrieve are from, you can write it like so. // resp, err := miscClient.States(p.WithQuery("country","nigeria"))
// see https://paystack.com/docs/api/miscellaneous/#avs-states for supported query parameters
resp, err := miscClient.States() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type OptionalPayloadParameter ¶
OptionalPayloadParameter is a type for storing optional parameters used by some APIClient methods that needs to accept optional parameter.
func WithOptionalParameter ¶
func WithOptionalParameter(key string, value interface{}) OptionalPayloadParameter
WithOptionalParameter lets you add optional parameters when calling some client methods and you need to add optional parameters to your payload.
Example
import p "github.com/gray-adeyi/paystack" client := p.NewAPIClient(p.WithSecretKey("<your-paystack-secret-key>")) resp, err := client.DedicatedVirtualAccounts.Create("481193", p.WithOptionalParameter("preferred_bank","wema-bank"))
WithOptionalParameter is used to pass the `preferred_bank` optional parameter in the client method call
type PaymentPageClient ¶
type PaymentPageClient struct {
// contains filtered or unexported fields
}
PaymentPageClient interacts with endpoints related to paystack payment page resource that lets you provide a quick and secure way to collect payment for Products.
func NewPaymentPageClient ¶
func NewPaymentPageClient(options ...ClientOptions) *PaymentPageClient
NewPaymentPageClient creates a PaymentPageClient
Example import p "github.com/gray-adeyi/paystack" ppClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>"))
func (*PaymentPageClient) AddProducts ¶
func (p *PaymentPageClient) AddProducts(id string, products []string) (*Response, error)
AddProducts lets you add Products to a payment page
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) ppClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment page client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentPages field is a `PaymentPageClient` // Therefore, this is possible // resp, err := paystackClient.PaymentPages.AddProducts("<id>", []string{4"73", "292"}) resp, err := ppClient.AddProducts("<id>", []string{4"73", "292"}) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentPageClient) All ¶
func (p *PaymentPageClient) All(queries ...Query) (*Response, error)
All lets you retrieve payment pages available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) ppClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment pages client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentPages field is a `PaymentPageClient` // Therefore, this is possible // resp, err := paystackClient.PaymentPages.All() // All also accepts queries, so say you want to customize how many payment pages to retrieve // and which page to retrieve, you can write it like so. // resp, err := ppClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/page/#list for supported query parameters
resp, err := ppClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentPageClient) CheckSlug ¶
func (p *PaymentPageClient) CheckSlug(slug string) (*Response, error)
CheckSlug lets you check the availability of a slug for a payment page
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) ppClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment page client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentPages field is a `PaymentPageClient` // Therefore, this is possible // resp, err := paystackClient.PaymentPages.CheckSlug("<slug>") resp, err := ppClient.CheckSlug("<slug>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentPageClient) Create ¶
func (p *PaymentPageClient) Create(name string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a payment page on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) ppClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the payment pages client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentPages field is a `PaymentPageClient` // Therefore, this is possible // resp, err := paystackClient.PaymentPages.Create("Buttercup Brunch") // you can pass in optional parameters to the `PaymentPages.Create` with `p.WithOptionalParameter` // for example say you want to specify the `amount`. // resp, err := ppClient.Create("Buttercup Brunch", p.WithOptionalParameter("amount",500000)) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/page/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := ppClient.Create("Buttercup Brunch")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentPageClient) FetchOne ¶
func (p *PaymentPageClient) FetchOne(idOrSlug string) (*Response, error)
FetchOne lets you retrieve details of a payment page on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) ppClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment page client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentPages field is a `PaymentPageClient` // Therefore, this is possible // resp, err := paystackClient.PaymentPages.FetchOne("<idOrSlug>") resp, err := ppClient.FetchOne("<idOrSlug>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentPageClient) Update ¶
func (p *PaymentPageClient) Update(idOrSlug string, name string, description string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update a payment page details on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) ppClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment page client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentPages field is a `PaymentPageClient` // Therefore, this is possible // resp, err := paystackClient.PaymentPages.Update("<idOrSlug>", "Buttercup Brunch", "description") // you can pass in optional parameters to the `SubAccounts.Update` with `p.WithOptionalParameter` // for example say you want to specify the `amount`. // resp, err := trClient.Create("<idOrSlug>", "Buttercup Brunch", "description", // p.WithOptionalParameter("amount",500000)) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/page/#update // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter` resp, err := ppClient.Update("<idOrSlug>", "Buttercup Brunch", "description") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type PaymentRequestClient ¶
type PaymentRequestClient struct {
// contains filtered or unexported fields
}
PaymentRequestClient interacts with endpoints related to paystack payment request resource that lets you manage requests for payment of goods and services.
func NewPaymentRequestClient ¶
func NewPaymentRequestClient(options ...ClientOptions) *PaymentRequestClient
NewPaymentRequestClient creates a PaymentRequestClient
Example import p "github.com/gray-adeyi/paystack" prClient := p.NewPaymentPageClient(p.WithSecretKey("<paystack-secret-key>"))
func (*PaymentRequestClient) All ¶
func (p *PaymentRequestClient) All(queries ...Query) (*Response, error)
All lets you retrieve the payment requests available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.All() // All also accepts queries, so say you want to customize how many payment pages to retrieve // and which page to retrieve, you can write it like so. // resp, err := prClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/payment-request/#list for supported query parameters
resp, err := prClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) Archive ¶
func (p *PaymentRequestClient) Archive(idOrCode string) (*Response, error)
Archive lets you archive a payment request. A payment request will no longer be fetched on list or returned on verify
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.Archive("<idOrCode>") resp, err := prClient.Archive("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) Create ¶
func (p *PaymentRequestClient) Create(customerIdOrCode string, amount int, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a payment request for a transaction on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.Create("CUS_xwaj0txjryg393b", 500000) // you can pass in optional parameters to the `PaymentRequests.Create` with `p.WithOptionalParameter` // for example say you want to specify the `due_date`. // resp, err := prClient.Create("CUS_xwaj0txjryg393b", 500000, p.WithOptionalParameter("due_date","2023-12-25")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/payment-request/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := prClient.Create("CUS_xwaj0txjryg393b", 500000)
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) FetchOne ¶
func (p *PaymentRequestClient) FetchOne(idOrCode string) (*Response, error)
FetchOne lets you retrieve details of a payment request on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.FetchOne("<idOrCode>") resp, err := prClient.FetchOne("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) Finalize ¶
func (p *PaymentRequestClient) Finalize(code string, sendNotification bool) (*Response, error)
Finalize lets you finalize a draft payment request
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.Finalize("<code>", true) resp, err := prClient.Finalize("<code>", true) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) SendNotification ¶
func (p *PaymentRequestClient) SendNotification(code string) (*Response, error)
SendNotification lets you send notification of a payment request to your Customers
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.SendNotification("<code>") resp, err := prClient.SendNotification("<code>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) Total ¶
func (p *PaymentRequestClient) Total() (*Response, error)
Total lets you retrieve payment requests metric
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.Total() resp, err := prClient.Total() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) Update ¶
func (p *PaymentRequestClient) Update(idOrCode string, customerIdOrCode string, amount int, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update a payment request details on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.Update("<idOrCode>", "CUS_XXX", "description") // you can pass in optional parameters to the `SubAccounts.Update` with `p.WithOptionalParameter` // for example say you want to specify the `amount`. // resp, err := saClient.Create("<idOrSlug>", "Buttercup Brunch", "description", // p.WithOptionalParameter("amount",500000)) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/page/#update // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter` resp, err := prClient.Update("<idOrSlug>", "Buttercup Brunch", "description") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PaymentRequestClient) Verify ¶
func (p *PaymentRequestClient) Verify(code string) (*Response, error)
Verify lets you verify the details of a payment request on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prClient := p.NewPaymentRequestClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a payment request client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.PaymentRequests field is a `PaymentRequestClient` // Therefore, this is possible // resp, err := paystackClient.PaymentRequests.Verify("<code>") resp, err := prClient.Verify("<code>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type PlanClient ¶
type PlanClient struct {
// contains filtered or unexported fields
}
PlanClient interacts with endpoints related to paystack plan resource that lets you create and manage installment payment options on your Integration.
func NewPlanClient ¶
func NewPlanClient(options ...ClientOptions) *PlanClient
NewPlanClient creates a PlanClient
Example: import p "github.com/gray-adeyi/paystack" planClient := p.NewPlanClient(p.WithSecretKey("<paystack-secret-key>"))
func (*PlanClient) All ¶
func (p *PlanClient) All(queries ...Query) (*Response, error)
All lets you retrieve Plans available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) planClient := p.NewPlanClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a plan client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Plans field is a `PlanClient` // Therefore, this is possible // resp, err := paystackClient.Plans.All() // All also accepts queries, so say you want to customize how many Plans to retrieve // and which page to retrieve, you can write it like so. // resp, err := planClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/plan/#list for supported query parameters
resp, err := planClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PlanClient) Create ¶
func (p *PlanClient) Create(name string, amount int, interval string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a plan on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) planClient := p.NewPlanClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a plan client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Plans field is a `PlanClient` // Therefore, this is possible // resp, err := paystackClient.Plans.Create("Monthly retainer", 500000, "monthly") // you can pass in optional parameters to the `Plans.Create` with `p.WithOptionalParameter` // for example, you want to specify the `description`. // resp, err := planClient.Create("Monthly retainer", 500000, "monthly", // p.WithOptionalParameter("description","a test description")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/plan/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := planClient.Create("Monthly retainer", 500000, "monthly")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PlanClient) FetchOne ¶
func (p *PlanClient) FetchOne(idOrCode string) (*Response, error)
FetchOne lets you retrieve details of a plan on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) planClient := p.NewPlanClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a plan client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Plans field is a `PlanClient` // Therefore, this is possible // resp, err := paystackClient.Plans.FetchOne("<idOrCode>") resp, err := planClient.FetchOne("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*PlanClient) Update ¶
func (p *PlanClient) Update(idOrCode string, name string, amount int, interval string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update a plan details on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) planClient := p.NewPlanClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a plan client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Plans field is a `PlanClient` // Therefore, this is possible // resp, err := paystackClient.Plans.Update("<idOrCode>","Monthly retainer", 500000, "monthly") // you can pass in optional parameters to the `SubAccounts.Update` with `p.WithOptionalParameter` // for example say you want to specify the `description`. // resp, err := saClient.Update("<idOrCode>","Monthly retainer", 500000, "monthly", // p.WithOptionalParameter("description","test description")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/subaccount/#update // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter` resp, err := planClient.Update("<idOrCode>","Monthly retainer", 500000, "monthly") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type ProductClient ¶
type ProductClient struct {
// contains filtered or unexported fields
}
ProductClient interacts with endpoints related to paystack product resource that allows you to create and manage inventories on your Integration.
func NewProductClient ¶
func NewProductClient(options ...ClientOptions) *ProductClient
NewProductClient creates a ProductClient
Example import p "github.com/gray-adeyi/paystack"
prodClient := p.NewProductClient(p.WithSeretKey("<paystack-secret-key>"))
func (*ProductClient) All ¶
func (p *ProductClient) All(queries ...Query) (*Response, error)
All lets you retrieve Products available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prodClient := p.NewProductClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a product client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Products field is a `ProductClient` // Therefore, this is possible // resp, err := paystackClient.Products.All() // All also accepts queries, so say you want to customize how many Products to retrieve // and which page to retrieve, you can write it like so. // resp, err := prodClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/product/#list for supported query parameters
resp, err := saClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ProductClient) Create ¶
func (p *ProductClient) Create(name string, description string, price int, currency string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a product on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prodClient := p.NewProductClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a product client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Products field is a `ProductClient` // Therefore, this is possible // resp, err := paystackClient.Products.Create("Puff Puff", "Crispy flour ball with fluffy interior", 5000, "NGN") // you can pass in optional parameters to the `Products.Create` with `p.WithOptionalParameter` // for example say you want to specify the `unlimited`. // resp, err := prodClient.Create("Puff Puff", "Crispy flour ball with fluffy interior", 5000, "NGN", // p.WithOptionalParameter("unlimited","true")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/product/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := prodClient.Create("Puff Puff", "Crispy flour ball with fluffy interior", 5000, "NGN")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ProductClient) FetchOne ¶
func (p *ProductClient) FetchOne(id string) (*Response, error)
FetchOne lets you Get details of a product on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prodClient := p.NewSubAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a product client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Products field is a `ProductClient` // Therefore, this is possible // resp, err := paystackClient.Products.FetchOne("<id>") resp, err := prodClient.FetchOne("<id>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*ProductClient) Update ¶
func (p *ProductClient) Update(id string, name string, description string, price int, currency string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update a product details on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) prodClient := p.NewProductClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a product client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Products field is a `ProductClient` // Therefore, this is possible // resp, err := paystackClient.Products.Update("<id>", "Product Six", "Product Six Description",500000, "USD") // you can pass in optional parameters to the `Products.Update` with `p.WithOptionalParameter` // for example say you want to specify the `unlimited`. // resp, err := prodClient.Update("<id>", "Product Six", "Product Six Description",500000, "USD", // p.WithOptionalParameter("unlimited","true")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/product/#update // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter` resp, err := prodClient.Update("<id>", "Product Six", "Product Six Description",500000, "USD") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type RefundClient ¶
type RefundClient struct {
// contains filtered or unexported fields
}
RefundClient interacts with endpoints related to paystack refund resource that lets you create and manage transaction Refunds.
func NewRefundClient ¶
func NewRefundClient(options ...ClientOptions) *RefundClient
NewRefundClient creates a RefundClient
Example import p "github.com/gray-adeyi/paystack" refundClient := p.NewRefundClient(p.WithSecretKey("<paystack-secret-key>"))
func (*RefundClient) All ¶
func (r *RefundClient) All(queries ...Query) (*Response, error)
All lets you retrieve Refunds available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) refundClient := p.NewRefundClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a refund client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Refunds field is a `RefundClient` // Therefore, this is possible // resp, err := paystackClient.Refunds.All() // All also accepts queries, so say you want to customize how many Refunds to retrieve // and which page to retrieve, you can write it like so. // resp, err := refundClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/refund/#list for supported query parameters
resp, err := refundClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*RefundClient) Create ¶
func (r *RefundClient) Create(transaction string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create and manage transaction Refunds.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) refundClient := p.NewRefundClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the refund client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.refund field is a `RefundClient` // Therefore, this is possible // resp, err := paystackClient.Refunds.Create("1641") // you can pass in optional parameters to the `Refunds.Create` with `p.WithOptionalParameter` // for example say you want to specify the `amount`. // resp, err := refundClient.Create("1641", p.WithOptionalParameter("amount",500000)) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/refund/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := refundClient.Create("1641")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*RefundClient) FetchOne ¶
func (r *RefundClient) FetchOne(reference string) (*Response, error)
FetchOne lets you retrieve the details of a refund on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) refundClient := p.NewRefundClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a refund client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Refunds field is a `RefundClient` // Therefore, this is possible // resp, err := paystackClient.Refunds.FetchOne("<reference>") resp, err := ppClient.FetchOne("<reference>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type Response ¶
Response is a struct containing the status code and data retrieved from paystack. Response.Data is a slice of byte that is JSON serializable.
type SettlementClient ¶
type SettlementClient struct {
// contains filtered or unexported fields
}
SettlementClient interacts with endpoints related to paystack settlement resource that lets you gain insights into payouts made by Paystack to your bank account.
func NewSettlementClient ¶
func NewSettlementClient(options ...ClientOptions) *SettlementClient
NewSettlementClient creates a SettlementClient
Example import p "github.com/gray-adeyi/paystack" sClient := p.NewSettlementClient(p.WithSecretKey("<paystack-secret-key>"))
func (*SettlementClient) All ¶
func (s *SettlementClient) All(queries ...Query) (*Response, error)
All lets you retrieve Settlements made to your settlement accounts
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) sClient := p.NewSettlementClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a settlement client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Settlements field is a `SettlementClient` // Therefore, this is possible // resp, err := paystackClient.Settlements.All() // All also accepts queries, so say you want to customize how many payment pages to retrieve // and which page to retrieve, you can write it like so. // resp, err := sClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/settlement/#list for supported query parameters
resp, err := sClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SettlementClient) AllTransactions ¶
func (s *SettlementClient) AllTransactions(settlementId string, queries ...Query) (*Response, error)
AllTransactions lets you retrieve the Transactions that make up a particular settlement
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) sClient := p.NewSettlementClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a settlement client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Settlements field is a `SettlementClient` // Therefore, this is possible // resp, err := paystackClient.Settlements.AllTransactions("<settlementId>") // All also accepts queries, so say you want to customize how many payment pages to retrieve // and which page to retrieve, you can write it like so. // resp, err := sClient.AllTransactions("<settlementId>", p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/settlement/#transactions for supported query parameters
resp, err := sClient.AllTransactions("<settlementId>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type SubAccountClient ¶
type SubAccountClient struct {
// contains filtered or unexported fields
}
SubAccountClient interacts with endpoints related to paystack subaccount resource that lets you create and manage subaccounts on your Integration. Subaccounts can be used to split payment between two accounts (your main account and a subaccount).
func NewSubAccountClient ¶
func NewSubAccountClient(options ...ClientOptions) *SubAccountClient
NewSubAccountClient creates a SubAccountClient
Example import p "github.com/gray-adeyi/paystack" saClient := p.NewSubAccountClient(p.WithSecretKey("<paystack-secret-key>"))
func (*SubAccountClient) All ¶
func (s *SubAccountClient) All(queries ...Query) (*Response, error)
All lets you retrieve subaccounts available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) saClient := p.NewSubAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subaccount client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.SubAccounts field is a `SubAccountClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.All() // All also accepts queries, so say you want to customize how many subaccounts to retrieve // and which page to retrieve, you can write it like so. // resp, err := saClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/subaccount/#list for supported query parameters
resp, err := saClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubAccountClient) Create ¶
func (s *SubAccountClient) Create(businessName string, settlementBank string, accountNumber string, percentageCharge float32, description string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a dedicated virtual account for an existing customer
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) saClient := p.NewSubAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subaccount client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.SubAccounts field is a `SubAccountClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.Create("Sunshine Studios", "044", "0193274682", 18.2,"") // you can pass in optional parameters to the `SubAccounts.Create` with `p.WithOptionalParameter` // for example say you want to specify the `preferred_bank`. // resp, err := saClient.Create("Sunshine Studios", "044", "0193274682", 18.2,"", // p.WithOptionalParameter("primary_contact_email","johndoe@example.com")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/subaccount/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := saClient.Create("Sunshine Studios", "044", "0193274682", 18.2,"")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubAccountClient) FetchOne ¶
func (s *SubAccountClient) FetchOne(idOrCode string) (*Response, error)
FetchOne lets you retrieve details of a subaccount on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) saClient := p.NewSubAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subaccount client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.SubAccounts field is a `SubAccountClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.FetchOne("<idOrCode>") resp, err := saClient.FetchOne("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubAccountClient) Update ¶
func (s *SubAccountClient) Update(idOrCode string, businessName string, settlementBank string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update a subaccount details on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) saClient := p.NewSubAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.SubAccounts field is a `SubAccountClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.Update("<idOrCode>", "Sunshine Studios", "044") // you can pass in optional parameters to the `SubAccounts.Update` with `p.WithOptionalParameter` // for example say you want to specify the `preferred_bank`. // resp, err := saClient.Create("<idOrCode>","Sunshine Studios", "044", // p.WithOptionalParameter("primary_contact_email","johndoe@example.com")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/subaccount/#update // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter` resp, err := saClient.Update("<idOrCode>", "Sunshine Studios", "044") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type SubscriptionClient ¶
type SubscriptionClient struct {
// contains filtered or unexported fields
}
SubscriptionClient interacts with endpoints related to paystack subscription resource that lets you create and manage recurring payment on your Integration.
func NewSubscriptionClient ¶
func NewSubscriptionClient(options ...ClientOptions) *SubscriptionClient
NewSubscriptionClient create a SubscriptionClient
Example import p "github.com/gray-adeyi/paystack" subClient := p.NewSubscriptionClient(p.WithSecretKey("<paystack-secret-key>")
func (*SubscriptionClient) All ¶
func (s *SubscriptionClient) All(queries ...Query) (*Response, error)
All lets you retrieve Subscriptions available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) subClient := p.NewSubscriptionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subscription client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Subscriptions field is a `SubscriptionClient` // Therefore, this is possible // resp, err := paystackClient.Subscriptions.All() // All also accepts queries, so say you want to customize how many Subscriptions to retrieve // and which page to retrieve, you can write it like so. // resp, err := subClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/subscription/#list for supported query parameters
resp, err := subClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubscriptionClient) Create ¶
func (s *SubscriptionClient) Create(customer string, plan string, authorization string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a subscription on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) subClient := p.NewSubAccountClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subscription client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Subscriptions field is a `SubscriptionClient` // Therefore, this is possible // resp, err := paystackClient.Subscriptions.Create("CUS_xnxdt6s1zg1f4nx", "PLN_gx2wn530m0i3w3m", "AUTH_xxx") // you can pass in optional parameters to the `SubAccounts.Create` with `p.WithOptionalParameter` // for example say you want to specify the `start_date`. // resp, err := subClient.Create("CUS_xnxdt6s1zg1f4nx", "PLN_gx2wn530m0i3w3m", "AUTH_xxx", // p.WithOptionalParameter("start_date","2023-10-16T00:30:13+01:00")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/subscription/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := subClient.CreateCreate("CUS_xnxdt6s1zg1f4nx", "PLN_gx2wn530m0i3w3m", "AUTH_xxx")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubscriptionClient) Disable ¶
func (s *SubscriptionClient) Disable(code string, token string) (*Response, error)
Disable lets you disable a subscription on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) subClient := p.NewSubscriptionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subscription client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Subscriptions field is a `SubscriptionClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.Disable("SUB_vsyqdmlzble3uii", "d7gofp6yppn3qz7") resp, err := subClient.Disable("SUB_vsyqdmlzble3uii", "d7gofp6yppn3qz7") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubscriptionClient) Enable ¶
func (s *SubscriptionClient) Enable(code string, token string) (*Response, error)
Enable lets you enable a subscription on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) subClient := p.NewSubscriptionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subscription client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Subscriptions field is a `SubscriptionClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.Enable("SUB_vsyqdmlzble3uii", "d7gofp6yppn3qz7") resp, err := subClient.Enable("SUB_vsyqdmlzble3uii", "d7gofp6yppn3qz7") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubscriptionClient) FetchOne ¶
func (s *SubscriptionClient) FetchOne(idOrCode string) (*Response, error)
FetchOne lets you retrieve details of a subscription on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) subClient := p.NewSubscriptionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subscription client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Subscriptions field is a `SubscriptionClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.FetchOne("<idOrCode>") resp, err := subClient.FetchOne("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubscriptionClient) GenerateLink ¶
func (s *SubscriptionClient) GenerateLink(code string) (*Response, error)
GenerateLink lets you generate a link for updating the card on a subscription
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) subClient := p.NewSubscriptionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subscription client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Subscriptions field is a `SubscriptionClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.GenerateLink("SUB_vsyqdmlzble3uii") resp, err := subClient.GenerateLink("SUB_vsyqdmlzble3uii") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*SubscriptionClient) SendLink ¶
func (s *SubscriptionClient) SendLink(code string) (*Response, error)
SendLink lets you email a customer a link for updating the card on their subscription
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) subClient := p.NewSubscriptionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a subscription client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Subscriptions field is a `SubscriptionClient` // Therefore, this is possible // resp, err := paystackClient.SubAccounts.SendLink("SUB_vsyqdmlzble3uii") resp, err := subClient.SendLink("SUB_vsyqdmlzble3uii") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type TerminalClient ¶
type TerminalClient struct {
// contains filtered or unexported fields
}
TerminalClient interacts with endpoints related to paystack Terminal resource that allows you to build delightful in-person payment experiences.
func NewTerminalClient ¶
func NewTerminalClient(options ...ClientOptions) *TerminalClient
NewTerminalClient creates a TerminalClient
Example:
import p "github.com/gray-adeyi/paystack" terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>"))
func (*TerminalClient) All ¶
func (t *TerminalClient) All(queries ...Query) (*Response, error)
All lets you retrieve the Terminals available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.All() // All also accepts queries, so say you want to customize how many Terminals to retrieve, // you can write it like so. // resp, err := txnClient.All(p.WithQuery("perPage","50"))
// see https://paystack.com/docs/api/terminal/#list for supported query parameters
resp, err := terminalClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TerminalClient) Commission ¶
func (t *TerminalClient) Commission(serialNumber string) (*Response, error)
Commission lets you activate your debug device by linking it to your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // resp, err := paystackClient.Terminals.Commission("<serialNumber>") resp, err := terminalClient.Commission("<serialNumber>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TerminalClient) Decommission ¶
func (t *TerminalClient) Decommission(serialNumber string) (*Response, error)
Decommission lets you unlink your debug device from your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // resp, err := paystackClient.Terminals.Commission("<serialNumber>") resp, err := terminalClient.Commission("<serialNumber>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TerminalClient) EventStatus ¶
func (t *TerminalClient) EventStatus(terminalId string, eventId string) (*Response, error)
EventStatus lets you check the status of an event sent to the Terminal
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // resp, err := paystackClient.Terminals.EventStatus("30","616d721e8c5cd40a0cdd54a6") payload := map[string]interface{}{ "id": 7895939, "reference": 4634337895939 } resp, err := terminalClient.EventStatus("30","616d721e8c5cd40a0cdd54a6") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TerminalClient) FetchOne ¶
func (t *TerminalClient) FetchOne(terminalId string) (*Response, error)
FetchOne lets you get the details of a Terminal
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // resp, err := paystackClient.Terminals.FetchOne("<terminalId>") resp, err := terminalClient.FetchOne("<terminalId>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TerminalClient) SendEvent ¶
func (t *TerminalClient) SendEvent(terminalId string, eventType TerminalEvent, action string, data interface{}) (*Response, error)
SendEvent lets you send an event from your application to the Paystack Terminal
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // payload := map[string]interface{}{ // "id": 7895939, "reference": 4634337895939 } // resp, err := paystackClient.Terminals.SendEvent("30",p.TerminalEventInvoice,"process", payload) payload := map[string]interface{}{ "id": 7895939, "reference": 4634337895939 } resp, err := terminalClient.SendEvent("30",p.TerminalEventInvoice,"process", payload) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TerminalClient) TerminalStatus ¶
func (t *TerminalClient) TerminalStatus(terminalId string) (*Response, error)
TerminalStatus lets you check the availability of a Terminal before sending an event to it
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // resp, err := paystackClient.Terminals.TerminalStatus("30") resp, err := terminalClient.TerminalStatus("30") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TerminalClient) Update ¶
Update lets you update the details of a Terminal
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) terminalClient := p.NewTerminalClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a terminal client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Terminals field is a `TerminalClient` // Therefore, this is possible // resp, err := paystackClient.Terminals.Update("<terminalId>", "New Terminal","somewhere on earth") resp, err := terminalClient.Update("<terminalId>", "New Terminal","somewhere on earth") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type TerminalEvent ¶
type TerminalEvent = string
TerminalEvent specifies the supported terminal event by paystack
const TerminalEventInvoice TerminalEvent = "invoice"
const TerminalEventTransaction TerminalEvent = "transaction"
type TransactionClient ¶
type TransactionClient struct {
// contains filtered or unexported fields
}
TransactionClient interacts with endpoints related to paystack Transaction resource that allows you to create and manage payments on your Integration.
func NewTransactionClient ¶
func NewTransactionClient(options ...ClientOptions) *TransactionClient
NewTransactionClient creates a TransactionClient
Example:
import p "github.com/gray-adeyi/paystack" txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>"))
func (*TransactionClient) All ¶
func (t *TransactionClient) All(queries ...Query) (*Response, error)
All lets you list Transactions carried out on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.All() // All also accepts queries, so say you want to customize how many Transactions to retrieve // and which page to retrieve, you can write it like so. // resp, err := txnClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/transaction/#list for supported query parameters
resp, err := txnClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) ChargeAuthorization ¶
func (t *TransactionClient) ChargeAuthorization(amount int, email string, authorizationCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
ChargeAuthorization lets you charge authorizations that are marked as reusable
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.ChargeAuthorization(200000,"johndoe@example.com","AUTH_xxx") // you can pass in optional parameters to the `txnClient.ChargeAuthorization` with `p.WithOptionalParameter` // for example say you want to specify the currency and channel // resp, err := txnClient.ChargeAuthorization(200000, "johndoe@example.com", p.WithOptionalParameter("currency", "NGN"), p.WithOptionalParameter("channel","bank")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/transaction/#charge-authorization // Multiple optional parameters can be passed into `ChargeAuthorization` each with it's `p.WithOptionalParameter` resp, err := txnClient.ChargeAuthorization(200000,"johndoe@example.com","AUTH_xxx") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) Export ¶
func (t *TransactionClient) Export(queries ...Query) (*Response, error)
Export lets you export a list of Transactions carried out on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.Export() // Export also accepts queries, so say you want to customize how many Transactions to retrieve // and which page to retrieve, you can write it like so. // resp, err := txnClient.Export(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/transaction/#export for supported query parameters
resp, err := txnClient.Export() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) FetchOne ¶
func (t *TransactionClient) FetchOne(id string) (*Response, error)
FetchOne lets you get the details of a transaction carried out on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.FetchOne("<id>") resp, err := txnClient.FetchOne("<id>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) Initialize ¶
func (t *TransactionClient) Initialize(amount int, email string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Initialize lets you initialize a transaction from your backend
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.Initialize(200000, "johndoe@example.com") // you can pass in optional parameters to the `txnClient.Initialize` with `p.WithOptionalParameter` // for example say you want to specify the currency. // resp, err := txnClient.Initialize(200000, "johndoe@example.com", p.WithOptionalParameter("currency", "NGN")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/transaction/#initialize // Multiple optional parameters can be passed into `Initialize` each with it's `p.WithOptionalParameter` resp, err := txnClient.Initialize(200000, "johndoe@example.com") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) PartialDebit ¶
func (t *TransactionClient) PartialDebit(authorizationCode string, currency string, amount string, email string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
PartialDebit lets you retrieve part of a payment from a customer
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.PartialDebit("AUTH_xxx","NGN","200000", "johndoe@example.com") // you can pass in optional parameters to the `txnClient.PartialDebit` with `p.WithOptionalParameter` // for example say you want to specify the `at_least` optional parameter. // resp, err := txnClient.PartialDebit("AUTH_xxx","NGN","200000", "johndoe@example.com", p.WithOptionalParameter("at_least",100000)) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/transaction/#partial-debit // Multiple optional parameters can be passed into `Initialize` each with it's `p.WithOptionalParameter` resp, err := txnClient.PartialDebit("AUTH_xxx","NGN","200000", "johndoe@example.com") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) Timeline ¶
func (t *TransactionClient) Timeline(idOrReference string) (*Response, error)
Timeline lets you view the timeline of a transaction
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.Timeline("<idOrReference>") resp, err := txnClient.Timeline("<idOrReference>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) Total ¶
func (t *TransactionClient) Total(queries ...Query) (*Response, error)
Total lets you retrieve the total amount received on your account
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.Total() // Total also accepts queries, so say you want to customize how many Transactions to retrieve // and which page to retrieve, you can write it like so. // resp, err := txnClient.Total(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/transaction/#totals for supported query parameters
resp, err := txnClient.Total() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionClient) Verify ¶
func (t *TransactionClient) Verify(reference string) (*Response, error)
Verify lets you confirm the status of a transaction
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnClient := p.NewTransactionClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transactions field is a `TransactionClient` // Therefore, this is possible // resp, err := paystackClient.Transactions.Verify("<reference>") resp, err := txnClient.Verify("<reference>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type TransactionSplitClient ¶
type TransactionSplitClient struct {
// contains filtered or unexported fields
}
TransactionSplitClient interacts with endpoints related to paystack Transaction Split resource that allows you to split the settlement for a transaction across a payout account, and one or more subaccounts.
func NewTransactionSplitClient ¶
func NewTransactionSplitClient(options ...ClientOptions) *TransactionSplitClient
NewTransactionSplitClient creates a TransactionSplitClient
Example:
import p "github.com/gray-adeyi/paystack" txnSplitClient := p.NewTransactionSplitClient(p.WithSecretKey("<paystack-secret-key>"))
func (*TransactionSplitClient) Add ¶
Add lets you add a Subaccount to a Transaction Split, or update the share of an existing Subaccount in a Transaction Split
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnSplitClient := p.NewTransactionSplitClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction split client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransactionSplits field is a `TransactionSplitClient` // Therefore, this is possible // resp, err := paystackClient.TransactionSplits.Add("ACCT_hdl8abxl8drhrl3", 15) resp, err := txnSplitClient.Add("ACCT_hdl8abxl8drhrl3", 15) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionSplitClient) All ¶
func (t *TransactionSplitClient) All(queries ...Query) (*Response, error)
All let you list the transaction splits available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnSplitClient := p.NewTransactionSplitClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction split client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransactionSplits field is a `TransactionSplitClient` // Therefore, this is possible // resp, err := paystackClient.TransactionSplits.All() // All also accepts queries, so say you want to filter by the name of the split // and if it is active, you can write it like so. // resp, err := txnSplitClient.All(p.WithQuery("name","co-founders account"), p.WithQuery("active", true))
// see https://paystack.com/docs/api/split/#list for supported query parameters
resp, err := txnSplitClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionSplitClient) Create ¶
func (t *TransactionSplitClient) Create(name string, transactionSplitType string, currency string, subaccounts interface{}, bearerType string, bearerSubaccount string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a split payment on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnSplitClient := p.NewTransactionSplitClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction split client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransactionSplits field is a `TransactionSplitClient` // Therefore, this is possible // subaccounts := []map[string]interface{}{ // {"subaccount": "ACCT_z3x6z3nbo14xsil", "share": 20}, // {"subaccount": "ACCT_pwwualwty4nhq9d", "share": 80}, // } // resp, err := paystackClient.TransactionSplits.Create("co-founders account","percentage","NGN", // subaccounts,"subaccount","ACCT_hdl8abxl8drhrl3")
subaccounts := []map[string]interface{}{ {"subaccount": "ACCT_z3x6z3nbo14xsil", "share": 20}, {"subaccount": "ACCT_pwwualwty4nhq9d", "share": 80}, } resp, err := transactionSplitClient.Create("co-founders account","percentage","NGN",
subaccounts,"subaccount","ACCT_hdl8abxl8drhrl3") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionSplitClient) FetchOne ¶
func (t *TransactionSplitClient) FetchOne(id string) (*Response, error)
FetchOne lets you get the details of a split on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnSplitClient := p.NewTransactionSplitClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction split client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransactionSplits field is a `TransactionSplitClient` // Therefore, this is possible // resp, err := paystackClient.TransactionSplits.FetchOne("<id>") resp, err := txnSplitClient.FetchOne("<id>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionSplitClient) Remove ¶
func (t *TransactionSplitClient) Remove(id string, subAccount string) (*Response, error)
Remove lets you remove a subaccount from a transaction split
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnSplitClient := p.NewTransactionSplitClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction split client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransactionSplits field is a `TransactionSplitClient` // Therefore, this is possible // resp, err := paystackClient.TransactionSplits.Remove("143","ACCT_hdl8abxl8drhrl3") resp, err := txnSplitClient.Remove("143","ACCT_hdl8abxl8drhrl3") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransactionSplitClient) Update ¶
func (t *TransactionSplitClient) Update(id string, name string, active bool, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update a transaction split details on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) txnSplitClient := p.NewTransactionSplitClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transaction split client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransactionSplits field is a `TransactionSplitClient` // Therefore, this is possible // resp, err := paystackClient.TransactionSplits.Update("143", "co-authors account", true) // you can pass in optional parameters to the `txnSplitClient.Update` with `p.WithOptionalParameter` // for example say you want to specify the `bearer_type`. // resp, err := txnSplitClient.Update("143", "co-authors account", true, p.WithOptionalParameter("bearer_type","all")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/split/#update // Multiple optional parameters can be passed into `Update` each with it's `p.WithOptionalParameter` resp, err := txnSplitClient.Update("143", "co-authors account", true) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type TransferClient ¶
type TransferClient struct {
// contains filtered or unexported fields
}
TransferClient interacts with endpoints related to paystack transfer resource that lets you automate sending money to your Customers.
func NewTransferClient ¶
func NewTransferClient(options ...ClientOptions) *TransferClient
NewTransferClient creates a TransferClient
Example import p "github.com/gray-adeyi/paystack"
tfClient := p.NewTransferClient(p.WithSecretKey("<paystack-secret-key>"))
func (*TransferClient) All ¶
func (t *TransferClient) All(queries ...Query) (*Response, error)
All lets you retrieve all the Transfers made on your Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tfClient := p.NewTransferClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transfers field is a `TransferClient` // Therefore, this is possible // resp, err := paystackClient.Transfers.All() // All also accepts queries, so say you want to customize how many Transfers to retrieve // and which page to retrieve, you can write it like so. // resp, err := tfClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/transfer/#list for supported query parameters
resp, err := tfClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferClient) BulkInitiate ¶
func (t *TransferClient) BulkInitiate(source string, transfers interface{}) (*Response, error)
BulkInitiate lets you initiate multiple Transfers in a single request. You need to disable the Transfers OTP requirement to use this endpoint.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tfClient := p.NewTransferClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the transfer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transfers field is a `TransferClient` // Therefore, this is possible // Transfers := []map[string]interface{ // {"amount": 20000,"reference": "588YtfftReF355894J","reason": "Why not?","recipient":"RCP_2tn9clt23s7qr28"}, // {"amount": 30000,"reference": "YunoTReF35e0r4J","reason": "Because I can","recipient":"RCP_1a25w1h3n0xctjg"}, // {"amount": 40000,"reason": "Coming right up","recipient": "RCP_aps2aibr69caua7"}, } // resp, err := paystackClient.Transfers.BulkInitiate("balance", Transfers) Transfers := []map[string]interface{ {"amount": 20000,"reference": "588YtfftReF355894J","reason": "Why not?","recipient":"RCP_2tn9clt23s7qr28"}, {"amount": 30000,"reference": "YunoTReF35e0r4J","reason": "Because I can","recipient":"RCP_1a25w1h3n0xctjg"}, {"amount": 40000,"reason": "Coming right up","recipient": "RCP_aps2aibr69caua7"}, } resp, err := tfClient.BulkInitiate("balance", Transfers) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferClient) FetchOne ¶
func (t *TransferClient) FetchOne(idOrCode string) (*Response, error)
FetchOne lets you retrieve the details of a transfer on your Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tfClient := p.NewTransferClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transfers field is a `TransferClient` // Therefore, this is possible // resp, err := paystackClient.Transfers.FetchOne("<idOrCode>") resp, err := tfClient.FetchOne("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferClient) Finalize ¶
func (t *TransferClient) Finalize(transferCode string, otp string) (*Response, error)
Finalize lets you finalize an initiated transfer
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tfClient := p.NewTransferClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the transfer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transfers field is a `TransferClient` // Therefore, this is possible // resp, err := paystackClient.Transfers.Finalize("TRF_vsyqdmlzble3uii","928783")
resp, err := tfClient.Finalize("TRF_vsyqdmlzble3uii","928783")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferClient) Initiate ¶
func (t *TransferClient) Initiate(source string, amount int, recipient string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Initiate lets you send money to your Customers. Status of a transfer object returned will be pending if OTP is disabled. In the event that an OTP is required, status will read otp.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tfClient := p.NewTransferClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the transfer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transfers field is a `TransferClient` // Therefore, this is possible // resp, err := paystackClient.Transfers.Initiate("balance",500000,"RCP_gx2wn530m0i3w3m") // you can pass in optional parameters to the `Transfers.Initiate` with `p.WithOptionalParameter` // for example say you want to specify the `reason`. // resp, err := tfClient.Initiate("balance",500000,"RCP_gx2wn530m0i3w3m", p.WithOptionalParameter("reason","Discount Refund")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/transfer/#initiate // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := tfClient.Initiate("balance",500000,"RCP_gx2wn530m0i3w3m")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferClient) Verify ¶
func (t *TransferClient) Verify(reference string) (*Response, error)
Verify lets you verify the status of a transfer on your Integration.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tfClient := p.NewTransferClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Transfers field is a `TransferClient` // Therefore, this is possible // resp, err := paystackClient.Transfers.Verify("<reference>") resp, err := tfClient.Verify("<reference>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type TransferControlClient ¶
type TransferControlClient struct {
// contains filtered or unexported fields
}
TransferControlClient interacts with endpoints related to paystack transfer control resource that lets you manage settings of your Transfers.
func NewTransferControlClient ¶
func NewTransferControlClient(options ...ClientOptions) *TransferControlClient
NewTransferControlClient creates a TransferControlClient
Example import p "github.com/gray-adeyi/paystack" tcClient := p.NewTransferControlClient(p.WithSecretKey("<paystack-secret-key>"))
func (*TransferControlClient) Balance ¶
func (t *TransferControlClient) Balance() (*Response, error)
Balance lets you retrieve the available balance on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tcClient := p.NewTransferControlClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer control client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferControl field is a `TransferControlClient` // Therefore, this is possible // resp, err := paystackClient.TransferControl.Balance() resp, err := tcClient.Balance() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferControlClient) BalanceLedger ¶
func (t *TransferControlClient) BalanceLedger() (*Response, error)
BalanceLedger lets you retrieve all pay-ins and pay-outs that occurred on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tcClient := p.NewTransferControlClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer control client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferControl field is a `TransferControlClient` // Therefore, this is possible // resp, err := paystackClient.TransferControl.BalanceLedger() resp, err := tcClient.BalanceLedger() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferControlClient) DisableOTP ¶
func (t *TransferControlClient) DisableOTP() (*Response, error)
DisableOTP lets you complete Transfers without use of OTPs. You will get an OTP to complete the request.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tcClient := p.NewTransferControlClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer control client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferControl field is a `TransferControlClient` // Therefore, this is possible // resp, err := paystackClient.TransferControl.DisableOTP() resp, err := tcClient.DisableOTP() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferControlClient) EnableOTP ¶
func (t *TransferControlClient) EnableOTP() (*Response, error)
EnableOTP lets you turn OTP requirement back on.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tcClient := p.NewTransferControlClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer control client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferControl field is a `TransferControlClient` // Therefore, this is possible // resp, err := paystackClient.TransferControl.EnableOTP() resp, err := tcClient.EnableOTP() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferControlClient) FinalizeDisableOTP ¶
func (t *TransferControlClient) FinalizeDisableOTP(otp string) (*Response, error)
FinalizeDisableOTP lets you finalize the request to disable OTP on your Transfers.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tcClient := p.NewTransferControlClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer control client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferControl field is a `TransferControlClient` // Therefore, this is possible // resp, err := paystackClient.TransferControl.FinalizeDisableOTP("<otp>") resp, err := tcClient.FinalizeDisableOTP("<otp>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferControlClient) ResendOTP ¶
func (t *TransferControlClient) ResendOTP(transferCode string, reason string) (*Response, error)
ResendOTP lets you generate a new OTP and sends to customer in the event they are having trouble receiving one.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) tcClient := p.NewTransferControlClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer control client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferControl field is a `TransferControlClient` // Therefore, this is possible // resp, err := paystackClient.TransferControl.ResendOTP("TRF_vsyqdmlzble3uii","resend_otp") resp, err := tcClient.ResendOTP("TRF_vsyqdmlzble3uii","resend_otp") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type TransferRecipientClient ¶
type TransferRecipientClient struct {
// contains filtered or unexported fields
}
TransferRecipientClient interacts with endpoints related to paystack transfer recipient resource that lets you create and manage beneficiaries that you send money to.
func NewTransferRecipientClient ¶
func NewTransferRecipientClient(options ...ClientOptions) *TransferRecipientClient
NewTransferRecipientClient creates a TransferRecipientClient
Example import p "github.com/gray-adeyi/paystack" trClient := p.NewTransferRecipientClient(p.WithSecretKey("<paystack-secret-key>"))
func (*TransferRecipientClient) All ¶
func (t *TransferRecipientClient) All(queries ...Query) (*Response, error)
All lets you retrieve transfer recipients available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) trClient := p.NewTransferRecipientClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer recipient client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferRecipients field is a `TransferRecipientClient` // Therefore, this is possible // resp, err := paystackClient.TransferRecipients.All() // All also accepts queries, so say you want to customize how many payment pages to retrieve // and which page to retrieve, you can write it like so. // resp, err := trClient.All(p.WithQuery("perPage","50"), p.WithQuery("page","2"))
// see https://paystack.com/docs/api/transfer-recipient/#list for supported query parameters
resp, err := trClient.All() if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferRecipientClient) BulkCreate ¶
func (t *TransferRecipientClient) BulkCreate(batch interface{}) (*Response, error)
BulkCreate lets you create multiple transfer recipients in batches. A duplicate account number will lead to the retrieval of the existing record.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) trClient := p.NewTransferRecipientClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the transfer recipient client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferRecipients field is a `TransferRecipientClient` // Therefore, this is possible // batch := []map[string]interface{}{ // {"type":"nuban", "name" : "Habenero Mundane", "account_number": "0123456789","bank_code":"033","currency": "NGN"}, // {"type":"nuban","name" : "Soft Merry","account_number": "98765432310","bank_code": "50211","currency": "NGN"}, // } // resp, err := paystackClient.TransferRecipients.BulkCreate(batch) batch := []map[string]interface{}{ {"type":"nuban", "name" : "Habenero Mundane", "account_number": "0123456789","bank_code":"033","currency": "NGN"}, {"type":"nuban","name" : "Soft Merry","account_number": "98765432310","bank_code": "50211","currency": "NGN"}, }
resp, err := trClient.BulkCreate(batch)
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferRecipientClient) Create ¶
func (t *TransferRecipientClient) Create(recipientType string, name string, accountNumber string, bankCode string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Create lets you create a new recipient. A duplicate account number will lead to the retrieval of the existing record.
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) trClient := p.NewTransferRecipientClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access the transfer recipient client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferRecipients field is a `TransferRecipientClient` // Therefore, this is possible // resp, err := paystackClient.TransferRecipients.Create("nuban","Tolu Robert","01000000010", "058") // you can pass in optional parameters to the `PaymentPages.Create` with `p.WithOptionalParameter` // for example, say you want to specify the `currency`. // resp, err := ppClient.Create("nuban","Tolu Robert","01000000010", "058", p.WithOptionalParameter("currency","NGN")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/transfer-recipient/#create // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter`
resp, err := trClient.Create("nuban","Tolu Robert","01000000010", "058")
if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferRecipientClient) Delete ¶
func (t *TransferRecipientClient) Delete(idOrCode string) (*Response, error)
Delete lets you delete a transfer recipient (sets the transfer recipient to inactive)
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) trClient := p.NewTransferRecipientClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer recipient client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferRecipients field is a `TransferClient` // Therefore, this is possible // resp, err := paystackClient.PaymentPages.Delete("<idOrCode>") resp, err := trClient.Delete("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferRecipientClient) FetchOne ¶
func (t *TransferRecipientClient) FetchOne(idOrCode string) (*Response, error)
FetchOne lets you retrieve the details of a transfer recipient
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) trClient := p.NewTransferRecipientClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer recipient client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferRecipients field is a `TransferRecipientClient` // Therefore, this is possible // resp, err := paystackClient.TransferRecipients.FetchOne("<idOrSlug>") resp, err := trClient.FetchOne("<idOrCode>") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*TransferRecipientClient) Update ¶
func (t *TransferRecipientClient) Update(idOrCode string, name string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
Update lets you update transfer recipients available on your Integration
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) trClient := p.NewTransferRecipientClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a transfer recipient client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.TransferRecipients field is a `TransferClient` // Therefore, this is possible // resp, err := paystackClient.TransferRecipients.Update("<idOrCode>", "Rick Sanchez") // you can pass in optional parameters to the `TransferRecipients.Update` with `p.WithOptionalParameter` // for example say you want to specify the `email`. // resp, err := trClient.Create("<idOrCode>", "Rick Sanchez", p.WithOptionalParameter("email","johndoe@example.com")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/transfer-recipient/#update // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter` resp, err := trClient.Update("<idOrCode>", "Rick Sanchez") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
type VerificationClient ¶
type VerificationClient struct {
// contains filtered or unexported fields
}
VerificationClient interacts with endpoints related to paystack Verification resource that allows you to perform KYC processes.
func NewVerificationClient ¶
func NewVerificationClient(options ...ClientOptions) *VerificationClient
NewVerificationClient creates a VerificationClient
Example import p "github.com/gray-adeyi/paystack" vClient := p.NewVerificationClient(p.WithSecretKey("<paystack-secret-key>"))
func (*VerificationClient) ResolveAccount ¶
func (v *VerificationClient) ResolveAccount(queries ...Query) (*Response, error)
ResolveAccount lets you confirm an account belongs to the right customer
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) vClient := p.NewVerificationClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a Verification client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Verification field is a `VerificationClient` // Therefore, this is possible // resp, err := paystackClient.Verification.ResolveAccount(p.WithQuery("account_number","0022728151"), // p.WithQuery("bank_code","063")) // All also accepts queries, you can write it like so. // resp, err := paystackClient.Verification.ResolveAccount(p.WithQuery("account_number","0022728151"), // p.WithQuery("bank_code","063"))
// see https://paystack.com/docs/api/verification/#resolve-account for supported query parameters
resp, err := vClient.ResolveAccount(p.WithQuery("account_number","0022728151"), p.WithQuery("bank_code","063")) if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*VerificationClient) ResolveBIN ¶
func (v *VerificationClient) ResolveBIN(bin string) (*Response, error)
ResolveBIN lets you retrieve more information about a customer's card
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) vClient := p.NewVerificationClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a Verification client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Verification field is a `VerificationClient` // Therefore, this is possible // resp, err := paystackClient.Verification.ResolveBIN("539983") resp, err := vClient.ResolveAccount("539983") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
func (*VerificationClient) ValidateAccount ¶
func (v *VerificationClient) ValidateAccount(accountName string, accountNumber string, accountType string, bankCode string, countryCode string, documentType string, optionalPayloadParameters ...OptionalPayloadParameter) (*Response, error)
ValidateAccount lets you confirm the authenticity of a customer's account number before sending money
Example:
import ( "fmt" p "github.com/gray-adeyi/paystack" "encoding/json" ) vClient := p.NewVerificationClient(p.WithSecretKey("<paystack-secret-key>")) // Alternatively, you can access a Verification client from an APIClient // paystackClient := p.NewAPIClient(p.WithSecretKey("<paystack-secret-key>")) // paystackClient.Verification field is a `VerificationClient` // Therefore, this is possible // resp, err := paystackClient.Verification.ValidateAccount("Ann Bron","0123456789","personal", // "632005","ZA","identityNumber") // you can pass in optional parameters to the `Verification.ValidateAccount` with `p.WithOptionalParameter` // for example say you want to specify the `document_number`. // resp, err := vClient.CreateValidateAccount("Ann Bron","0123456789","personal", "632005","ZA", // "identityNumber", p.WithOptionalParameter("document_number","1234567890123")) // the `p.WithOptionalParameter` takes in a key and value parameter, the key should match the optional parameter // from paystack documentation see https://paystack.com/docs/api/verification/#validate-account // Multiple optional parameters can be passed into `Create` each with it's `p.WithOptionalParameter` resp, err := vClient.ValidateAccount("Ann Bron","0123456789","personal","632005","ZA","identityNumber") if err != nil { panic(err) } // you can have data be a custom structure based on the data your interested in retrieving from // from paystack for simplicity, we're using `map[string]interface{}` which is sufficient to // to serialize the json data returned by paystack data := make(map[string]interface{}) err := json.Unmarshal(resp.Data, &data); if err != nil { panic(err) } fmt.Println(data)
Source Files ¶
- api_client.go
- apple_pay_client.go
- bulk_charges_client.go
- charge_client.go
- customer_client.go
- dedicated_virtual_account_client.go
- dispute_client.go
- doc.go
- integration_client.go
- miscellaneous_client.go
- payment_pages_client.go
- payment_request_client.go
- plan_client.go
- product_client.go
- refund_client.go
- settlement_client.go
- sub_account_client.go
- subscription_client.go
- terminal_client.go
- transaction_client.go
- transaction_split_client.go
- transfer_client.go
- transfer_control_client.go
- transfer_recipient.go
- verification_client.go