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

source

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.

source

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

source

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

source

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.

source

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

source

pub async fn charge_authorization( &self, charge: Charge ) -> PaystackResult<TransactionStatus>

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

source

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

source

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.

source

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.
source

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

source§

fn clone(&self) -> PaystackClient

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PaystackClient

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more