Struct paystack::PaystackClient
source · pub struct PaystackClient { /* private fields */ }
Expand description
This is the struct that allows you to authenticate to the PayStack API. It contains the API key which allows you to interact with the API.
Implementations§
source§impl PaystackClient
impl PaystackClient
sourcepub fn new(key: impl Into<String>) -> Self
pub fn new(key: impl Into<String>) -> Self
This method creates a new PayStack client with the specified API key.
It takes the following parameters: - key: Paystack API key.
sourcepub async fn initialize_transaction(
&self,
transaction_body: Transaction
) -> PaystackResult<TransactionResponse>
pub async fn initialize_transaction( &self, transaction_body: Transaction ) -> PaystackResult<TransactionResponse>
This method initalizes a new transaction using the Paystack API.
It takes a Transaction type as its parameter
sourcepub async fn verify_transaction(
&self,
reference: String
) -> PaystackResult<TransactionStatus>
pub async fn verify_transaction( &self, reference: String ) -> PaystackResult<TransactionStatus>
This method confirms the status of a transaction.
It takes the following parameters: - reference: The transaction reference used to intiate the transaction
sourcepub async fn list_transactions(
&self,
number_of_transactions: Option<u32>,
status: Option<Status>
) -> PaystackResult<TransactionStatusList>
pub async fn list_transactions( &self, number_of_transactions: Option<u32>, status: Option<Status> ) -> PaystackResult<TransactionStatusList>
This method returns a Vec of transactions carried out on your integrations.
The method takes the following parameters: - perPage (Optional): Number of transactions to return. If None is passed as the parameter, the last 10 transactions are returned. - status (Optional): Filter transactions by status, defaults to Success if no status is passed.
sourcepub async fn fetch_transactions(
&self,
transaction_id: u32
) -> PaystackResult<TransactionStatus>
pub async fn fetch_transactions( &self, transaction_id: u32 ) -> PaystackResult<TransactionStatus>
Get details of a transaction carried out on your integration
This methods take the Id of the desired transaction as a parameter
All authorizations marked as reusable can be charged with this endpoint whenever you need to receive payments
This function takes a Charge Struct as parameter
sourcepub async fn view_transaction_timeline(
&self,
id: Option<u32>,
reference: Option<String>
) -> PaystackResult<TransactionTimeline>
pub async fn view_transaction_timeline( &self, id: Option<u32>, reference: Option<String> ) -> PaystackResult<TransactionTimeline>
View the timeline of a transaction
This function takes in the Transaction id or reference as a parameter
sourcepub async fn total_transactions(
&self
) -> PaystackResult<TransactionTotalsResponse>
pub async fn total_transactions( &self ) -> PaystackResult<TransactionTotalsResponse>
Total amount received on your account.
This route normally takes a perPage or page query, However in this case it is ignrored. If you need it in your work please open an issue and it will be implemented.
sourcepub async fn export_transaction(
&self,
status: Option<Status>,
currency: Option<Currency>,
settled: Option<bool>
) -> PaystackResult<ExportTransactionResponse>
pub async fn export_transaction( &self, status: Option<Status>, currency: Option<Currency>, settled: Option<bool> ) -> PaystackResult<ExportTransactionResponse>
Export a list of transactions carried out on your integration
This method takes the following parameters
- Status (Optional): The status of the transactions to export. Defaults to all
- Currency (Optional): The currency of the transactions to export. Defaults to NGN
- Settled (Optional): To state of the transactions to export. Defaults to False.
sourcepub async fn partial_debit(
&self,
transaction_body: PartialDebitTransaction
) -> PaystackResult<TransactionStatus>
pub async fn partial_debit( &self, transaction_body: PartialDebitTransaction ) -> PaystackResult<TransactionStatus>
Retrieve part of a payment from a customer.
It takes a PartialDebitTransaction type as a parameter.
NB: it must be created with the PartialDebitTransaction Builder.
Trait Implementations§
source§impl Clone for PaystackClient
impl Clone for PaystackClient
source§fn clone(&self) -> PaystackClient
fn clone(&self) -> PaystackClient
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more